更改附录表格编号

更改附录表格编号

我正在使用articleatm 并尝试在文档末尾实现一个简短的附录。为了进行测试,附录应该只包含一个表格。

我使用以下代码:

\section*{Appendix}
\renewcommand{\thetable}{\Alph{section}\arabic{table}}
\setcounter{table}{0}

因此,我使用一个部分来创建附录。我想要实现的是将表标记为 A.1,将下一个标记为 A.2,依此类推。正确的做法是什么?在我的文档中,我有许多部分,因此附录中第一个表的标签是“表 G1”。应该是:“A.1”。我使用的解决方案来自这里:Latex 中的编号表 A1、A2 等 非常感谢任何提示!

答案1

这是一个 MWE,它将表格图块作为 A.number 给出。它使用caption包来添加自定义标签格式,AppendixTables如下例所示。如果您想更改所有附录表的标题,可以通过更改A.#2标签格式来完成。如果您想以这种方式包含文本,(未显示)将是表中命令#1中的文本。\caption{}

\documentclass{article}
\usepackage{caption}
\DeclareCaptionLabelFormat{AppendixTables}{A.#2}

\begin{document}
\section*{Appendix}
\captionsetup{labelformat=AppendixTables}
\setcounter{table}{0}
\begin{table}[h]
\caption{}
\center
\begin{tabular}{|c|c|}
\hline
&\\
\hline
&\\
\hline
\end{tabular}
\end{table}

\begin{table}[h]
\caption{}
\center
\begin{tabular}{|c|c|}
\hline
&\\
\hline
&\\
\hline
\end{tabular}
\end{table}
\end{document}

结果如下图所示。

在此处输入图片描述

相关内容