I have a document in which certain frequently-occurring entity names are replaced with macros, e.g.:
\newcommand{\entity}{\emph{Name of Entity}}
...
Lorem ipsum dolor sit \entity, consequat consectetur.
If I define the command like this I get correct formatting if \entity
is immediately followed by punctuation (as above) but incorrect formatting otherwise (e.g. Lorem \entity ipsum
becomes "Lorem Name of Entityipsum"). If I include the space in the definition of \entity
(note space between closing brackets):
\newcommand{\entity}{\emph{Name of Entity} }
I get the opposite behaviour, proper spacing only when not followed by punctuation.
I assume there's some magick command I'm not including in the macro to achieve something sensible?
\xspace
. – barbara beeton Mar 22 '12 at 16:22\xspace
is exactly what I'm after, thanks. Would you care to add that as an answer so I can mark it accepted? – Doches Mar 22 '12 at 16:32\xspace
doesn't work with plain tex. we oldtimers really do prefer a trailing backslash or a grouped{\command}
, but we're a dwindling minority. – barbara beeton Mar 22 '12 at 16:39