# “! Argument of \xpg@nospace has an extra }” error message with polyglossia

I use a code – to be found at the end – for long citations in the french tradition. When I use french quotation marks inside such a long citation, I have no problem on compiling with xetex if I load babel with the french option, and the error message

Argument of \xpg@nospace has an extra }.

when loading polyglossia. The same happens on compiling with lualatex, though with a different error message, beginning with

Package soul Error: Reconstruction failed.

The problem disappears if I define in the preamble of the document :



and if the french quotation marks inside the long citation are replaced by \og\fg.

So I suspect there is some conflict between polyglossia and soul – or my way of using soul. I first posted on fr.comp.text.tex, but obtained no solution.

Best regards, B. Alfonsi

Code (and minimal example):

\documentclass[a4paper,11pt, twoside]{article}

\usepackage{fontspec}% f
\setmainfont{Minion Pro}%
%\usepackage[french]{babel}
\usepackage{polyglossia}
\setmainlanguage{french}

\usepackage{soulutf8}
\usepackage {kvsetkeys}
\makeatletter
\newsavebox \citeguill@box
\define@key {citeguill}{left}[\guillemotleft]{\def\citeguill@left {#1}}
\define@key {citeguill}{right}[\guillemotright]{\def\citeguill@right {#1}}
\define@key {citeguill}{middle}[\hskip -\fontdimen2\font\mbox \guillemotright\hskip\fontdimen2\font]{\def\citeguill@middle
{\setbox\citeguill@box =\hbox {#1}\def\citeguill@middle {\copy
\citeguill@box }}%
}% \KV@citeguill@middle
\newcommand*\citeguillsetup [1]{\def\citeguill@setup {\kvsetkeys
{citeguill}{#1}}}
\let\citeguill@setup =\relax %

\newcommand*\citeguill [1][]{%
\kvsetkeys{citeguill}{left,right,middle}\citeguill@setup%
\kvsetkeys{citeguill}{#1}%
\SOUL@setup%
\def\SOUL@preamble {\citeguill@middle \citeguill@left }%
\def\SOUL@postamble {\citeguill@right }%
\def\SOUL@everysyllable {\the\SOUL@syllable }%
\def\SOUL@everyspace ##1{##1\nobreak \
\discretionary {\kern-\fontdimen 2\font }
{\citeguill@middle }
{}}%
\def\SOUL@everyhyphen {\discretionary%
{\SOUL@setkern \SOUL@hyphkern \SOUL@sethyphenchar }
{\citeguill@middle }
{}}%
\def\SOUL@everyexhyphen ##1{\SOUL@setkern \SOUL@hyphkern
\hbox{##1}\discretionary {}
{\citeguill@middle }
{\SOUL@setkern \SOUL@charkern }}%
\SOUL@%
}% \citeguill
\makeatother

\begin{document}

Pour conclure, les rédacteurs de \emph{L’Anti-Mythes} résument bien la question BHL
telle qu’elle se pose à l’automne 1977 : \citeguill{Que le cynisme séduise, que la
bêtise paie et que la mode soit au renouveau des idées les plus réactionnaires, cela
ne suffit pas à expliquer l’extraordinaire exploitation par les médias du phénomène
«nouveaux philosophes», ni leur impressionnant succès commercial.}

\end{document}

-
Hi Bernard. :-) –  karlkoeller Jul 14 '13 at 15:01
There's no problem if I use babel; there's nothing wrong in using babel with XeLaTeX. –  egreg Jul 14 '13 at 20:11

This seems to be an incompatibility between the workings of soul and how the \XeTeXinterchartoks feature is implemented in Polyglossia for French, regarding the guillemets.

If I say at the end of the preamble

\makeatletter
\appto\blockextras@french{%
\XeTeXinterchartoks \french@punctguillstart 255 = {\nobreakspace\ignorespaces}%
}
\appto\inlineextras@french{%
\XeTeXinterchartoks \french@punctguillstart 255 = {\nobreakspace\ignorespaces}%
}
\makeatother


(basically using babel's 3.9 definition), the error disappears. Polyglossia uses there \xpg@nospace that reads an argument, which is probably what confuses soul.

Of course this doesn't work with LuaLaTeX, for which you need babel. However, my advice is to use babel anyway, there's nothing wrong with it, particularly now that version 3.9 introduces XeLaTeX support.

-
Thank you for your answer ! It works perfectly. The problem with babel is that I use MiKTeX 2.9, and it has only babel 3.8 up to now. What I do not understand, though, is why the same problem happens with LuaLaTeX. –  Bernard Jul 15 '13 at 0:26
@Bernard You get other errors with LuaLaTeX and Polyglossia, I believe –  egreg Jul 15 '13 at 9:04
Yes – at least other messages. However in both cases, if I force compilation the resulting pdf is normal. –  Bernard Jul 15 '13 at 12:51