aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2024-09-16 22:05:40 -0300
committerSilvio Rhatto <rhatto@riseup.net>2024-09-16 22:05:40 -0300
commit6ead6169d2461ebfcf948da4af12e015b69350ac (patch)
tree71c8bdf4591195533b007fef23dbc93bf37bbb86
parent58dc341405aa9f0ce68b15ce3ce53927ed1f256e (diff)
downloadbookup-0.2.1.tar.gz
bookup-0.2.1.tar.bz2
Fix: TOC spacing0.2.1
-rw-r--r--ChangeLog.md5
-rw-r--r--structure/book/en/00-header.tex25
-rw-r--r--structure/book/pt-br/00-header.tex25
3 files changed, 55 insertions, 0 deletions
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