3

The following is my MWE, inspired from the answer to this question (where my query seemed to merit a separate question, so here it is!):

\documentclass{article}
\usepackage{caption}
\usepackage{amsmath}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows,shapes,calc,intersections,through,backgrounds}

\begin{document}
\begin{figure}[b]
   \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]           
       % More stuff here - not relevant I think...

  \end{tikzpicture}
   \caption{\label{q}\leavevmode\\\begin{minipage}{\linewidth}
         \begin{align*}
            a &= b \\ c &= d
         \end{align*}
      \end{minipage}
   }
\end{figure}
\end{document}

With the above, I'm getting the following error:

! Argument of \@caption has an extra }.
<inserted text>
                \par
l.19    }

I'm not sure how to debug this!

  • It's called \leavevmode, and the second \begin{align*} probably should be an \end{align*} and you need amsmath and don’t forget to include a short version of that (or do you want the equations in the List of Figures?): \caption[A formula]{…}. – Qrrbrbirlbel Aug 24 '13 at 0:57
5

You don't need \leavevmode or the minipage

\documentclass{article}
\usepackage[singlelinecheck=false]{caption}
\usepackage{amsmath}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows,shapes,calc,intersections,through,backgrounds}

\begin{document}
\begin{figure}[b]
   \begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1cm,y=1cm]           
       % More stuff here - not relevant I think...

  \end{tikzpicture}
   \caption[something]{\label{q}
         \begin{align*}
            a &= b \\ c &= d
        \end{align*}}
\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.