8

Am I wrong in thinking that \xspace should not introduce a space when used inside an \enquote command as used in the following MWE? And how can I get the two to work together?

\documentclass{article}
\usepackage{csquotes}
\usepackage{xspace}

\newcommand{\test}{test\xspace}

\begin{document}
    \test. \test, ``\test'' \test \enquote{\test} \test \enquote{\test}. 
\end{document}

Output from the MWE

8

enter image description here

You can add csquotes end of argument marker to the xspace list of exceptions:

\documentclass{article}
\usepackage{csquotes}
\usepackage{xspace}
\makeatletter
\xspaceaddexceptions{\csq@qclose@i}
\makeatletter

\newcommand{\test}{test\xspace}

\begin{document}
    \test. \test, ``\test'' \test \enquote{\test} \test \enquote{\test}. 
\end{document}

But note problems like this are inevitable and predicted:

Drawbacks of xspace

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.