8

The following MWE gives me an error. This should work, shouldn't it?

\documentclass{article}
\usepackage{color,soul}
\begin{document}
\hl{A statement \cite{hong_groups_2004}}
\end{document}

Here's the error:

! Argument of \@citex has an extra }.
<inserted text> 
                \par 
l.4 \hl{A statement \cite{hong_groups_2004}}
14

Try enclose \cite{hong_groups_2004} in an extra pair of curly brackets ({}), without those, soul may do funny things with the \cite-command:

\documentclass{article}
\usepackage{color,soul}
\begin{document}
\hl{A statement {\cite{hong_groups_2004}}}
\end{document}

Section 2.1 and 2.2. in the manual describes some problems and possible solution. In addition, I suggest that you use the more robust soulutf8 by Heiko Oberdiek to avoid possible future errors. With soulutf8, it is possible to use utf8, which is a must if you use other languages than US English.

New MWE:

\documentclass[UKenglish]{article}
\usepackage[utf8]{inputenx}
\usepackage[T1]{fontenc}
\usepackage{babel}
\usepackage{color,soulutf8}

\begin{document}
\hl{A statement {\cite{hong_groups_2004}}}

Normal text.

\hl{Highlighted text with æøåÆØÅ}

\end{document}

Edit: If the additional pair curly brackets ({}) does not solve the error, try enclose the command in and mbox{} instead, i.e. mbox{\cite{hong_groups_2004}}.

My best tip is to read the manual subsection 2.3.1 to see if you recognise some of the boarder line cases described there. This may give you some hint regarding possible solutions.

| improve this answer | |
  • 3
    This solution gets rid of the citex error, but creates a new one: ! Package soul Error: Reconstruction failed. – elplatt May 23 '16 at 18:44
  • @elplatt I found putting \protect before the citations is a decent solution. – kevinkayaks Oct 20 '19 at 21:57

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