[Tex/LaTex] Missing “Appendix” in appendix title when using KOMA-Script class (scrreport)

appendiceskoma-script

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

Best Answer

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