SAT-WiSe-25-26/Content/00_toc.tex

152 lines
4.5 KiB
TeX

% !TEX root = ../Main.tex
% ==============================================================================
% Table of Contents and Lists
% ==============================================================================
% Description: This file generates the table of contents and all document lists
% including figures, tables, equations, listings, and glossaries.
% The formatting uses the blenderfont style for consistency.
% Author: [Your Name]
% Date: [Date]
% ==============================================================================
% ------------------------------------------------------------------------------
% Table of Contents
% ------------------------------------------------------------------------------
% Generate the main table of contents with custom formatting
% The blenderfont provides a consistent typographic style
% ------------------------------------------------------------------------------
\newcommand{\offsetA}{\vspace{-5.5em}}
\newcommand{\offsetB}{\vspace{-1em}}
\newpage
\pagestyle{fancy}
{
% Remove title
\let\oldcontentsname\contentsname
\renewcommand{\contentsname}{}
% Formatting
\blenderfont
\chapter*{\oldcontentsname}
% Configure TOC page breaking to keep chapters with their sections
% Set penalties to keep related entries together
\begingroup
\interlinepenalty=500 % Discourage breaks within entries
\widowpenalty=10000 % Prevent orphaned lines
\clubpenalty=10000 % Prevent widowed lines
\brokenpenalty=10000 % Penalty for hyphenated breaks
\makeatletter
% Add hook to keep short chapters together on same page
\pretocmd{\l@chapter}{%
\needspace{10\baselineskip} % Ensure space for chapter + sections
\nopagebreak[4]% % Strongly discourage break after chapter
}{}{}
% Add vertical spacing before chapters in TOC
%\pretocmd{\l@chapter}{%
% \vspace{1.5em plus 0.5em minus 0.2em}% Add space before chapters
%}{}{}
% Keep sections with their chapter
\pretocmd{\l@section}{%
\nopagebreak[3]% % Discourage break before first sections
}{}{}
\makeatother
\offsetA\offsetB
\tableofcontents
\endgroup
}
% Add vertical fill to push subsequent content down
\vspace{\fill}
% ------------------------------------------------------------------------------
% Lists of Figures, Tables, Listings, and Equations
% ------------------------------------------------------------------------------
% Generate all lists on a single page with compact spacing
% The lists will only show entries if they exist
% ------------------------------------------------------------------------------
\newpage
\pagestyle{fancy}
{
% Remove titles
\let\oldlistfigurename\listfigurename
\let\oldlisttablename\listtablename
\let\oldlstlistlistingname\lstlistlistingname
\let\oldlistequationsname\listequationsname
\renewcommand{\listfigurename}{}
\renewcommand{\listtablename}{}
\renewcommand{\lstlistlistingname}{}
\renewcommand{\listequationsname}{}
% Formatting
\noindent
\blenderfont
% List of Figures
\chapter*{\oldlistfigurename}
\offsetA\offsetB
\listoffigures
% List of Tables
\vspace{1em}
\chapter*{\oldlisttablename}
\offsetA\offsetB
\listoftables
% List of Listings
% \vspace{1em}
% \chapter*{\oldlstlistlistingname}
% \offsetB
% \lstlistoflistings
% List of Equations
\vspace{1em}
\chapter*{\oldlistequationsname}
\offsetA\offsetB
\listofmyequations
}
% ------------------------------------------------------------------------------
% Glossary Section
% ------------------------------------------------------------------------------
% Generate glossary and list of abbreviations
% Two separate glossaries are printed:
% 1. Main glossary with technical terms
% 2. List of abbreviations
% ------------------------------------------------------------------------------
{
\noindent
\blenderfont
% --- Main Glossary ---
% Print main glossary with German header "Wort"
{
\renewcommand*{\entryname}{Wort}
\newpage
\pagestyle{fancy}
\vspace*{-2.25em}
\printglossary
}
% --- List of Abbreviations ---
% Print abbreviation glossary with German header "Abkürzung"
{
\renewcommand*{\entryname}{Abkürzung}
\newpage
\pagestyle{fancy}
\vspace*{-2.25em}
\printglossary[type=\acronymtype,title=Abkürzungen]
}
}
% Break pages for following chapters
\AddToHook{cmd/chapter/before}{\clearpage}
% ==============================================================================
% End of Table of Contents and Lists
% ==============================================================================