[pdftex] Getting the correct word spacing after Macros.

The Thanh Han hanthethanh at fptnet.com
Wed Jun 12 00:31:36 CEST 2002

On Tue, Jun 11, 2002 at 09:27:05AM +0000, 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 ... !

I use the following macro for abbreviations:

        \errmessage{abbreviation <#1> undefined!}

\abbr{THANH}{H\`an Th\^e\llap{\raise 0.5ex\hbox{\'{}}} Th\`anh}
\abbr{MM}{Multiple Master}
\abbr{CM}{Computer Modern}
\abbr{LF}{\textrm{\it letter\!\_\kern.1emfit}}
\abbr{MIRKA}{Miroslava Mis\'akov\'a}

and write ie \<TEX> instead of \TeX\ or \TeX{}. I also have some macro for the
editor I use (vim) so I don't have to write '\<TEX>' but only 'tex' and some
shortcurt to turn it to \<TEX> (in my case <C-X><C-K>). This is much faster than any 
of sequences '\<TEX>', '\TeX\ ' or '\TeX{}'. Addding a new abbreviation is
as trivial as

\abbr{USA}{United States of America}


More information about the pdftex mailing list