[Tex/LaTex] Displaying “Appendix” in a section inside subappendices environment

appendicesclassicthesiskoma-scriptsectioningtable of contents

I am using scrreprt from KOMA packages, the appendix package, and the arsclassica package.

I'd like to add "Appendix" before the number of an appendix to a chapter.

If I use scrreprt and the appendix package this can be done. Unfortunately, arsclassica package redefines the \section command in some way that the appendix package cannot add "Appendix" to the title. This also cannot be changed with the appendixprefix option of KOMA script.

I found something that almost works (full code at the end):

\begin{subappendices}

\begingroup
\def\thesection{Appendix \arabic{chapter}.\Alph{section}}

\section{Appendix one}

\section{Appendix two}
\endgroup

\end{subappendices}

The only problem is that this way an "Appendix" is added to the name at the ToC, which then is not properly aligned (it runs over the title of the appendix).

My question is then: is there a way to turn off the behavior only for the ToC, while keeping the extra "Appendix" display inside the subappendices environment?

Here is the full code that has an issue of not displaying "Appendix" in the title of the section:

\documentclass[11pt,letterpaper,twoside=false,openright,titlepage,fleqn,%
           headinclude=false,footinclude=false,BCOR=12.7mm,DIV=9,%
           numbers=noenddot,cleardoublepage=empty,%
           listof=totoc,%
           captions=tableheading]{scrreprt}

\usepackage{makeidx}
\usepackage[title,titletoc]{appendix}

\usepackage[eulerchapternumbers,beramono,listings,%
                eulermath,pdfspacing]{classicthesis}

\usepackage{arsclassica}

\begin{document}

\tableofcontents

\chapter{Bla}

\begin{subappendices}
\section{Foo}
\end{subappendices}

\end{document}

Best Answer

arsclassica uses \titleformat from the titlesec package to format sectional units; you can then redefine the section format inside the subappendices environment (making the change local) imitating the original definition, but including the appendix name:

\documentclass[11pt,letterpaper,twoside=false,openright,titlepage,fleqn,%
           headinclude=false,footinclude=false,BCOR=12.7mm,DIV=9,%
           numbers=noenddot,cleardoublepage=empty,%
           listof=totoc,%
           captions=tableheading]{scrreprt}

\usepackage{makeidx}

\usepackage[eulerchapternumbers,beramono,listings,%
                eulermath,pdfspacing]{classicthesis}

\usepackage{arsclassica}
\usepackage[title]{appendix}

\begin{document}

\tableofcontents

\chapter{Bla}

\begin{subappendices}
\titleformat{\section} 
  {\normalfont\Large\sffamily}{\spacedlowsmallcaps\appendixname\ %
  {\spacedlowsmallcaps\thesection}}%
  {1em}{\spacedlowsmallcaps}


\section{Foo}
\end{subappendices}

\end{document}

enter image description here