I have trouble with macros expanding to an abbreviated expression. Say I have \WHP which expands to "with high prob." (artificial example). I want to avoid the dot after the abbreviation colliding with full stops later on, like

"We concluded that hypothesis holds \WHP."

which should not expand to

"We concluded that hypothesis holds with high prob.."

but simply end with one full stop.

\def\WHP{with high prob\@ifnextchar.{}{.}}% test of next token 


  • 9
    Or better yet, make the \@ifnextchar.{}{.} bit a separate macro and use it in the definition of any abbreviation. – Harald Hanche-Olsen Feb 25 '11 at 20:27
  • 1
    Thanks a lot. This will be my \xdot macro from now on. Oh, and for the sake of good typography I'll throw a \@ in there after the dot. – Ubik Feb 25 '11 at 20:55
  • How can I use this in the glossaries package for the \gls{...} and related commands, for abbreviations and the like which may end in a dot. – Nicholas Hamilton Jun 17 '13 at 10:43
  • @ADP: show an example – user2478 Jun 17 '13 at 11:09
  • @Herbert, I have posted a question: tex.stackexchange.com/questions/119537/… – Nicholas Hamilton Jun 17 '13 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.