[texhax] TeX commands as abbreviations

martin f krafft madduck at madduck.net
Thu Nov 1 14:38:04 CET 2007

Dear list,

in writing my thesis, I found it useful to abbreviate common words,
and to hide others behind commands to allow for central formatting
changes. For instance, \FLOSS is a command to produce "Free and
open-source software" and \eg is replaced by \foreign{e.g.}, just to
give two examples.

My problem is that I have to jump through hoops in using them. If
I use the commands \eg like so, the result is

  "use the commands e.g.like so"

without the space following the command. Thinking that I just make
the space part of the command, I included a ~ in the definition, so
now \eg produces \foreign{e.g.}~, but that seems to produce worse:

  "use the commands e.g.ike so"

as it also swallows the next letter, unless it's a punctuation mark.

My first question is why the space is being swallowed and what I can
do about it.

I found that if I add {} to the invocation, it works: Use \eg{} like
this. However, when used in e.g. a \cite command:
\cite[\eg{}][]{ThisThatEtAl}, then I get twice the space between
e.g. and the citation.

Another solution is to add \ after the command, \eg\ like so, which
also works, but cannot be used inside the \cite brackets and is also
easily forgotten.

Is there a way to achieve what I want: being able to just use words
\eg like so, in the main text as well as in command arguments,
without having to add other characters each time I use the

martin | http://madduck.net/ | http://two.sentenc.es/
"der besitz der wahrheit ist nicht schrecklich,
 sondern langweilig, wie jeder besitz."
                                                 - friedrich nietzsche
spamtraps: madduck.bogus at madduck.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/)
Url : http://tug.org/pipermail/texhax/attachments/20071101/09169f33/attachment.bin 

More information about the texhax mailing list