# Problem with spacing after abbreviation [duplicate]

Possible Duplicate:
\newcommand and spacing
No space following macro without argument

I want to use \newabbrev for some abbreviations, but the spacing is off. With \newabbrev, I get spacing both before a new word and before a period. With a simple \newcommand it's the other way around. What do I do?

\documentclass{article}
\usepackage{abbrevs}
\newabbrev{\whp}{with high probability}
\newcommand{\whpcmd}{with high probability}
\begin{document}
\setlength{\parindent}{0in}
The event occurs \whp by our previous argument. We get spacing, using \verb|\newabbrev|.


Edit: Specifically, why does the abbreviation get the space before the period? That doesn't seem to make sense.

The event occurs \whpcmd by our previous argument. No spacing (bad), Using \verb|\newcommand|.

The event occurs \whp. We get spacing (bad), using \verb|\newabbrev|.

The event occurs \whpcmd. No spacing, Using \verb|\newcommand|.

\end{document}


## marked as duplicate by lockstep, Andrey Vihrov, Yiannis Lazarides, egreg, ThorstenMar 17 '12 at 17:00

• The reason why there's no spacing in the second case is because command eats all the following whitespace. You can protect it by empty braces: ... occurs \whpcmd{} by our ... – yo' Mar 17 '12 at 10:06
• You could use \newcommand and the xspace package, which will add a space only if the next character is not a punctuation mark. Have a look at this question (possible duplicate) – ienissei Mar 17 '12 at 10:25
• I don't think this question is a duplicate. Other questions on the same topic do not refer to the abbrevs package. This package claims to intelligently detect when a space is required, without using \xspace. – haggai_e Mar 18 '12 at 8:57