以下是我的 MWE,灵感来自这个问题(我的疑问似乎值得一个单独的问题,所以就在这里!):
\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}
通过上述操作,我收到以下错误:
! Argument of \@caption has an extra }.
<inserted text>
\par
l.19 }
我不知道如何调试这个!
答案1
你不需要\leavevmode
或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}