我正在创建一个包含多个章节的文档,每个章节都有一组附录,以及一个包含表格和图片列表的目录。章节部分和附录中的表格编号不一致,我想为附录表格添加一个前缀,该前缀显示在表格列表中。例如:
\documentclass[11pt,openright,oneside,letterpaper,onecolumn]{report}
\usepackage[toc,page]{appendix}
\begin{document}
\setcounter{tocdepth}{2}
\renewcommand{\contentsname}{Table of Contents}
\tableofcontents
\cleardoublepage
\listoffigures
\cleardoublepage
\listoftables
\cleardoublepage
\clearpage
\chapter{Section 1}
\begin{table}
\begin{tabular}{|c|c|}
\hline 1 & 2 \\
\end{tabular}
\caption{Tab 1}
\label{Label of table}
\end{table}
\begin{appendices}
\renewcommand{\thesection}{1.\arabic{section}}
\clearpage
\section{Appendix 1}
\begin{table}
\begin{tabular}{|c|c|}
\hline 1 & 2 \\
\end{tabular}
\caption{Tab 2}
\label{Label of table}
\end{table}
\section{Appendix 2}
\begin{table}
\begin{tabular}{|c|c|}
\hline 1 & 2 \\
\end{tabular}
\caption{Tab 2}
\label{Label of table}
\end{table}
\end{appendices}
\chapter{Section 2}
\begin{table}
\begin{tabular}{|c|c|}
\hline 1 & 2 \\
\end{tabular}
\caption{Tab 1}
\label{Label of table}
\end{table}
\begin{appendices}
\renewcommand{\thesection}{1.\arabic{section}}
\clearpage
\section{Appendix 1}
\begin{table}
\begin{tabular}{|c|c|}
\hline 1 & 2 \\
\end{tabular}
\caption{Tab 2}
\label{Label of table}
\end{table}
\end{appendices}
\end{document}
在此代码中,前三个表的列表为 1.1、2、3,而第二组表的列表为 2.1、2。我想在附录表的前三个表列表中添加前缀“1.”并在第二个表列表中添加前缀“2.”,这样字符串就是 1.1、1.2、1.3、2.1、2.2。您知道如何做吗?
答案1
你是这个意思吗?
\documentclass[11pt,openright,oneside,letterpaper,onecolumn]{report}
\usepackage[toc,page]{appendix}
\begin{document}
\setcounter{tocdepth}{2}
\renewcommand{\contentsname}{Table of Contents}
\tableofcontents
\cleardoublepage
\listoffigures
\cleardoublepage
\listoftables
\cleardoublepage
\clearpage
\chapter{Section 1}
\begin{table}
\begin{tabular}{|c|c|}
\hline 1 & 2 \\
\end{tabular}
\caption{Tab 1}
\label{Labeloftable}
\end{table}
\begin{subappendices}
\section{Appendix 1}
\begin{table}
\begin{tabular}{|c|c|}
\hline 1 & 2 \\
\end{tabular}
\caption{Tab 2}
\label{Labeloftable2}
\end{table}
\section{Appendix 2}
\begin{table}
\begin{tabular}{|c|c|}
\hline 1 & 2 \\
\end{tabular}
\caption{Tab 2}
\label{Labeloftable3}
\end{table}
\end{subappendices}
\chapter{Section 2}
\begin{table}
\begin{tabular}{|c|c|}
\hline 1 & 2 \\
\end{tabular}
\caption{Tab 1}
\label{Labeloftable4}
\end{table}
\begin{subappendices}
\section{Appendix 1}
\begin{table}
\begin{tabular}{|c|c|}
\hline 1 & 2 \\
\end{tabular}
\caption{Tab 2}
\label{Labeloftable5}
\end{table}
\end{subappendices}
\end{document}