Mercurial > hgrepos > Python > libs > ConfigMix
comparison docs/_latex/my-doc-style.sty @ 786:5f0ee44825b1
Update to my-doc-style.sty v0.3.1.
Fixes ToC entry handling of sections with suppressed numbers.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 17 May 2026 13:08:45 +0200 |
| parents | 42f7caa89253 |
| children |
comparison
equal
deleted
inserted
replaced
| 785:42f7caa89253 | 786:5f0ee44825b1 |
|---|---|
| 2 % | 2 % |
| 3 % Some font hacks for my Sphinx PDF documents | 3 % Some font hacks for my Sphinx PDF documents |
| 4 % | 4 % |
| 5 \NeedsTeXFormat{LaTeX2e} | 5 \NeedsTeXFormat{LaTeX2e} |
| 6 \ProvidesPackage{my-doc-style}[% | 6 \ProvidesPackage{my-doc-style}[% |
| 7 2026/05/17 v0.3 (Franz Glasner) Some style customizations (title et al.)] | 7 2026/05/17 v0.3.1 (Franz Glasner) Some style customizations (title et al.)] |
| 8 \RequirePackage{xkeyval} | 8 \RequirePackage{xkeyval} |
| 9 | 9 |
| 10 % A key compatible with options processing but bool (because DeclareBoolOptionX) | 10 % A key compatible with options processing but bool (because DeclareBoolOptionX) |
| 11 % If given than the Sphinx standard titlepage is used without changes. | 11 % If given than the Sphinx standard titlepage is used without changes. |
| 12 \define@boolkey{my-doc-style.sty}{stdtitle}[true]{} | 12 \define@boolkey{my-doc-style.sty}{stdtitle}[true]{} |
| 56 % (compare with the \titleformat calls in sphinxlatexstyleheadings.sty). | 56 % (compare with the \titleformat calls in sphinxlatexstyleheadings.sty). |
| 57 % | 57 % |
| 58 % \EndSuppressNumbering ends exactly one preceding | 58 % \EndSuppressNumbering ends exactly one preceding |
| 59 % \SuppressSubsectionNumbering or \SuppressSubsubsectionNumbering. | 59 % \SuppressSubsectionNumbering or \SuppressSubsubsectionNumbering. |
| 60 % | 60 % |
| 61 | |
| 62 % | |
| 63 % A counter to store the current (Sphinx-set) tocdepth. | |
| 64 % Needed because counters are global in LaTeX. | |
| 65 % | |
| 66 \newcounter{@mds@stored@tocdepth} | |
| 67 | |
| 61 \def\SuppressSectionNumbering{% | 68 \def\SuppressSectionNumbering{% |
| 62 \begingroup | 69 \begingroup |
| 63 \renewcommand\thesection{\hspace{-0.5em}} | 70 \setcounter{@mds@stored@tocdepth}{\value{tocdepth}} |
| 71 \addtocontents{toc}{\setcounter{tocdepth}{0}}% No \section in ToC | |
| 72 \renewcommand\thesection{\hspace{-0.5em}} | |
| 64 \renewcommand\thesubsection{\hspace{-0.5em}} | 73 \renewcommand\thesubsection{\hspace{-0.5em}} |
| 65 \renewcommand\thesubsubsection{\hspace{-0.5em}} | 74 \renewcommand\thesubsubsection{\hspace{-0.5em}} |
| 66 \renewcommand\theparagraph{\hspace{-0.5em}} | 75 \renewcommand\theparagraph{\hspace{-0.5em}} |
| 67 \renewcommand\thesubparagraph{\hspace{-0.5em}} | 76 \renewcommand\thesubparagraph{\hspace{-0.5em}} |
| 68 } | 77 } |
| 78 | |
| 69 \def\SuppressSubsectionNumbering{% | 79 \def\SuppressSubsectionNumbering{% |
| 70 \begingroup | 80 \begingroup |
| 81 \setcounter{@mds@stored@tocdepth}{\value{tocdepth}} | |
| 82 \addtocontents{toc}{\setcounter{tocdepth}{1}}% Allow \section in ToC | |
| 71 \renewcommand\thesubsection{\hspace{-0.5em}} | 83 \renewcommand\thesubsection{\hspace{-0.5em}} |
| 72 \renewcommand\thesubsubsection{\hspace{-0.5em}} | 84 \renewcommand\thesubsubsection{\hspace{-0.5em}} |
| 73 \renewcommand\theparagraph{\hspace{-0.5em}} | 85 \renewcommand\theparagraph{\hspace{-0.5em}} |
| 74 \renewcommand\thesubparagraph{\hspace{-0.5em}} | 86 \renewcommand\thesubparagraph{\hspace{-0.5em}} |
| 75 } | 87 } |
| 76 \def\SuppressSubsubsectionNumbering{% | 88 \def\SuppressSubsubsectionNumbering{% |
| 77 \begingroup | 89 \begingroup |
| 90 \setcounter{@mds@stored@tocdepth}{\value{tocdepth}} | |
| 91 \addtocontents{toc}{\setcounter{tocdepth}{2}}% Allow \subsection in ToC | |
| 78 \renewcommand\thesubsubsection{\hspace{-0.5em}} | 92 \renewcommand\thesubsubsection{\hspace{-0.5em}} |
| 79 \renewcommand\theparagraph{\hspace{-0.5em}} | 93 \renewcommand\theparagraph{\hspace{-0.5em}} |
| 80 \renewcommand\thesubparagraph{\hspace{-0.5em}} | 94 \renewcommand\thesubparagraph{\hspace{-0.5em}} |
| 81 } | 95 } |
| 96 | |
| 82 \def\EndSuppressNumbering{% | 97 \def\EndSuppressNumbering{% |
| 98 % Reset the tocdepth to the previous value | |
| 99 \addtocontents{toc}{\setcounter{tocdepth}{\the@mds@stored@tocdepth}}% Default | |
| 83 \endgroup | 100 \endgroup |
| 84 } | 101 } |
| 85 | 102 |
| 86 \endinput | 103 \endinput |
