From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: text color + highlight Date: Sat, 07 Aug 2010 00:52:47 -0400 Message-ID: <25739.1281156767@gamaville.dokosmarshall.org> References: <87pqxw5cb1.fsf@gnu.org> <87mxszcsuv.fsf@gmail.com> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=38694 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OhbPB-0005bD-9J for emacs-orgmode@gnu.org; Sat, 07 Aug 2010 00:53:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OhbP9-0002xb-W2 for emacs-orgmode@gnu.org; Sat, 07 Aug 2010 00:53:09 -0400 Received: from vms173003pub.verizon.net ([206.46.173.3]:42089) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OhbP9-0002xP-PG for emacs-orgmode@gnu.org; Sat, 07 Aug 2010 00:53:07 -0400 Received: from gamaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0L6R00GO5MVZUF00@vms173003.mailsrvcs.net> for emacs-orgmode@gnu.org; Fri, 06 Aug 2010 23:52:52 -0500 (CDT) In-reply-to: Message from "Eric Schulte" of "Fri, 06 Aug 2010 17:51:36 EDT." <87mxszcsuv.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Bastien , emacs-orgmode@gnu.org, nicholas.dokos@hp.com, Vinh Nguyen Eric Schulte wrote: > Hi, > > I've recently seen similar requests on this list. > > The attached patch provides a first pass at this support implementing > both in-buffer coloring given the following syntax, and html export (I > don't know the correct LaTeX syntax, but it shouldn't be hard to extend > this to LaTeX as well). This uses something like the LaTeX Beamer > \color{}{} directive, for example... > > My name is \color{red}{eric} schulte. > > Would result in the word "eric" appearing in red. Even though I > implemented the syntax above, I'm *not* recommending this syntax, it > feels decidedly more like "latex" than "org", it was simply the only > obvious option for this initial implementation. > Having LaTeX syntax in an org file is not uncommon: you could view it as a LaTeX fragment that happens to work in other exports (thanks to your patch), as well as in the fontification of the buffer. And it *almost* works in LaTeX as is: the only problem is that the LaTeX \color command (in contrast to yours) is modal: its range extends to the end of the current group; so unless some pains are taken, *everything* after \color{red} would be red. But let's assume you chose a slightly different designator, say \xcolor{red}. THen the following exports to LaTeX just fine: --8<---------------cut here---------------start------------->8--- #+LATEX_HEADER: \usepackage{color} #+LATEX_HEADER: \newcommand{\xcolor}[2]{{\color{#1}#2}} * test My name is \xcolor{red}{eric} schulte. --8<---------------cut here---------------end--------------->8--- Note the inner braces in the definition of \xcolor: they delimit the group in which the changed color is active. So it might be a good idea to use a different designator than \color and have the LaTeX exporter add the mods above. The color package is part of the LaTeX core, so it wouldn't cost anything but processing costs to always include it. Alternatively, one can play renaming games in LaTeX and that might free up \color for this use, but that's always a bit more complicated and can be confusing. Thanks, Nick