[XeTeX] Need some input about \newcommand to create alias

Maxim Cournoyer maxim.cournoyer at gmail.com
Sat Nov 28 05:23:10 CET 2009


Dear XeTeX fidels,

In my first document written with XeTeX, I wanted to do an alias for the
abbreviation CO_2 (carbon dioxyde), but had two difficulties.

My first one was to try to use something like this : %
\newcommand{\co2}{CO$_2$}
The problem was that it seems we cannot use "numbers" in the command
name, such as the '2' in \co2. Is there a way to circumvent this?

Another weird issue I ran into was, after changing  \co2 to something
more wordy as \codeux, my actual replacement would delete all trailing
space. Let me explain by an example : 
ex : The traffic in developed nations  is the cause to an average of 26%
of the \codeux emissions. 

Results : The traffic in developed nations  is the cause to an average
of 26% of the CO_2emissions.

Note the lack of a space character between the _2 subscript and
emissions. Using CO$_2$ straight in my text solved the problem,
surprisingly. Is there an explanation for this? What should I do to
prevent this from happening? 

Cheers.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/xetex/attachments/20091127/4589023a/attachment.html>


More information about the XeTeX mailing list