Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 10 down vote accepted

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

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.