キャプションとしてのlipsum

キャプションとしてのlipsum

以下はコンパイルに失敗します:

\documentclass{article}
\usepackage{lipsum}

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

次のエラーが発生します:

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

この問題は、これ(そしてこれ) ですが、ここではネストされた角括弧はありません。

何が間違っているのでしょうか?

答え1

これを試してみてください。

\documentclass{article}
\usepackage{lipsum}

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

関連情報