# Abbreviations and full stop--how to avoid double dots?

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.

-

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

\begin{document}
\WHP

\WHP.
\end{document}

-
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
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 – Herbert 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