表格编号和列表在附录表中而不是目录中

表格编号和列表在附录表中而不是目录中

我正在使用基于此线程的附录列表: scrreprt 中的附录 - 单独的附录表格,但在原始目录中提及

这完全没问题。但我意识到我不打算在附录中使用小节,而只使用表格(我的附录 99% 都是表格)。以下结构说明了这一点:

A. 1st appendix chapter
Table A.1
Table A.2 etc. 
B. 2nd appendix chapter
Table B.1
Table B.2 etc.

此外,我的附录表格目前仍在原始目录中。按照上述结构,它们只能列在附录列表中,最好是可选的(我不知道将所有表格列在那里是否好看。也许只列出章节也可以)

最后,如果我使用附录中的任何表格,突然间我所有表格的标签字体(也包括文档的其他部分,只是全部)后面都有一个点,如下例所示(另请参阅 MWE):

 **Table 1.**
 The Table shows the following...

这是完整的 MWE,其中包含来自上述链接的附录列表:

\documentclass[a4paper, 12pt, headsepline, smallheadings, listof=totoc]{scrreprt}
\usepackage{booktabs}
\usepackage[labelfont={normalsize,bf}, textfont=small,    labelsep=newline,singlelinecheck=false,format=plain,indention=2cm]{caption}
\KOMAoption{captions}{tableheading}
\setcapindent{0em}
\usepackage{chngcntr}
\counterwithout{table}{chapter}


\newcommand\appendicesname{Appendices}
\newcommand\listofloaname{List of \appendicesname}
\newcommand*{\listofappendices}{\listoftoc{loa}}
\setuptoc{loa}{totoc}

\makeatletter
\g@addto@macro\appendix{%
\let\oldaddcontentsline\addcontentsline
\newcommand\hackedaddcontentsline[3]{\oldaddcontentsline{loa}{#2}{#3}}
\let\oldpart\part
\renewcommand*\part[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldpart{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldchapter\chapter
\renewcommand*\chapter[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldchapter{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldsection\section
\renewcommand*\section[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldsection{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldsubsection\subsection
\renewcommand*\subsection[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldsubsection{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldsubsubsection\subsubsection
\renewcommand*\subsubsection[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldsubsubsection{#1}%
\let\addcontentsline\oldaddcontentsline%
}
}
\makeatother

\begin{document}

\listoftables
\tableofcontents

\chapter{1st chapter}

\begin{table}[h]
\centering
\caption[Table caption (1)]{The Table shows the following...} 
{\normalsize
\begin{tabular}{lccccc}
\toprule
A & B & C & D & E \\
\midrule  
1 & 2 & 3 & 4 & 5 \\
\bottomrule
\end{tabular}
}
\end{table}
\chapter{2nd chapter}


\listofappendices
\appendix

\chapter{1st appendix chapter}

\begin{table}[h]
\centering
\caption[Table caption (2)]{The Table shows the following...} 
{\normalsize
\begin{tabular}{lccccc}
\toprule
A & B & C & D & E \\
\midrule  
1 & 2 & 3 & 4 & 5 \\
\bottomrule
\end{tabular}
}
\end{table}

\chapter{2nd appendix chapter}

\begin{table}[h]
\centering
\caption[Table caption (3)]{The Table shows the following...} 
{\normalsize
\begin{tabular}{lccccc}
\toprule
A & B & C & D & E \\
\midrule  
1 & 2 & 3 & 4 & 5 \\
\bottomrule
\end{tabular}
}
\end{table}

\end{document} 

如您所见,当前编号是错误的,表格列在目录中,而不是附录列表中。表格标签字体后面有一个不需要的点。

另外,如果您有更好的想法如何组织这些内容,请告诉我。在表格较多的情况下,我认为附录中的子部分有点过于细分。但我愿意听取建议。感谢您的帮助!

答案1

我已设法满足了你的所有要求……

下列内容已添加到\appendixthrough的重新定义中\g@addto@macro

  • 在附录中,你似乎希望table计数器在每一章都重置,所以

    \counterwithin{table}{chapter}
    
  • 删除表格标题前的点

    \renewcommand*{\tableformat}{\tablename~\thetable}
    
  • 在 LoA 中插入“表格编号”代替表格标题

    \newcommand\hackedtableaddcontentsline[3]{\oldaddcontentsline{loa}{#2}{\tableformat}}
    
  • 最后,将所有附录表插入 LoA 中而不是 LoT 中,

    \let\oldtable\table
    \renewcommand*\table{%
    \let\addcontentsline\hackedtableaddcontentsline%
    \oldtable%
    }
    \let\oldendtable\endtable
    \renewcommand*\endtable{%
    \oldendtable%
    \let\addcontentsline\oldaddcontentsline%
    }
    

完成 MWE:

\documentclass[a4paper, 12pt, headsepline, smallheadings, listof=totoc]{scrreprt}
\usepackage{booktabs}
\usepackage[labelfont={normalsize,bf},textfont=small,labelsep=newline,singlelinecheck=false,format=plain,indention=2cm]{caption}
\KOMAoption{captions}{tableheading}
\setcapindent{0em}
\usepackage{chngcntr}
\counterwithout{table}{chapter}


\newcommand\appendicesname{Appendices}
\newcommand\listofloaname{List of \appendicesname}
\newcommand*{\listofappendices}{\listoftoc{loa}}
\setuptoc{loa}{totoc}

\makeatletter
\g@addto@macro\appendix{%
\counterwithin{table}{chapter}
\renewcommand*{\tableformat}{\tablename~\thetable}
\let\oldaddcontentsline\addcontentsline
\newcommand\hackedaddcontentsline[3]{\oldaddcontentsline{loa}{#2}{#3}}
\newcommand\hackedtableaddcontentsline[3]{\oldaddcontentsline{loa}{#2}{\tableformat}}
\let\oldpart\part
\renewcommand*\part[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldpart{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldchapter\chapter
\renewcommand*\chapter[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldchapter{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldsection\section
\renewcommand*\section[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldsection{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldsubsection\subsection
\renewcommand*\subsection[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldsubsection{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldsubsubsection\subsubsection
\renewcommand*\subsubsection[1]{%
\let\addcontentsline\hackedaddcontentsline%
\oldsubsubsection{#1}%
\let\addcontentsline\oldaddcontentsline%
}
\let\oldtable\table
\renewcommand*\table{%
\let\addcontentsline\hackedtableaddcontentsline%
\oldtable%
}
\let\oldendtable\endtable
\renewcommand*\endtable{%
\oldendtable%
\let\addcontentsline\oldaddcontentsline%
}
}
\makeatother

\begin{document}

\listoftables
\tableofcontents

\chapter{1st chapter}

\begin{table}[h]
\centering
\caption[Table caption (1)]{The Table shows the following...}
{\normalsize
\begin{tabular}{lccccc}
\toprule
A & B & C & D & E \\
\midrule
1 & 2 & 3 & 4 & 5 \\
\bottomrule
\end{tabular}
}
\end{table}
\chapter{2nd chapter}


\listofappendices
\appendix

\chapter{1st appendix chapter}

\begin{table}[h]
\centering
\caption[Table caption (2)]{The Table shows the following...}
{\normalsize
\begin{tabular}{lccccc}
\toprule
A & B & C & D & E \\
\midrule
1 & 2 & 3 & 4 & 5 \\
\bottomrule
\end{tabular}
}
\end{table}

\chapter{2nd appendix chapter}

\begin{table}[h]
\centering
\caption[Table caption (3)]{The Table shows the following...}
{\normalsize
\begin{tabular}{lccccc}
\toprule
A & B & C & D & E \\
\midrule
1 & 2 & 3 & 4 & 5 \\
\bottomrule
\end{tabular}
}
\end{table}

\end{document} 

输出(LoT):

在此处输入图片描述

输出(LoA):

在此处输入图片描述


编辑

如果您希望它也与 s 一起工作longtable,还请添加以下几行:

\let\oldlongtable\longtable
\renewcommand*\longtable{%
\let\addcontentsline\hackedtableaddcontentsline%
\oldlongtable%
}
\let\oldendlongtable\endlongtable
\renewcommand*\endlongtable{%
\oldendlongtable%
\let\addcontentsline\oldaddcontentsline%
}

相关内容