0

I'm trying to dashed underline a word in a caption using the ulem package. While the \dashuline{} command works fine everywhere else, I get "Undefined control sequence" as error message in caption.

\begin{figure}
    While it does work \dashuline{here}
    \caption{It does not work \dashuline{here}}
\end{figure}

Has anyone an idea why it doesn't work and how to get it working?

  • This does work correctly with ulem (and it should have been the case already back then given the last update of the package), ie \dashuline is already robust! – Frank Mittelbach Jun 20 '18 at 20:42
4

Protecting the command should solve the problem:

\documentclass{article}

\usepackage{ulem}

\begin{document}

\begin{figure}
    While it does work \dashuline{here}
    \caption{It does not work \protect\dashuline{here}}
\end{figure}

\end{document}

enter image description here

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.