2

Consider this script:

\documentclass{report}
\usepackage{subfig}
\usepackage{graphicx}
\usepackage{lipsum}
\begin{document}
\begin{figure}[htp]
  \subfloat[\lipsum[1]]{
    \includegraphics{example-image-a}
  }
\end{figure}
\end{document}

I would like to use lipsum in the caption of the subfloat. I get the following error:

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

What is wrong?

Viesturs
  • 7,895
  • 3
    Nested square brackets for optional arguments need protection to avoid confusing the parser. Try \subfloat[{\lipsum[1]}]. See https://tex.stackexchange.com/q/78414/35864, https://tex.stackexchange.com/q/304458/35864, https://tex.stackexchange.com/q/99495/35864 – moewe Jan 19 '19 at 17:04

0 Answers0