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}}

marked as duplicate by Stefan Pinnow, Mico, Maarten Dhondt, Zarko, Andrew Swann Mar 22 '17 at 7:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

12

Just put the \cite{hong_groups_2004} in an extra pair of curly brackets ({}), without them, soul will do funny things with the \cite-command:

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

You will get some ideas from section 2.1 and 2.2. in the manual. I suggest to use the more robust soulutf8 by Heiko Oberdiek to avoid possible future errors. You can then use utf8 in your file, nice if you write in 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 it does not work using curly brackets ({}), try mbox{} instead. My best tip is to look in the manual subsection 2.3.1 to see if you recognise some of the boarder line cases there.

  • 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 at 21:57

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