Latex标签
在 LaTeX 中,标签(label
)用于为文档中的元素(如表格、图像、公式等)生成唯一标识符,以便在文档的其他地方引用它们。通过 label
和 ref
(或 autoref
)等命令,用户可以在文档中精确地引用各种元素,确保引用的一致性和准确性。下面是 LaTeX 中常用标签的介绍。
1. 表格标签 (table
)
-
表格标题:通过
\caption
为表格添加标题,并使用\label
为表格分配一个唯一标识符。\begin{table}[ht] \centering \caption{This is a table.} \label{tab:example} \begin{tabular}{|c|c|} \hline A & B \\ \hline \end{tabular} \end{table}
-
引用表格:通过
\ref{}
或\autoref{}
引用表格。Table \ref{tab:example} shows the results.
2. 图像标签 (figure
)
-
图像标题:使用
\caption
为图像添加标题,并通过\label
为图像设置标签。\begin{figure}[ht] \centering \includegraphics[width=0.5\textwidth]{image.png} \caption{This is a figure.} \label{fig:example} \end{figure}
-
引用图像:通过
\ref{}<