5

I have a little macro that I use for doing adding an e.g. in my writing:

\newcommand{\eg}{\emph{e.g.}\xspace}

The problem I have is that LaTeX is treating the g. as the end of a sentence and is spacing too much. Is there any way to disable this feature?

9

Add \@ to the definition of your custom macro. See When should I use intersentence spacing (`\@')? for details.

\documentclass{article}

\usepackage{xspace}

\newcommand{\origeg}{\emph{e.g.}\xspace}
\newcommand{\eg}{\emph{e.g.}\@\xspace}

\begin{document}

Some text \origeg and some more

Some text \eg and some more

\end{document}

enter image description here

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.