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}
... occurs \whpcmd{} by our ...– yo' Mar 17 '12 at 10:06\newcommandand thexspacepackage, 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:25abbrevspackage. This package claims to intelligently detect when a space is required, without using\xspace. – haggai_e Mar 18 '12 at 08:57