6

When using a macro ending with an \xspace followed by a small space \, xspace inserts an extra (normal) space.

\documentclass[parskip=half]{scrartcl}


\usepackage{xspace}
\newcommand{\USB}{USB\xspace}

\begin{document}
    \USB-Port (o.\,k.)

    Use \USB to \dots (o.\,k.)

    \USB\,A-Plug (too much space)
\end{document}

xspace

Would it be possible to fix this?

10

Use \xspaceaddexceptions{\,}. See section 1.1. of the xspace manual.

\documentclass[parskip=half]{scrartcl}

\usepackage{xspace}
\xspaceaddexceptions{\,}

\newcommand{\USB}{USB\xspace}

\begin{document}
    \USB-Port (o.\,k.)

    Use \USB to \dots (o.\,k.)

    \USB\,A-Plug (o.\,k., too)
\end{document}

enter image description here

  • 2
    Thank you! But why is this not the default? – Tobi Oct 10 '12 at 21:11

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.