Содержание с заголовком обрезано после первой страницы

Содержание с заголовком обрезано после первой страницы

После того, как я вставил titletoc и изменил оглавление, оглавление заканчивается после заполнения первой страницы. До того, как я добавил эти настройки, оно автоматически начинало новую страницу.

Вот как выглядит мое оглавление: введите описание изображения здесь Как вы видите, таблица обрезана на этапе 8.3 и не продолжается на следующей странице.

Вот мой код:

\documentclass[fontsize=9pt, BCOR=5mm, ngerman, paper=a4]{scrreprt}
%+------------------------------------------------------------------------------+
%| packages einbinden                                                             |
%+------------------------------------------------------------------------------+

\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes} 
\usepackage{fontspec}
\usepackage{hyperref}
\usepackage{framed}
\usepackage[dvipsnames]{xcolor}
\usepackage{graphicx}
\usepackage{titletoc}
\usepackage{scrpage2}
\usepackage{lastpage}
\usepackage{geometry}
\usepackage{float}
\usepackage{tocloft}
\usepackage{csquotes}
%+------------------------------------------------------------------------------+
%| settings                                                               |
%+------------------------------------------------------------------------------+

% —– titletoc - format ToC —– %
\titlecontents{chapter}[1.5em]{\addvspace{1pc}\bfseries}{\contentslabel{1.5em}}
{\hspace*{-1.5em}}{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{section}[3.7em]{}{\contentslabel{2.2em}}{}
{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{subsection}[6.7em]{}{\contentslabel{2.95em}}{}
{\titlerule*[0.3pc]{.}\contentspage}

\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}
% —– End: format ToC —– %

%+------------------------------------------------------------------------------+
%| document                                                    |
%+------------------------------------------------------------------------------+
\begin{document}
\tableofcontents

 \chapter{ 1 }
   Some example Text
  \section{1.1}
  \section{1.2}
  \section{1.3}
  \section{1.4}

 \chapter{ 2 }
  \section{2.1}
  \section{2.2}
  \section{2.3}
  \section{2.4}
  \section{2.5}

 \chapter{ 3 }
   ...
\end{document}

Думаю, мне не хватает некоторых параметров форматирования заголовка, но я не знаю, как это исправить.

решение1

Если вы хотите использовать пакет titletocдля форматирования оглавления, то удалите пакет tocloft:

\documentclass[fontsize=9pt, BCOR=5mm, ngerman, paper=a4,DIV=calc]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes} 
\usepackage{fontspec}
\usepackage{hyperref}
\usepackage{framed}
\usepackage[dvipsnames]{xcolor}
\usepackage{graphicx}
\usepackage{titletoc}
\usepackage{scrlayer-scrpage}% replaces the outdated scrpage2
\usepackage{lastpage}
\usepackage{geometry}
\usepackage{float}
\usepackage{scrhack}% if package float is really needed, load scrhack too
\usepackage{csquotes}

% —– titletoc - format ToC —– %
\titlecontents{chapter}[1.5em]{\addvspace{1pc}\bfseries}{\contentslabel{1.5em}}
{\hspace*{-1.5em}}{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{section}[3.7em]{}{\contentslabel{2.2em}}{}
{\titlerule*[0.3pc]{.}\contentspage}
\titlecontents{subsection}[6.7em]{}{\contentslabel{2.95em}}{}
{\titlerule*[0.3pc]{.}\contentspage}

\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}

\begin{document}
\tableofcontents
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\end{document}

введите описание изображения здесь

Обратите внимание, что класс KOMA-Script scrreprtзагружает пакет tocbasicавтоматически. Так что, возможно, лучше удалить titletocего и использовать что-то вроде

\documentclass[fontsize=9pt, BCOR=5mm, ngerman, paper=a4,DIV=calc]{scrreprt}
\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes} 
\usepackage{fontspec}
\usepackage{hyperref}
\usepackage{framed}
\usepackage[dvipsnames]{xcolor}
\usepackage{graphicx}
\usepackage{scrlayer-scrpage}% replaces the outdated scrpage2
\usepackage{lastpage}
\usepackage{geometry}
\usepackage{float}
\usepackage{scrhack}% if package float is really needed, load scrhack too
\usepackage{csquotes}

\RedeclareSectionCommand[
  toclinefill=\TOCLineLeaderFill,
  tocbeforeskip=1pc
]{chapter}
\RedeclareSectionCommand[
  tocnumwidth=2.2em
]{section}
\RedeclareSectionCommand[
  tocindent=3.75em,
  tocnumwidth=2.95em
]{subsection}

\makeatletter
\show\@dotsep
\renewcommand\@dotsep{1}
\makeatother

\setcounter{tocdepth}{3}
\setcounter{secnumdepth}{3}

\begin{document}
\tableofcontents
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\chapter{A Chapter}
\section{A Section}\section{A Section}\section{A Section}\section{A Section}
\section{A Section}\section{A Section}\section{A Section}
\end{document}

Связанный контент