自定义LaTeX的交叉引用
ChenZhijin
.com

自定义LaTeX的交叉引用

自定义LaTeX的交叉引用

LaTeX中,我们可以通过下面的代码来给图像或式子注释:

1
2
3
4
5
6
\begin{figure}
\centering
\includegraphics[scale=0.5]{images/cat.png}
\caption[Cat]{A long name of the cat and description of the figure.}
\label{fig:cat}
\end{figure}

在交叉引用时,则可以通过

1
\ref{fig:cat}

来引用

Figure 1: Cat

这个交叉引用能满足大部分需求。但是我们想引用Figure以外类别的项目时该怎么办?

这个时候我们可以定义自己的环境。例如,我们可以给许多化合物建一个列表,然后引用化合物的名字。 我们将新环境命名为compound

1
2
3
4
\floatstyle{plain}
\newfloat{compound}{thp}{cpd}
\floatname{compound}{Compound}
\renewcommand*{\thecompound}{\textbf{\arabic{compound}}}

More content updating…

标签: