Skip to content

Possible bug when using partial TOCs #87

Description

@matteofg

See also https://tex.stackexchange.com/questions/739259/adding-vspace-into-toc-but-not-into-partial-toc

If I add vertical space in the main TOC between the chapters of the mainmatter and those of the backmatter (using \addvspace), this space appears in an unexpected way also in the partial TOC.

\documentclass{book}
\usepackage{titlesec,titletoc}
\usepackage{lipsum}

\titleformat{\chapter}[display]
  {\normalfont\centering}
  {\Large\scshape\chaptertitlename\ \thechapter}
  {0ex}
  {\LARGE\MakeUppercase}
  [\startcontents\printcontents{partial}{1}{\contentsmargin{0em}\fillast\small}]

\titlecontents*{partialsection}[0em]{\addvspace{3ex}}
  {\thecontentslabel\hspace{.7em}}{}
  {, \thecontentspage}[\hspace{1em}][.]

\titlecontents*{partialsubsection}[0em]{}
  {\thecontentslabel\hspace{.7em}}{}
  {, \thecontentspage}[\hspace{1em}(][\hspace{1em}][)]

\AddToHook{cmd/backmatter/after}{%
  \addtocontents{toc}{\protect\addvspace{3ex}}
}

\begin{document}
\tableofcontents

\chapter{First Chapter}
\section{Section of First Chapter}
\subsection{Subsection of First Chapter}
\lipsum[1]

\backmatter
\chapter{Conclusions}
\section*{Section of Conclusions}
\subsection*{Subsection of Conclusions}
\lipsum[2]

\end{document}
Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions