在LaTeX中为方程式添加标题
时间:2020-03-06 14:53:00 来源:igfitidea点击:
好吧,这似乎很简单,但是我找不到一种为公式添加标题的方法。
需要标题来解释方程式中使用的变量,因此要使它们保持一致和美观的某种类似于表格的结构会很棒。
解决方案
我们可能要看一下http://tug.ctan.org/tex-archive/macros/latex/contrib/float/,它可以使我们使用\ newfloat定义新的float。
我之所以这样说,是因为标题通常应用于浮点数。
直截了当的方程式(那些用$ ... $,$$ ... $$,begin {equation} ...编写)是不支持\ caption的内联对象。
可以在\ begin {document}`之前使用以下代码段来完成此操作
\usepackage{float}
\usepackage{aliascnt}
\newaliascnt{eqfloat}{equation}
\newfloat{eqfloat}{h}{eqflts}
\floatname{eqfloat}{Equation}
\newcommand*{\ORGeqfloat}{}
\let\ORGeqfloat\eqfloat
\def\eqfloat{%
\let\ORIGINALcaption\caption
\def\caption{%
\addtocounter{equation}{-1}%
\ORIGINALcaption
}%
\ORGeqfloat
}
当添加方程式时,使用类似
\begin{eqfloat}
\begin{equation}
f( x ) = ax + b
\label{eq:linear}
\end{equation}
\caption{Caption goes here}
\end{eqfloat}
\ caption`命令仅限于浮点数:我们需要将方程式放置在图形或者表格环境(或者新型的浮点环境)中。例如:
\begin{figure}
\[ e = m c^2 \]
\caption{A famous equation}
\end{figure}
浮点数是让LaTeX确定其位置。如果要使方程式显示在固定位置,请不要使用浮点数。字幕包的\ captionof命令可用于将字幕放置在浮动环境之外。它的用法是这样的:
\[ e = m c^2 \]
\captionof{figure}{A famous equation}
如果文档有一个,也会为\ listoffigures生成一个条目。
要对齐方程的各个部分,请查看" eqnarray"环境或者amsmath程序包的某些环境:align,gather,multiline,...

