From 6ead6169d2461ebfcf948da4af12e015b69350ac Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 16 Sep 2024 22:05:40 -0300 Subject: Fix: TOC spacing --- ChangeLog.md | 5 +++++ structure/book/en/00-header.tex | 25 +++++++++++++++++++++++++ structure/book/pt-br/00-header.tex | 25 +++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index cf8e043..35eab02 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,5 +1,10 @@ # ChangeLog +## v0.2.1 - 2024-09-16 + +* [x] Fix TOC spacing between section numbers and section titles when there are + many sections making the section number too big. + ## v0.2.0 - 2024-08-16 * [x] Provision: ensure a recent ggplot2 is used. 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 diff --git a/structure/book/pt-br/00-header.tex b/structure/book/pt-br/00-header.tex index ded10bd..64dcca6 100644 --- a/structure/book/pt-br/00-header.tex +++ b/structure/book/pt-br/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 -- cgit v1.2.3