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

Ross Moore ross at ics.mq.edu.au
Sat Nov 28 08:06:53 CET 2009


Hi Maxim,

On 28/11/2009, at 4:28 PM, Maxim Cournoyer wrote:

> Ok, as a small recapitulation :
>
> 1) Using \codeux\, as proposed by Joe Pleso, does work.

Be careful.

I think you meant to say:
     Using \codeux\ , as proposed ...

Using  \codeux\,  puts only a thinspace after the chemical formula.

The (im-)practicality of this is that you need to be careful
about which character follows the macro usage.
For example, you'll be using:
    \codeux\ or \codeux, or even \codeux.

It may seem a trivial thing, but if you copy/paste phrases
around, to get the best wording, then it is just one more thing
that you'll need to think about; e.g., you don't want to
get '\codeux\,' when you really mean '\codeux,'.

On the other hand, if your macro expansion ends with  \xspace
then you will not have to think about this.

The \xspace  macro "looks ahead" to see what is the next character.
If it is a letter, then a space is inserted, otherwise no space
is needed.
However, it may be possible that you want to say something that
is not possible to achieve with \xspace .


>
> 2) Adding a pair of { } such as in \newcommand\{codeux}{CO$_2${ }  
> does work. Do not forget the space between the accolades. <face- 
> smile.png>

Presumably you mean:
       \newcommand{\codeux}{CO$_2${ }}

But with this definition you cannot properly end a phrase, clause
or sentence with \codeux .

>
> 3) For chemistry specific stuff,  Wilfred's recommendation of  
> chchem package seems like a much more elegant solution!

Sure.
But you'll still need to understand how macros work,
if you ever want to use them to reduce typing, or combine
pieces of coding into a single macro command.

>
> Thank you all for these great suggestions!
>
> See you around,
>
> Maxim


Hope this helps,

	Ross

------------------------------------------------------------------------
Ross Moore                                       ross at maths.mq.edu.au
Mathematics Department                           office: E7A-419
Macquarie University                             tel: +61 (0)2 9850 8955
Sydney, Australia  2109                          fax: +61 (0)2 9850 8114
------------------------------------------------------------------------





More information about the XeTeX mailing list