0

I am writing my thesis in the French language - see below for a minimal working example - I need to have a summary which is practically a succinct table of contents containing only parts, chapters, and sections; I also need to provide an exhaustive table of contents at the end of the thesis which includes subsections.

I am using \shorttableofcontents because if I use \tableofcontents twice, one of them is rendered blank.

I would like that the \chapter{Appendices} to be only included in the second toc but no mention of it in the \shorttableofcontents, no matter what I tried, it doesn't seem to work, and I couldn't find questions with similar cases.

\documentclass[oneside, a4paper, 12pt]{book}
\usepackage{shorttoc}
\usepackage{times}
\usepackage{titlesec}
\usepackage{anyfontsize}
\usepackage[french]{babel}
\usepackage{booktabs}
\usepackage{sectsty}
\usepackage{arabtex}
\usepackage{utf8}
\usepackage{enumerate}
\setcode{utf8}

\begin{document} \shorttableofcontents{Summary}{1} \frontmatter \chapter{General Introduction}

\mainmatter \chapter{CH1} \chapter{CH2} \chapter{CH3}

\backmatter \chapter{Appendices} \setcounter{tocdepth}{3} \tableofcontents

\end{document}

David Carlisle
  • 757,742

1 Answers1

0

This solution was taken from

Remove entries from short ToC

Short TOC (parts, chapter and sections, but not appendices)

ss

Complete ToC

ll

\documentclass[oneside, a4paper, 12pt]{book}

\usepackage{shorttoc}
\usepackage{times} \usepackage{titlesec} \usepackage{anyfontsize} \usepackage[french]{babel} \usepackage{booktabs} \usepackage{sectsty} % \usepackage{arabtex} % \usepackage{utf8} \usepackage{enumerate}

% ****************************** added <<<<<<<<<<< %https://tex.stackexchange.com/a/65003/161015 \usepackage{xpatch}

\newtoggle{onlyshorttoc} \makeatletter \patchcmd{@startshorttoc}{\bgroup}{\bgroup\toggletrue{onlyshorttoc}}{}{} \makeatother % ******************************

\begin{document} \shorttableofcontents{Summary}{1} \frontmatter \chapter{General Introduction}

\mainmatter
\part{PI}
\chapter{CH1}
\section{SCH1}
\subsection{SSCH1}
\chapter{CH2}
    \section{SCH2}
\subsection{SSCH2}
    \part{PII}  
\chapter{CH3}
\section{SCH3}
\subsection{SSCH3}

\addtocontents{toc}{\protect\iftoggle{onlyshorttoc}{\setcounter{tocdepth}{-1}}{}} % added &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
\backmatter
\chapter{App First}
\chapter{App Second}

\setcounter{tocdepth}{3} % added &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
\tableofcontents

\end{document}

First adds a boolean, set as true, to the shottoc code.

Then, before the appendices, adds in the .toc file a command to set the depth of the toc = -1 (don't show chapters and lower levels) if the boolean is true.

Simon Dispa
  • 39,141