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?

Roly
  • 4,221
  • 4
  • 26
  • 56
  • 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 09 '19 at 13:01
  • Use \LipsumPar: `\documentclass{article} \usepackage{lipsum}

    \begin{document} \begin{figure} \caption{\LipsumPar{1}} \end{figure} \end{document}`.

    –  Dec 09 '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 09 '19 at 13:06
  • 1
    I always use \blindtext (blindtext package) in caption. – John Kormylo Dec 09 '19 at 13:28

1 Answers1

2

Try with this one.

\documentclass{article}
\usepackage{lipsum}

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