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

ThomasH
  • 942

1 Answers1

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

David Carlisle
  • 757,742