1

Problem description:

Recently I moved to the KOMA-Script class

scrreport

to get rid of the

Chapter 1...

extra in the Titles.

This however also changed my appendix to the Format

A. Titlename

Ideally I would like it to look like this:

Appendix A. Titlename

all in one line, or at least get the Chapter format from the report class.

I tried the appendix package like this:

\usepackage[titletoc,title]{appendix}

but this does not seem to work for the scrreport class.

So far I was only able to add an extra page with the word Appendix (in my language Anhang) like this:

\usepackage[toc,page]{appendix}

While the appendix layout looks like this:

%Anhang/appendix
\renewcommand\appendixtocname{Anhang}
\renewcommand\appendixpagename{Anhang}

\begin{appendices}

    %remove entries from the list of figures
    \addtocontents{toc}{\protect\setcounter{tocdepth}{0}}

    \input{Anhang}

    %set it back to 1 otherwise the toc will be missing entries
    \addtocontents{toc}{\protect\setcounter{tocdepth}{1}}

\end{appendices}

Question:

So how can I get the missing word "Appendix" before the ".A" back while staying with the scrreport class ?

Additional Information:

It should also be noted that I do not want the listoffigures to contain anything but the word

Appendix

(in my language Anhang) as you can see when you look at the latex code below.

Minimal working example:

\documentclass[a4paper,12pt,oneside,openany]{scrreprt}

\linespread{1.5}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage[titletoc,title]{appendix}


\begin{document}

%Anhang /appendix
\renewcommand\appendixtocname{Anhang}
\renewcommand\appendixpagename{Anhang}
\begin{appendices}
    \addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
    \chapter{Some apendix heading}
    %set it back to 1 otherwise the toc will be missing entries
    \addtocontents{toc}{\protect\setcounter{tocdepth}{1}}   
\end{appendices}


\end{document}

This will produce (instead of Appendix A):

enter image description here

4
  • Does appendixprefix=true (as a documentclass option) produce the desired results?
    – gusbrs
    Commented Mar 8, 2018 at 13:10
  • sadly no, do I have to change something else as well to use this option properly ? Commented Mar 8, 2018 at 13:17
  • Also if you use \appendix instead of the appendices environment? However, it is somewhat hard to assist you, because the code you provided above we cannot compile, for we miss the inputed files, your bib entries and so on. If this does not work, please take a look on how to build a proper minimal working example (MWE) that illustrates your problem.
    – gusbrs
    Commented Mar 8, 2018 at 13:26
  • yes I tried \appendix but it did not work either, you are right, I will try to create a MWE Commented Mar 8, 2018 at 13:29

2 Answers 2

4

You need the documentclass option appendixprefix. This alone will not work, because in scrreprt, you have to mark your appendix with \appendix. So in your MWE this would be

\documentclass[a4paper,12pt,oneside,openany,appendixprefix]{scrreprt}

\linespread{1.5}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage[titletoc,title]{appendix}


\begin{document}

\appendix
\renewcommand\appendixtocname{Anhang}
\renewcommand\appendixpagename{Anhang}
\begin{appendices}
    \addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
    \chapter{Some apendix heading}
    %set it back to 1 otherwise the toc will be missing entries
    \addtocontents{toc}{\protect\setcounter{tocdepth}{1}}   
\end{appendices}

\end{document}

This prints Appendix A on a separate line. To get "Appendix A. Titlename" in one line, you can modify \thechapter instead: (You should still use \appendix)

\documentclass[a4paper,12pt,oneside,openany]{scrreprt}

\linespread{1.5}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage[titletoc,title]{appendix}
\begin{document}

\appendix
\renewcommand\appendixtocname{Anhang}
\renewcommand\appendixpagename{Anhang}
\begin{appendices}
    \renewcommand\thechapter{\appendixname\space\Alph{chapter}}
    \addtocontents{toc}{\protect\setcounter{tocdepth}{0}}
    \chapter{Some apendix heading}
    %set it back to 1 otherwise the toc will be missing entries
    \addtocontents{toc}{\protect\setcounter{tocdepth}{1}}   
\end{appendices}

\end{document}

This results in The resulting title

2
  • My old example was designed to use a phantom page for the entry "Anhang" in the table of content, so could you either set {tocdepth}{-1} to 0 or add a note for others who might read this ? Commented Mar 8, 2018 at 14:24
  • just realized that you also answered the question on how to put it in one line, thanks again Commented Mar 8, 2018 at 14:25
5

Too long for a comment.

I'm not sure what is going wrong with your full document. Your example is still very far from "minimal". Take a look at the following simple document and see if it helps you figure out what's wrong with your own document:

\documentclass[appendixprefix=true]{scrreprt}

\usepackage[ngerman]{babel}

\usepackage[toc,page]{appendix}

\begin{document}

\chapter{A regular chapter}

\appendix
\chapter{Some apendix heading}

\end{document}

It produces the following result:

enter image description here

2
  • If I may guess on what might be going wrong, I'd bet on the following passage of the appendix package documentation: "Depending on the particular package options that are set and the document class, the appendices environment may change the definition of elements of the sectioning commands (e.g., \chapter or \section). This may be a problem if the environment is used in conjunction with any other package that makes changes to these commands."
    – gusbrs
    Commented Mar 8, 2018 at 14:14
  • I tested this, the problem was that I had to use \appendix together with the option appendixprefix in the documentclass options. I did try each of them before but never together. Commented Mar 8, 2018 at 14:20

You must log in to answer this question.

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