创建附录列表、格式化附录并添加到目录

创建附录列表、格式化附录并添加到目录

请帮忙!我想知道如何防止附录章节中定义的表格与其他章节中的其他表格一起列出。我希望为普通章节中的表格(连续编号)和附录章节中的表格(我重新开始编号表格)创建单独的列表 - 比如附录列表。MWE 文件如下:

  1. 主文件:
\documentclass{report}
\usepackage{array}
\usepackage{chngcntr}   %package to change counter
\counterwithout{table}{chapter}     %number tables continously-not chapterwise
\usepackage[format=hang]{caption} %package to change caption tag from "Table" to Appendix
\usepackage{tocloft}    %table settings
%list of table settings
\setlength{\cftchapnumwidth}{0pt}
\renewcommand{\cftchappresnum}{\chaptername\ }
\renewcommand{\cftchapaftersnum}{:}
\renewcommand{\cftchapaftersnumb}{\newline}
\renewcommand{\cftchapdotsep}{\cftdotsep}
\begin{document}
\setlength{\cftbeforetoctitleskip}{-2em}-
\renewcommand{\contentsname}{{\normalsize TABLE OF CONTENTS }}
\begin{center}
\tableofcontents
\end{center}  % Write out the Table of Contents
\renewcommand{\listtablename}{{\normalsize LIST OF TABLES}}
\clearpage %Start a new page
\setlength{\cftbeforelottitleskip}{-2em}
\begin{center}
\renewcommand*{\addvspace}[1]{}
\listoftables%
\addcontentsline{toc}{chapter}{List of Tables}
\end{center}  % Write out the List of Tables
\include{chapterOne}
\include{chapterTwo}
\include{appendixChapter}
\end{document}
  1. 第一章:
\chapter{}
\begin{table}[!htbp]
\caption{First Table}
\centering
\begin{tabular}{c c c}
\hline
Value 1 & Value 2 & Value 3 \\
\hline
A & 1.8 & 3.4 \\
B & 6 & 4 \\
C & 0.1 & 0.25\\
\hline
\end{tabular}
\label{table:one}
\end{table}
  1. 第二章
\chapter{}
\begin{table}[!htbp]
\caption{Second Table}
\centering
\begin{tabular}{c c c}
\hline
Value 1 & Value 2 & Value 3 \\
\hline
A & 10 & 30 \\
B & 6 & 4 \\
C & 2 & 6\\
\hline
\label{table:two}
\end{table}
  1. 附录章节:
\chapter*{APPENDICES}
\setcounter{table}{0} \renewcommand{\thetable}{\arabic{table}}  %reset table 
\begin{table}[!htbp]
\captionsetup{name=Appendix}
\caption{Table Appendix}
\centering  
\begin{tabular}{c c c}
\hline
Value 1 & Value 2 & Value 3 \\
\hline
F & 1 & 3 \\
G & 6 & 4 \\
H & 2 & 6\\
\hline
\end{tabular}
\label{table:appendx}
\end{table}

MWE 输出: 附录中的表格出现在表格列表中

答案1

也许下面的例子能有所帮助:

\documentclass{report}
%\usepackage{chngcntr}% not needed with uptodate TeX Distributions
\counterwithout{table}{chapter}%number tables continously-not chapterwise

\usepackage[english]{babel}
\addto\captionsenglish{\renewcommand*\contentsname{Table of Contents}}

\usepackage{tocloft}
\setlength{\cftchapnumwidth}{0pt}
\renewcommand{\cftchappresnum}{\chaptername\ }
\renewcommand{\cftchapaftersnum}{:}
\renewcommand{\cftchapaftersnumb}{\newline}
\renewcommand{\cftchapdotsep}{\cftdotsep}

% settings for ToC
\setlength{\cftbeforetoctitleskip}{-2em}
\renewcommand{\cfttoctitlefont}{\hfill\normalsize\MakeUppercase}
\renewcommand{\cftaftertoctitle}{\hfill\mbox{}}

% settings for LoT
\setlength{\cftbeforelottitleskip}{-2em}
\renewcommand{\cftlottitlefont}{\hfill\normalsize\MakeUppercase}
\renewcommand{\cftafterlottitle}{%
  \addcontentsline{toc}{chapter}{\listtablename}%
  \hfill\mbox{}%
}
\addtocontents{lot}{\protect\renewcommand*{\protect\addvspace}[1]{}}

% new list for Tables in Appendix
\newcommand*{\listappendixtablename}{List of Tables in Appendix}
\newlistof{appendixtable}{alot}{\listappendixtablename}
% settings for LoTiA
\setlength{\cftbeforealottitleskip}{-2em}
\renewcommand{\cftalottitlefont}{\hfill\normalsize\MakeUppercase}
\renewcommand{\cftafteralottitle}{\hfill\mbox{}}

\usepackage{xpatch}
\makeatletter
\xapptocmd\appendix{%
  \chapter*{APPENDICES}%
  \markboth{}{}%
  \setcounter{table}{0}% reset table counter
  \renewcommand*{\ext@table}{alot}% write table entries in the alot file
  \listofappendixtable
}{}{\PatchFailed}
\makeatother

\begin{document}
\tableofcontents
\clearpage
\listoftables

\chapter{Bla}
\begin{table}[!htbp]
\caption{First Table}
\centering
\begin{tabular}{c c c}
\hline
Value 1 & Value 2 & Value 3 \\
\hline
A & 1.8 & 3.4 \\
B & 6 & 4 \\
C & 0.1 & 0.25\\
\hline
\end{tabular}
\label{table:one}
\end{table}

\chapter{Blubb}
\begin{table}[!htbp]
\caption{Second Table}
\centering
\begin{tabular}{c c c}
\hline
Value 1 & Value 2 & Value 3 \\
\hline
A & 10 & 30 \\
B & 6 & 4 \\
C & 2 & 6\\
\hline
\end{tabular}
\label{table:two}
\end{table}

\appendix
\begin{table}[!htbp]
\caption{Table Appendix}
\centering
\begin{tabular}{c c c}
\hline
Value 1 & Value 2 & Value 3 \\
\hline
F & 1 & 3 \\
G & 6 & 4 \\
H & 2 & 6\\
\hline
\end{tabular}
\label{table:appendx}
\end{table}
\end{document}

结果:

在此处输入图片描述

在此处输入图片描述

相关内容