aboutsummaryrefslogtreecommitdiff
path: root/structure/book/en/00-header.tex
diff options
context:
space:
mode:
Diffstat (limited to 'structure/book/en/00-header.tex')
-rw-r--r--structure/book/en/00-header.tex25
1 files changed, 25 insertions, 0 deletions
diff --git a/structure/book/en/00-header.tex b/structure/book/en/00-header.tex
index ded10bd..64dcca6 100644
--- a/structure/book/en/00-header.tex
+++ b/structure/book/en/00-header.tex
@@ -42,6 +42,31 @@
% https://tex.stackexchange.com/questions/624033/long-sidenotes-break-marginfix-or-how-to-make-breakable-sidenotes
\usepackage{marginfix}
+% TOC customization
+% The tufte-latex package relies on titletoc for TOC formatting.
+%
+% But the spacing between the section number and the section name is too small
+% if the section name is too big.
+%
+% Example: "10.10Section name" instead of "10.10 Section name"
+%
+% Therefore we need to reset \titlecontents for section.
+%
+% The original code is full of "FIXMEs", so maybe this should be filled
+% upstream as a bug, along with a Minimum Working Example (MVE).
+%
+% See https://ctan.org/pkg/tufte-latex
+% https://github.com/Tufte-LaTeX/tufte-latex
+% https://ctan.org/pkg/titletoc
+% https://github.com/Tufte-LaTeX/tufte-latex/blob/efb8c8e836890bad71fb5834acdd316ebde6db12/tufte-common.def#L1672
+\titlecontents{section}%
+ [0em] % distance from left margin
+ {\vspace{0\baselineskip}\begin{fullwidth}\Large\rmfamily\itshape} % above (global formatting of entry)
+ {\hspace*{2em}\contentslabel{2.5em}} % before w/label (label = ``2.6'')
+ {\hspace*{2em}} % before w/o label
+ {\rmfamily\upshape\qquad\thecontentspage} % filler + page (leaders and page num)
+ [\end{fullwidth}] % after
+
% Workaround to theorems work correctly
% Maybe this is not needed anymore
% See https://stackoverflow.com/questions/46942352/r-bookdown-document-with-theorem-does-not-render-when-output-file-is-specified