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?

lockstep
  • 250,273
vy32
  • 4,780

1 Answers1

10

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

lockstep
  • 250,273