0

MWE:

\documentclass[a4paper,11pt]{article}
\usepackage{color}
\usepackage{soul}

\begin{document}
\label{lbl}

 See here: \ref{lbl} % This does work
\hl{See here: \ref{lbl}} % This does not work

\end{document}

Here is the error message:

! Argument of \ref has an extra }.
<inserted text> 
                \par 
l.14     \hl{See here: \ref{lbl}}
                                  % This does not work
? 
nagylzs
  • 1,225
  • 5
    Use additional braces around the \ref, see https://tex.stackexchange.com/questions/23307/problems-with-ref-when-using-soul-for-highlighting – Ulrike Fischer Nov 16 '16 at 08:42
  • It seems that it is also impossible to use strikeout (\sout) with \hl. "Reconstruction failed". Adding extra braces does not help either. :-( – nagylzs Nov 16 '16 at 11:13
  • See the documentation "Nested soul commands". – Ulrike Fischer Nov 16 '16 at 11:16
  • "§ 22 Nested soul commands:§ 22 Nested soul commands:". Great, so it is documented. But why is this behaviour? Is it a bad idea to overstike a highlighted text? Or is it just a deficiency (or bad design?) of the soul package? – nagylzs Nov 16 '16 at 12:03
  • soul allows line breaks. To be able to do this it has to split the input in syllables, which is rather difficult, so you have to avoid complicated/fragile commands in the input. – Ulrike Fischer Nov 16 '16 at 12:07
  • From an end user's view, using strikeout + highlight is NOT complicated. At least it should not be. What does "fragile command" mean? If \hl is fragile, then it is because it was implemented that way in the soul package, right? I'm not saying that this is an easy problem to solve. I'm just saying that I ALWAYS run into things like this with Latex. It seems that almost all enviroments are deeply context sensitive, and full of exceptions and unjustified rules - once again, from the point of the end user. – nagylzs Nov 16 '16 at 12:42

0 Answers0