0

When I use \cite[something with spaces]{ref} inside \sout{...} I get errors. For the article document class it helps to replace spaces by ~. That doesn't help, however, for the elsarticle document class. See minimal working example below:

\documentclass{elsarticle}
% \documentclass{article}
\usepackage{ulem}

\begin{document}

text
\cite{lamport}
\cite[p.10]{lamport}
\cite[p. 10]{lamport}
\cite[p.~10]{lamport}
\sout{text}
\sout{\cite{lamport}}
\sout{\cite[p.10]{lamport}}
% \sout{\cite[p. 10]{lamport}} % Fails with elsarticle and article
% \sout{\cite[p.~10]{lamport}} % Fails with elsarticle only

\begin{thebibliography}{9}

\bibitem{lamport}
  Leslie Lamport,
  \textit{\LaTeX: a document preparation system},
  Addison Wesley, Massachusetts,
  2nd edition,
  1994.

\end{thebibliography}

\end{document}

For article I get

! Argument of \UL@word has an extra }.

whereas for elsarticle I get

! Extra }, or forgotten \endgroup.
\UL@stop ...z@ \else \UL@putbox \fi \else \egroup 
                                                  \egroup \UL@putbox \fi \if...

Is this an error in ulem? I would be grateful if anyone knows a quick-fix.

Kind regards.

1

Simply put curly brackets around p. 10:

\documentclass{elsarticle}
% \documentclass{article}
\usepackage{ulem}

\begin{document}


\sout{\cite[{p. 10}]{lamport}}

\begin{thebibliography}{9}

\bibitem{lamport}
  Leslie Lamport,
  \textit{\LaTeX: a document preparation system},
  Addison Wesley, Massachusetts,
  2nd edition,
  1994.

\end{thebibliography}

\end{document}
  • Nice! Though I actually wanted the non-break space there, and {p.~10} still gives error on elsarticle. – sigvaldm Apr 25 at 9:26
0

Although I tried looking for the answer before posting, I only found it afterwards. See ulem incompatibility with multiple entries in \cite. I would prefer that ulem just didn't have this problem, but a quick-fix seems to be putting \cite in an \mbox:

\sout{\mbox{\cite[p. 10]{lamport}}} % Fails with elsarticle and article
\sout{\mbox{\cite[p.~10]{lamport}}} % Fails with elsarticle only

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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