Here is a minimal example showing the problem.
\documentclass[10pt]{article}
\usepackage[usenames,dvipsnames]{color}
\usepackage{soul}
%\soulregister{\ref}{1}
\begin{document}
\section*{x}\label{x}
\section*{y}
\hl{ Some text.
Section~\ref{x}.
}
\end{document}
I'm getting the error
LaTeX Warning: Reference `{x}' on page 0 undefined on input line 12.
! Argument of \ref has an extra }.
The problem is with \ref. Commenting out the line beginning with "Subsection" makes the error disappear. \soulregister is intended for font commands. I don't know if \ref is a font command, but I could not get \soulregister to fix the problem (see the commented line above).
\refis not a font command then? – Faheem Mitha Jul 17 '11 at 18:48\refis not a font command. It doesn't change the font. – Martin Scharrer Jul 17 '11 at 18:50\textit{...}works becausesouldetects\textitand then handles its argument correctly. However, if you use{\itshape ...}then there is no argument which can be handled in a special way. – Martin Scharrer Jul 18 '11 at 17:05\hl{This is a citation of {\cite{ljung_system_1999}}.}raisesPackage soul Error: Reconstruction failed. ...citation of {\cite{ljung_system_1999}}.}– Bill Mar 15 '23 at 16:42