I have started including appendices in my thesis to collate common information for each separate \part
section so as to make the script concise and to the point. I am using a KOMA-Script
document class: scrreprt
, using the appendix
package together with the minitoc
package for my chapter format style has been giving me a real headache, though it is solved (in my previously asked question) for the most part, the result was unsatisfactory as I cannot include a \minitoc
inside the appendix.
My solution was to go manual and simply change \chaptername
name to appendix and the and \thechapter
numbering to \Alph{chapter}
and subsequently also change the \setcounter
so as to get the chapter lettering to start where desired.
This of course meant I had to put it all back at the end of the appendix chapter so that all following chapters would continue unaffected. I was wondering whether there is a way to simply define an environment that sets these parameters (chapter > appendix, chapter numbering > letter, chapter counter) and that allows for the chapter counter to continue between the instances of each repeated environment such that when I put my first environment at the end of the first part it will be called Appendix A
and once I put the next one at the end of the second part it will automatically continue form the numbering of the previous environment resulting in Appendix B
.
If there is a relatively simple way to do this by defining an environment I would gladly implement that over the manual approach I employed in the below MWE.
\documentclass[
bibliography=totoc,
headings=big,
captions=tableheading,
chapterprefix=true% like in standard class "report"
]{scrreprt}
\usepackage[left=2cm,right=2cm,top=2.5cm,bottom=3cm]{geometry}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{minitoc}
\usepackage{setspace}
\usepackage{lmodern}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\begin{document}
\dominitoc
\tableofcontents
\addtokomafont{chapterprefix}{\raggedleft}
\addtokomafont{chapter}{\fontsize{30}{38}\selectfont}
\addtokomafont{section}{\huge}
\addtokomafont{subsection}{\Large}
\addtokomafont{subsubsection}{\large}
\renewcommand*{\chapterformat}{%
\mbox{\scalebox{1.5}{\chapappifchapterprefix{\nobreakspace}}%
\scalebox{4}{\color{gray}\thechapter}\enskip}}
\setcounter{chapter}{6}\setcounter{page}{199}
\newpage\setcounter{page}{212}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\part{Introduction}
%%%%%%%%%%%%%%%%%%%%
\chapter{Conclusions}
\dictum[Sun Tzu]{If you know the enemy and you know yourself %\\
you need not fear the results of a hundred battles.}
\minitoc
\section{Summary of Achievements}
\blindtext
\subsection{Papers Submitted}
\blindtext
\subsubsection{I want to go into the TOC}
\blindtext
%%%%%%%%%%%%%%%%%%%% APPENDIX
% Chapter style change for Appendix
\addcontentsline{toc}{part}{Experimental Appendices}
\setcounter{chapter}{0}
\renewcommand{\thechapter}{\Alph{chapter}}
\renewcommand{\chaptername}{Appendix}
\chapter{Test}
\minitoc
Here goes nothing
\section{Adding it all in}
Done
% Chapter style reset for following chapters
\setcounter{chapter}{7}
\renewcommand{\thechapter}{\arabic{chapter}}
\renewcommand{\chaptername}{Chapter}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\part{Introduction}
%%%%%%%%%%%%%%%%%%%%
\chapter{The No MiniTOC Chapter}
\dictum[Sun Tzu]{If you know the enemy and you know yourself %\\
you need not fear the results of a hundred battles.}
\minitoc
\section{Unfortunate Problems}
This chapter does not have a minitoc for some reason
\subsection{Still no minitoc}
\blindtext
\subsubsection{I want to go into the TOC}
\blindtext
%%%%%%%%%%%%%%%%%%%%
\chapter{Conclusions}
\dictum[Sun Tzu]{If you know the enemy and you know yourself %\\
you need not fear the results of a hundred battles.}
\minitoc
\section{Summary of Achievements}
\blindtext
\subsection{Papers Submitted}
\blindtext
\end{document}
Best Answer
In order to achieve the OP's request, some aspects must be considered:
Restore the chapter number of a true chapter
Restore the running appendix number
Additionally one has to keep in mind
Should it be a command such as
\appendix
If this is the case, the restore of settings is a little difficult, but can be done, see below.
partappendix
In this case, wrap the settings inside the environments starting and end code sections, best protected by\begingroup
and\endgroup
and restore only the chapter counter in the end code section of the environment.The principal steps are the same for the setup of the appendix chapter, therefore I defined the
\partappendix@@setup
command, which sets the corresponding values and does some redefinitions. This command is called in\appendix
. However, the changes must be reversed at that time when a new true chapter is opened, so I decided, that this is the case, when a new\part
starts, so I let\part
do the reversal of settings to the 'standard' values. --> Redefine\part
and its fellows.Note: There must be no true additional
\chapter
after\appendix
with this approach.The usage of
allows additional true
\chapter
commands after the environmentpartappendix
, although this is rather unlikely.Description of options and arguments to
\appendix
andpartappendix
environment\minitoc
at the start of the appendix\Appendixname~\thechapter
is used.Here are some screen shots of the TOC, chapter 8 starting page with minitoc and of Appendix B
Note Although I have intermixed
\appendix
and\begin{partappendix} ...\end{partappendix}
style as a method of demonstration, I would refrain from doing so in production code. Use the environment for 'safety'.Other note: I did not test for any eventuality so far (who can do this anyway)