I am trying to add a TOC in the first page for each chapter, using the answer of this question: How to obtain this fancy chapter page with the book class
There are two problems: First why the word chapter.10
appears? and Second I want the TOC to display only sections without subsections.
Edit:
I am using the MastersDoctoralThesis
class, which can be found in this link: http://www.latextemplates.com/templates/theses/1/thesis_1.zip
My MWE:
\documentclass[
14pt, % The default document font size, options: 10pt, 11pt, 12pt
oneside, % Two side (alternating margins) for binding by default, uncomment to switch to one side
english, % ngerman for German
]{MastersDoctoralThesis} % The class file specifying the document structure
% My Dissertation Rules for Line spacing + paragraph spacing + identation
\linespread{1.4}
\setlength{\parskip}{0.5cm}
\setlength{\parindent}{1.5cm}
\usepackage{mathptmx}
% Float to use H in placing figures and tables
\usepackage{float}
%write algorithms
\usepackage{algorithm}
\usepackage{algpseudocode}
\usepackage{pifont}
\algnewcommand\algorithmicinput{\textbf{Input:}}
\algnewcommand\INPUT{\item[\algorithmicinput]}
\algnewcommand\algorithmicoutput{\textbf{Output:}}
\algnewcommand\OUTPUT{\item[\algorithmicinput]}
% Adding sub TOC
\usepackage[explicit]{titlesec}
\usepackage{titletoc}
\usepackage{tikz}
\usepackage{epigraph}
\usepackage{xpatch}
\usepackage{lmodern}
\newlength\ChapWd
\settowidth\ChapWd{\huge\chaptertitlename}
\definecolor{myblue}{RGB}{0,0,122}
\titleformat{\chapter}[display]
{\normalfont\filcenter\sffamily}
{\tikz[remember picture,overlay]
{
\node[fill=myblue,font=\fontsize{60}{72}\selectfont\color{white},anchor=north east,minimum size=\ChapWd]
at ([xshift=-15pt,yshift=-15pt]current page.north east)
(numb) {\thechapter};
\node[rotate=90,anchor=south,inner sep=0pt,font=\huge] at (numb.west) {\chaptertitlename};
}
}{0pt}{\fontsize{33}{40}\selectfont\color{myblue}#1}[\vskip10pt\Large***]
\titlespacing*{\chapter}
{0pt}{50pt}{10pt}
\makeatletter
\xpatchcmd{\ttl@printlist}{\endgroup}{{\noindent\color{myblue}\rule{\textwidth}{1.5pt}}\vskip30pt\endgroup}{}{}
\makeatother
\newcommand\DoPToC{%
\setcounter{tocdepth}{1}
\startcontents[chapters]
\printcontents[chapters]{}{1}{\noindent{\color{myblue}\rule{\textwidth}{1.5pt}}\par\medskip}%
}
% End of TOC
% Drop Cap
\usepackage{lettrine}
\usepackage[utf8]{inputenc} % Required for inputting international characters
\usepackage[T1]{fontenc} % Output font encoding for international characters
\usepackage{palatino} % Use the Palatino font by default
\thesistitle{Thesis Title} % Your thesis title, this is used in the title and abstract, print it elsewhere with \ttitle
\degree{Doctor of Philosophy} % Your degree name, this is used in the title page and abstract, print it elsewhere with \degreename
\author{John \textsc{Smith}} % Your name, this is used in the title page and abstract, print it elsewhere with \authorname
\university{\href{http://www.university.com}{University Name}} % Your university's name and URL, this is used in the title page and abstract, print it elsewhere with \univname
\department{\href{http://department.university.com}{Department or School Name}} % Your department's name and URL, this is used in the title page and abstract, print it elsewhere with \deptname
\faculty{\href{http://faculty.university.com}{Faculty Name}} % Your faculty's name and URL, this is used in the title page and abstract, print it elsewhere with \facname
\begin{document}
\frontmatter % Use roman page numbering style (i, ii, iii, iv...) for the pre-content pages
\pagenumbering{Roman}
\pagestyle{plain} % Default to the plain heading style until the thesis style is called for the body content
\addtocontents{ptc}{\protect\setcounter{tocdepth}{1}}
\begin{abstract}
%\addchaptertocentry{\abstractname} % Add the abstract to the table of
\end{abstract}
\begin{acknowledgements}
%\addchaptertocentry{\acknowledgementname} % Add the acknowledgements to the table of contents
The acknowledgements and the people to thank go here, don't forget to include your project advisor\ldots
\end{acknowledgements}
\tableofcontents % Prints the main table of contents
\listoffigures % Prints the list of figures
\listoftables % Prints the list of tables
\begin{abbreviations}{ll}
\textbf{LAH} & \textbf{L}ist \textbf{A}bbreviations \textbf{H}ere\\
\textbf{WSF} & \textbf{W}hat (it) \textbf{S}tands \textbf{F}or\\
\end{abbreviations}
\dedicatory{For/Dedicated to/To my\ldots}
\mainmatter % Begin numeric (1,2,3...) page numbering
\pagestyle{thesis} % Return the page headers back to the "thesis" style
\input{Chapters/Chapter1}
\end{document}
\documentclass{...}
and ending with\end{document}
. – DG' Oct 28 '15 at 9:50