Skip to content

Commit a920676

Browse files
committed
Add diataxis sections to pdf
1 parent 890d730 commit a920676

2 files changed

Lines changed: 50 additions & 3 deletions

File tree

doc/dfetch_preamble.inc

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
\definecolor{dfetchCoverBottom}{HTML}{c2620a}
3030
\definecolor{dfetchCoverAccent}{HTML}{4e7fa0}
3131
\definecolor{dfetchCoverLight}{HTML}{fef8f0}
32+
% Diataxis section accent (mutable; updated by \dfpart* commands below)
33+
\newcommand{\dxtcolor}{dftextmuted}
34+
\newcommand{\setdxtcolor}[1]{\renewcommand{\dxtcolor}{#1}}
3235

3336
% ---- Cover page -------------------------------------------------------------
3437
\usepackage{tikz}
@@ -43,12 +46,12 @@
4346
\MakeUppercase{\chaptertitlename}~\thechapter}
4447
{4pt}
4548
{\color{dfnearblack}\fontsize{22}{26}\selectfont\bfseries}
46-
[\vspace{6pt}{\color{dfprimary}\rule{\linewidth}{1.5pt}}]
49+
[\vspace{6pt}{\color{\dxtcolor}\rule{\linewidth}{1.5pt}}]
4750
\titlespacing*{\chapter}{0pt}{-6pt}{18pt}
48-
% Section: amber number pip + near-black title text
51+
% Section: section-accent number pip + near-black title text
4952
\titleformat{\section}
5053
{\normalfont\sffamily\Large\bfseries\color{dfnearblack}}
51-
{\textcolor{dfprimary}{\thesection}}
54+
{\textcolor{\dxtcolor}{\thesection}}
5255
{0.75em}{}
5356
% Subsection: muted number + near-black title text
5457
\titleformat{\subsection}
@@ -59,6 +62,20 @@
5962
{\normalfont\sffamily\normalsize\bfseries\color{dfnearblack}}
6063
{\textcolor{dftextmuted}{\thesubsubsection}}
6164
{0.75em}{}
65+
% Part: large right-aligned number + coloured title + coloured rule
66+
\titleformat{\part}[display]
67+
{\normalfont\sffamily}
68+
{\color{\dxtcolor}\fontsize{72}{72}\selectfont\bfseries\hfill\thepart}
69+
{-4pt}
70+
{\color{\dxtcolor}\fontsize{28}{34}\selectfont\bfseries}
71+
[\vspace{10pt}{\color{\dxtcolor}\rule{\linewidth}{2pt}}]
72+
\titlespacing*{\part}{0pt}{60pt}{80pt}
73+
% Named Diataxis part commands — set the section accent then open the part
74+
\newcommand{\dfpartTutorials}{\setdxtcolor{dfprimary}\part{Tutorials}}
75+
\newcommand{\dfpartHowto}{\setdxtcolor{dfaccent}\part{How-to Guides}}
76+
\newcommand{\dfpartReference}{\setdxtcolor{dfsage}\part{Reference}}
77+
\newcommand{\dfpartExplanation}{\setdxtcolor{dfpurple}\part{Explanation}}
78+
\newcommand{\dfpartAppendix}{\setdxtcolor{dftextmuted}\part{Appendix}}
6279

6380
% ---- Tables: match website style -------------------------------------------
6481
% Rules: thin border colour, no vertical separators (horizontal-only, like site).

doc/index.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,25 @@ upstream. See :ref:`vendoring` for background on the problem this solves.
3737

3838
.. asciinema:: asciicasts/basic.cast
3939

40+
.. only:: latex
41+
42+
.. raw:: latex
43+
44+
\dfpartTutorials
45+
4046
.. toctree::
4147
:maxdepth: 2
4248
:caption: Tutorials
4349

4450
tutorials/installation
4551
tutorials/getting_started
4652

53+
.. only:: latex
54+
55+
.. raw:: latex
56+
57+
\dfpartHowto
58+
4759
.. toctree::
4860
:maxdepth: 2
4961
:caption: How-to Guides
@@ -58,6 +70,12 @@ upstream. See :ref:`vendoring` for background on the problem this solves.
5870
howto/troubleshooting
5971
howto/contributing
6072

73+
.. only:: latex
74+
75+
.. raw:: latex
76+
77+
\dfpartReference
78+
6179
.. toctree::
6280
:maxdepth: 2
6381
:caption: Reference
@@ -69,6 +87,12 @@ upstream. See :ref:`vendoring` for background on the problem this solves.
6987
reference/changelog
7088
reference/legal
7189

90+
.. only:: latex
91+
92+
.. raw:: latex
93+
94+
\dfpartExplanation
95+
7296
.. toctree::
7397
:maxdepth: 2
7498
:caption: Explanation
@@ -77,6 +101,12 @@ upstream. See :ref:`vendoring` for background on the problem this solves.
77101
explanation/alternatives
78102
explanation/architecture
79103

104+
.. only:: latex
105+
106+
.. raw:: latex
107+
108+
\dfpartAppendix
109+
80110
.. toctree::
81111
:maxdepth: 2
82112
:caption: Appendix

0 commit comments

Comments
 (0)