0

The following fails to compile:

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\begin{figure}
\caption{\lipsum[1]}
\end{figure}
\end{document}

giving the following error:

! Argument of \@caption has an extra }.
<inserted text> 
                \par 
l.11 \caption{\lipsum[1]}

I assume the problem is related to this (and this), but here I don't have nested square brackets.

What am I doing wrong?

4
  • 2
    No issues with this MWE on up to date TeXLive 2019. BTW you can always use \lipsum*[1], it will not emit a \par at the end.
    – daleif
    Dec 9 '19 at 13:01
  • Use \LipsumPar: \documentclass{article} \usepackage{lipsum} \begin{document} \begin{figure} \caption{\LipsumPar{1}} \end{figure} \end{document}.
    – user194703
    Dec 9 '19 at 13:04
  • Thanks both. On my installation (TeXLive 2018) \lipsum*[1] gives the same error, and LipsumPar gives Undefined control sequence.
    – Roly
    Dec 9 '19 at 13:06
  • 1
    I always use \blindtext (blindtext package) in caption. Dec 9 '19 at 13:28
2

Try with this one.

\documentclass{article}
\usepackage{lipsum}

\begin{document}
\begin{figure}
\caption{\protect\lipsum[1]}
\end{figure}
\end{document}

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.