1

My latex file looks as follows: I have a main.tex that includes the packages and all ingredients of a thesis (here for minimum running example only one chapter and importantly the appendix).

% Create an appendix in LaTeX
\documentclass[bibtotoc,liststotoc,BCOR5mm,DIV12]{scrbook}
\title{Appendix Debug}

%packages
\usepackage{amsmath,amsthm,amssymb}
\usepackage{lipsum} 
\usepackage[titletoc]{appendix}
\usepackage{hyperref}               % create hyperlinks
\usepackage[<options>]{scrlayer-scrpage}                    % header and footer line

\begin{document}
\maketitle

\tableofcontents

% --------------------------------------------------------------

\mainmatter 
    \chapter{A normal chapter}

% ---------------------------------------------------------------
\backmatter 
    \input{./misc/annex}

\end{document}

Then, I have the exemplary annex.tex file given in a directory called misc given as:

\appendix
\addchap{Annex}

\begin{appendix}

\section{A section}

\begin{equation}\label{eq:sum}
    x_k = \frac{a_k+b_k}{2}
\end{equation}

\section{False Position}
\lipsum[20]

\chapter{Another Appendix}
\lipsum[24]

\end{appendix}

\endinput

I'm not sure why this is, but to my knowledge appendices are of the form 'A.1, B.1, B.2.1' and not given as this 'raw' chapter as shown in the screenshot below

Contents with incorrect Appendix ennumeration

vs I would desire it to look like this (illustrative)

desired outcome

Any help is appreciated!

4
  • 1
    I'm not quite sure what you're asking. What's happening, and what are you wanting to happen? Also, for your MWE, skip the \input and \endinput, and just paste your appendix code at that spot.
    – Teepeemm
    Jul 25, 2023 at 21:53
  • 1
    \appendix converts chapters into appendices (for document classes which support chapters). \begin{appendices} (note the spelling) is used by the appendix package to do the same thing plus add an appendix page (\part*). To make appendix sections, use the subappendices environment. Note that \begin{foo} and \end{foo} are implemented using \foo and \endfoo. Jul 26, 2023 at 2:57
  • @Teepeemm I have added screenshots, so I hope the question is now clearer.
    – Pazu
    Jul 26, 2023 at 11:09
  • 2
    You main problem is that \backmatter is changing everything. The easy solution is to not use it. Otherwise you need to find out whether this is standard or another KOMA "implrovement" and how to undo all the things it is doing. Jul 26, 2023 at 16:01

1 Answer 1

1

As John already told in a comment, you are using \backmatter before the appendix heading. From the KOMA-Script manual, documentation of \frontmatter, \mainmatter, \backmatter (currently section “3.15. Book Structure”:

In the front matter, […]chapter headings in the header are not numbered. […] The chapters in the back matter are similar to the chapters in the front matter

So chapters in the back matter are not numbered, but it seems you want numbered chapters. You also don't need package appendix to have an appendix as shown in your illustrative image. You just need KOMA-Script's \appendix, which is a command not an environment. Therefore you should remove \backmatter and use, e.g.:

% Create an appendix in LaTeX
\documentclass{scrbook}
\title{Appendix Debug}

\usepackage{lipsum} 

\begin{document}
\maketitle

\tableofcontents

\chapter{A normal chapter}
\lipsum[1]

\appendix

\chapter{First}

\lipsum[2]

\chapter{Second}
\section{A section}
\subsection{A subsection}
\subsection{Another subsection}
\subsection{Yet another subsection}

\section{Another section}

\end{document}

to get

with number end dots

If you also want to remove the dots after the numbers, you can use option numbers=noenddot:

\documentclass[numbers=noenddot]{scrbook}
\title{Appendix Debug}

\usepackage{lipsum} 

\begin{document}
\maketitle

\tableofcontents

\chapter{A normal chapter}
\lipsum[1]

\appendix

\chapter{First}

\lipsum[2]

\chapter{Second}
\section{A section}
\subsection{A subsection}
\subsection{Another subsection}
\subsection{Yet another subsection}

\section{Another section}

\end{document}

without number end dot

Using package appendix would also be possible. In this case you should use environment appendices instead of command \appendix:

\documentclass[numbers=noenddot]{scrbook}
\usepackage[titletoc]{appendix}
\title{Appendix Debug}

\usepackage{lipsum} 

\begin{document}
\maketitle

\tableofcontents

\chapter{A normal chapter}
\lipsum[1]

\begin{appendices}

\chapter{First}

\lipsum[2]

\chapter{Second}
\section{A section}
\subsection{A subsection}
\subsection{Another subsection}
\subsection{Yet another subsection}

\section{Another section}

\end{appendices}

\end{document}

using package appendix Here the appendix chapters are prefixed by Appendix in the table of contents. This is because of option titletoc (copied from your example code). If you don't want this prefix, remove the option.

Note: I've also removed \mainmatter, because without \frontmatter IMHO it would not make sense.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .