# KOMA-Script scrreprt: How to change chapter appearance and produce a chapter based Mini TOC

This post is a 3 part question with which I would need help. The questions are all associated with chapter styling and subsections within the \documentclass{scrreprt}. I am sure I could work them out eventually, I come to you for guidance to learn and save a bit of time.

# Intro

I am a fledgling LaTeXer, I have already used LaTeX to produce simple reports for which I wasn't too fussed about the formatting. Now I am writing a PhD thesis and I would like it to look the way I choose.

# Desired Result

The result I would like to achieve for my chapters is roughly as shown in the below image. The essential elements I would like to implement in my document are:

• Chapter first page look as below with Chapter Title not having a number
• Possibility of adding a quote before the Chapter Title. (probably not hard)
• Mini ToC for each chapter
• More than the \subsection level of sectioning that will be included in the ToC.

# Question 1: Subsections

I have been reading around on the site and saw that there were solutions suggested to this matter with the scrreprt class such as in the post scrreprt - add levels below \subparagraph; I have read that the titlesec package is very customisable, however I have also read it would disable/interfere with some of the KOMA-script macros (I don't know exactly which). What would be best to implement in my case to achieve my desired look?

# Question 2: Setting up the chapter look and style

Based on the answer to question 1, could you help explain how I would set it up please?

# Question 3: Mini ToC and quote

Could you please advise how you would go about adding a quote between the Chapter No. and Title (I might not for every chapter). I imagine that to make a mini chapter confined ToC would simply require a package, or maybe there is already a functionality in scrreprt?

# MWE Update 10/02/2014

Sorry again for not having this sooner, here is my MWE of the thesis setup. I included the title page I use and the Dedication and Abstract sections which are fine the way they are for now.

I have implemented what @Crissov suggested but unfortunately I cannot get the minitoc to generate or the chapter format to match the one presented in his MWE which does work until implemented in my case. Due to his code working alone, but not once I implemented it into mine, I included what I realise is a bit of a bulky MWE, but the mistake I am making must be somewhere in there.

\documentclass[
DIV=11,
twoside,
titlepage=firstiscover,
abstract=true,
footsepline=true,
]{scrreprt}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=3cm]{geometry} %typearea has that nasty problem of double bottom margin so had to remove it
\usepackage{setspace}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{minitoc}

\flushbottom

\iffalse % don’t use titlesec.sty with KOMA script classes
\usepackage{titlesec}
%% ￼￼￼\titleformat{⟨command⟩}[⟨shape⟩]{⟨format⟩}{⟨label⟩}{⟨sep⟩}{⟨before⟩}[⟨after⟩]
\titleformat{name=\chapter}[display]
{\usekomafont{chapter}}
{\raggedleft\chaptertitlename\ {\textcolor{gray}{\fontsize{60}    {65}\selectfont\thechapter}}}
{20pt}{}[\minitoc]
\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ToC DEPTH LEVEL
\setcounter{secnumdepth}{3} % number subsubsection
\setcounter{tocdepth}{3} % list subsubsection

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PREFACE AND BODY STYLING
\def\preface{
\pagenumbering{roman}
\doublespacing
}

\def\body{
\cleardoublepage
\dominitoc
\tableofcontents
\linespread{1.5} %Clear double spacing from preface
\pagenumbering{arabic}
}

\def\abstract{
\begin{center}{
\large\bf Abstract}
\end{center}
\normalsize
}{\cleardoublepage}
\def\endabstract{
\par
}

\newenvironment{acknowledgements}{
\cleardoublepage
\begin{center}{
\large \bf Acknowledgements}
\end{center}
\normalsize
}{\cleardoublepage}
\def\endacknowledgements{
\par
}

\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% TITLE PAGE
\Large \centering University of London \\
}
\subject{Department of Materials \\
}
\title{My PhD Thesis Title}
\author{Edoardo}
\date{
\vskip 1cm
\normalsize Submitted \\
\Large 2014 \\
\vskip 2cm
\normalsize Supervisors: \\
\Large Jim Bob \\
John Doe \\
\vskip 2cm
\normalsize Submitted in part fulfilment of the requirements for the degree of \\
Doctor of Philosophy in Materials
}

\dedication{Dedication here}
\maketitle

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PREFACE
\preface
\begin{abstract}

In this study we did a lot of things

\end{abstract}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ToC ToF ToT
\body
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CHAPTERS
\chapter{Introduction}

\dictum[Sun Tzu]{If you know the enemy and you know yourself %\\
you need not fear the results of a hundred battles.}

\minitoc % should be put here automatically

\section{Test of depth}

We are delving deeper into the unknown.

\subsection{Publications}

Many publications here.

\subsubsection{Text Mass}
Here goes lots and lots of text, here goes lots and lots of text, here goes lots and lots of text, here goes lots and lots of text, here goes lots and lots of text, here goes lots and lots of text, here goes lots and lots of text, here goes lots and lots of text, here goes lots and lots of text, here goes lots and lots of text

\end{document}


I have however found out that there is a way to put a quote (if desired) just after the chapter using the {after} part of the command line for \titleformat as follows:

\titleformat{name=\chapter}[display]
{\usekomafont{chapter}}
{\raggedleft\chaptertitlename\ {\textcolor{gray}{\fontsize{60}{65}\selectfont\thechapter}}}
{20pt}{\dictum[Sun Tzu]{If you know the enemy and you know yourself %\\
you need not fear the results of a hundred battles.}}


All I'd need to workout is how to link that specific \dictum section for each chapter to a part I can write just after \chapter{chapter} I suppose...

-
Welcome to TeX.sx! Regarding the quotes see tex.stackexchange.com/questions/53377/… –  cgnieder Feb 9 at 17:21
Please provide a MWE to show your effort.. –  subham soni Feb 9 at 17:21
–  Marco Daniel Feb 9 at 17:38
@Fiztban You should generally ask separate questions in separate question postings. Here, questions 1 & 2 belong together in my opinion, and so could be asked together. Question 3 is probably asked in KOMA-Script (scrbook): onecolumn table of contents & minitoc in twocolumn document and scrwfile removes partial Toc created with titletoc. If not, make an edit and refer to them, what does not fit. –  Speravir Feb 9 at 21:39

Partial answer, because I was lately trying something similar. Updated with @speravir’s suggestions and two ugly solutions of putting \dictum between prefixed chapter number and chapter title.

\documentclass[
chapterprefix=true%% like in standard class "report"
]{scrreprt}
%\usepackage[T1]{fontenc}%% pdflatex
\usepackage{fontspec}%% xelatex
\usepackage{xcolor}
\usepackage{graphicx}

%% partial TOCs after chapter title
\usepackage[]{minitoc}
\setcounter{secnumdepth}{3} % number subsubsections
\setcounter{tocdepth}{3} % list subsubsections
\mtcsetdepth{minitoc}{2}% ~ \setcounter{minitocdepth}{2}
\mtcsetfont{minitoc}{*}{\usekomafont{chapterentry}}
\mtcsetfont{minitoc}{section}{\usekomafont{chapterentry}\bfseries}
\mtcsetfont{minitoc}{subsection}{\usekomafont{chapterentry}}
\mtcsettitle{minitoc}{\relax}% remove “Contents”
\mtcsetoffset{minitoc}{-3.5em}% don’t know the appropriate length
\mtcsetrules{minitoc}{off}
\mtcsetpagenumbers{minitoc}{on}% default anyway
%\mtcsetfeature{minitoc}{before|after|open|close|pagestyle}{command}

%% layout of chapter title by @Speravir
\renewcommand*{\chapterformat}{%
\mbox{\chapappifchapterprefix{\nobreakspace}%
\scalebox{5}{\color{gray}\thechapter\autodot}\enskip}%
}

%% put dictum between chapter number (with prefix) and title
%% \setdictum[⟨source⟩]{⟨quote⟩} -- before \chapter
\iftrue % change to \iffalse to test different approach
%% hacky approach
\newcommand\getdictum{\relax}
\usepackage{etoolbox}
\makeatletter
%% \patchcmd{⟨command⟩}{⟨search⟩}{⟨replace⟩}{⟨success⟩}{⟨failure⟩}
\makeatother
\else
%
\newcommand\setdictum[2][]{%
\setchapterpreamble[ol][0.5\textwidth]{\vskip 5em\dictum[#1]{#2}}%
}
\fi

\begin{document}
\dominitoc
\faketableofcontents

\setcounter{chapter}{6}\setcounter{page}{199}

\setdictum[Sun Tzu]{If you know the enemy and you know yourself %\\
you need not fear the results of a hundred battles.}
\chapter{Conclusions}

\minitoc

\section{Summary of Achievements}
Text goes here
\newpage\setcounter{page}{212}
\subsection{Papers Submitted}
\subsubsection{I want to go into the TOC}
\end{document}

-
@Crissov Oh my that is a brilliant start! I will try and integrate this into my MWE. Much appreciated! –  Fiztban Feb 10 at 15:06
@Crissov I have added an MWE to my original post, I didn't have much luck achieving the desired effect when I implemented your code, would you be able to have a look through what I have done and see if you can spot the mistake I must have done. Thank you –  Fiztban Feb 10 at 15:56
A remark as comment, that you’ve used \setcounters just for the example, would be better in my eyes. For an experienced user this is obvious, but … –  Speravir Feb 10 at 22:16
@Speravir Thank you for the concern, but that I worked out quickest out of all the commands :D. Right now I am trying to assess whether the titlesec package helps or rather disrupts the KOMA-script macros fiven this post –  Fiztban Feb 10 at 22:56
@Fiztban: You, Crissov and me are not the only ones who can read this. :-) For titlesec: You must find out by trial & error, which functions work and which don’t. And it can happen, that functions working now will not in a future KOMA-Script release (recently happened, as can re read in one of the questions linked in comments below your question). –  Speravir Feb 10 at 23:29

I used his MWE and redefined (below \addtokomafont{chapterprefix} – it’s generally useful to keep definitions for the same topic as far as possible together) the command \chapterformat (the original definition is shown in documentation). I added a color change definition and a \scalebox from graphicx:

\renewcommand*{\chapterformat}{%
\mbox{\chapappifchapterprefix{\nobreakspace}%
\scalebox{3}{\color{gray}\thechapter\autodot}\enskip}}


I also loaded fontenc just to get rid of a font warning. All together:

\documentclass[
chapterprefix=true% like in standard class "report"
]{scrreprt}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{minitoc}
\setcounter{secnumdepth}{3} % number subsubsections
\setcounter{tocdepth}{3} % list subsubsections

\renewcommand*{\chapterformat}{%
\mbox{\chapappifchapterprefix{\nobreakspace}%
\scalebox{3}{\color{gray}\thechapter\autodot}\enskip}}

\begin{document}
\dominitoc
\tableofcontents

\setcounter{chapter}{6}\setcounter{page}{199}

\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}
Text goes here
\newpage\setcounter{page}{212}
\subsection{Papers Submitted}
\subsubsection{I want to go into the TOC}
\end{document}


The output looks this way:

-
You're a wizard! I will begin learning this, was reading your minitoc reply here, but I will wrap my head around this one for the time being. Thank you for all your help thus far! –  Fiztban Feb 10 at 23:29
@Fiztban: You’re welcome. Please accept nethertheless Crissov’s answer. –  Speravir Feb 10 at 23:38
Oh yes of course I will do that. Sorry to bother you again, would you please post the entire code, I can't quite make out where you added the renewcommand. –  Fiztban Feb 10 at 23:41
Oh how silly of me, forgot to load the graphicx package thank you so so much, now all that is left is getting it to work with my code for the minitoc. Speravir I wish you many good things! Thank you –  Fiztban Feb 11 at 0:00
@Speravir, why should Fiztban accept my partial answer (which is hardly the MWE he should have provided), when yours is so much closer to the desired result? –  Crissov Feb 11 at 10:02