3

I am using a list of appendices based on this thread: Appendix in scrreprt - Separate table of appendices but mentioned in original TOC

This works perfectly fine. But I realized I don't intend to use subsections in the appendix, but only tables instead (my appendix is 99% tables). The following structure illustrates this:

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

Also my appendix tables are still in the original Table of contents atm. With the above structure, they had to be listed only in the List of Appendices, ideally listed optionally (I don't know if it looks good to list all the tables there. Maybe only the chapters would be fine too)

Finally, if I use any tables in the appendix, suddenly all of my tables' labelfonts (also in other parts of the document, simply all of them) have a dot after them, like the following example shows (see also MWE):

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

Here is the complete MWE, with the list of appendices from the above link:

\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} 

As you can see, the current numbering is wrong, and the tables are listed in the TOC instead of the list of appendices. And there is this unwanted dot after the table labelfonts.

Also if you got a better idea how to organize this, let me know. In the case of many tables, I think subsections in the appendix are a little bit too much of segmentation. But I am open to suggestions. Thanks for any help!

6

I've managed to accomplish all your requests...

The following stuff has been added to the redefinition of \appendix through \g@addto@macro:

  • It seems that in the appendices you want the table counter to be reset at every chapter, so

    \counterwithin{table}{chapter}
    
  • To remove the dot before the table caption

    \renewcommand*{\tableformat}{\tablename~\thetable}
    
  • To insert "Table #" instead of the table caption in the LoA

    \newcommand\hackedtableaddcontentsline[3]{\oldaddcontentsline{loa}{#2}{\tableformat}}
    
  • Finally, to insert all appendix tables in the LoA instead of in the LoT,

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

Complete 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} 

Output (LoT):

enter image description here

Output (LoA):

enter image description here


EDIT

If you want it to work also with longtables, also add the following lines:

\let\oldlongtable\longtable
\renewcommand*\longtable{%
\let\addcontentsline\hackedtableaddcontentsline%
\oldlongtable%
}
\let\oldendlongtable\endlongtable
\renewcommand*\endlongtable{%
\oldendlongtable%
\let\addcontentsline\oldaddcontentsline%
}
  • 1
    This took me another hour... – karlkoeller Dec 18 '13 at 17:03
  • thanks so much! I am sure many people will profit from your work :) – TomM Dec 18 '13 at 20:37
  • This works nearly perfectly. Is there any way to adjust \newcommand\hackedtableaddcontentsline[3]{\oldaddcontentsline{loa}{#2}{\tableformat}} to also include longtables besides normal tables? Atm these seem to be ignored in the list of appendices. – TomM Dec 18 '13 at 21:27
  • 1
    @TomM See the edit. – karlkoeller Dec 19 '13 at 8:43
  • 1
    @TomM Just in case you want to remove all periods after sectioning numbers, table numers, etc, load scrreprt with the additional option numbers=noendperiod. In this case the line \renewcommand*{\tableformat}{\tablename~\thetable} is superfluous. – karlkoeller Jan 8 '14 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.