[英]Adding an equation or formula to a figure caption in LaTeX
我在LaTeX中有一个带有标题的图形,我需要添加一个公式( equation*
或displaymath
环境)。 例如:
\documentclass[12pt]{article}
\begin{document}
\begin{figure}[tbph]
\begin{center}
%...
\end{center}
\caption{As you can see
\begin{displaymath}4 \ne 5\end{displaymath}
}
\label{fig:somefig}
\end{figure}
\end{document}
这使得pdflatex生气,虽然它会产生PDF。
! Argument of \@caption has an extra }.
<inserted text>
\par
l.9 }
将方程式添加到数字标题的正确方法是什么?
注意 :请不要建议只使用$ ... $
数学环境; 显示的等式是玩具示例; 我真实的等式更复杂。
另见 :
使用包“标题”:
\begin{figure}
\begin{center}
...
\captionsetup{singlelinecheck=off}
\caption[.]{
\begin{displaymath}
assoc\_meaning(\lambda x_{SBJ}. followed(x,y) \&actor(x) \nonumber \&actor(y),\lambda x_{SBJ}. maintained(x,\nonumber <(dist\_from(y),1))
\end{displaymath}}
\end{center}
\end{figure}
\\caption
后面的方括号不是可选的,但是将它们关闭不会导致看起来与添加\\usepackage{caption}
和\\captionsetup{...}
之前的错误不同。
我不确定你为什么不想使用$ ... $
解决方案,因为分数?
如果是这样,您可以使用\\dfrac
而不是\\frac
。
我会尝试$ \\displaystyle \\dfrac{1}{2} \\cdot \\sum_{i=0}^ni$
,即使用\\displaystyle
命令。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.