[pdftex] Getting the correct word spacing after Macros.

Klaus Jantzen KDJantzen at t-online.de
Tue Jun 11 11:41:53 CEST 2002

Michael Chapman wrote:
> Apologies in advance, this is more Latex than pdfLatex, but I have difficulty
> finding keywords to search the archives for what must(?) be a trivial
> question.
> I have a document with several dozen complicated words/phrases. To
> trivialise, if I were to set:
> \newcommand{\USA}{United States of America}
> is there an easy way of making the command so a space is (automatically)
> inserted if the next character is a letter or number, but no space is
> inserted if the next character is punctuation.
> (E.gg.  It happened in United States of America.
>         In the United States of America it is common for people ....)
> Have thought of a regular expression search of the file and/or trying to get
> into if/then programming of Latex, but I feel I must be re-inventing the
> wheel ... !
> Thanks for any advice (even if I do blush!),
>                 Michael.

\xspace is your friend:

In the preamble specify

and then

\newcommand{\USA}{United States of America\xspace}

Kind Regards,

K. Jantzen

K+K Jantzen Software Services GmbH

More information about the pdftex mailing list