7

I'm trying to use uwave and cleveref together:

\documentclass{article}
\usepackage{ulem}
\usepackage{cleveref}
\begin{document}
\uwave{\cref{sec:A}}
\section{A}
\label{sec:A}
\end{document}

After calling pdflatex twice, I get following output:

! Extra }, or forgotten \endgroup. \UL@stop ...z@ \else \UL@putbox \fi \else \egroup \egroup \UL@putbox \fi \if... l.5 \uwave{\cref{sec:A}}

?

What am I doing wrong or whom should I ask for a fix?

Similar effect with soulpos and cleveref:

\documentclass{article}
\usepackage{xcolor}
\usepackage{soul}
\usepackage{cleveref}
\begin{document}
\hl{\cref{sec:A}}
\section{A}
\label{sec:A}
\end{document}

! Argument of \cref has an extra }. \par l.6 \hl{\cref{sec:A}}

?

2
  • Off-topic comment: Is it really necessary to use \uwave for references?
    – user31729
    Commented Oct 3, 2015 at 15:30
  • It is a MCVE showing as little commands and text as possible. The use case is to track changes in a document. Instead of using the changes package, I use \uwave and \pdfcomment to highlight changes and to explain them.
    – koppor
    Commented Oct 3, 2015 at 18:20

1 Answer 1

10

In these cases, add \mbox around the offending piece; it works also with soul.

\documentclass{article}
\usepackage{ulem}
\usepackage{cleveref}

\begin{document}

\uwave{\mbox{\cref{sec:A}}}

\section{A}
\label{sec:A}

\end{document}

enter image description here

1
  • 2
    For the record: The box keeps the text together. I've defined a command \citet mirroring natbis's command: \newcommand{\citet}[1]{\citeauthor{#1} \cite{#1}}. Putting an mbox around \citet might cause strange layouts. But it's good enough for me...
    – koppor
    Commented Oct 3, 2015 at 18:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .