Mercurial > hgrepos > Python > libs > pygments-lexer-pseudocode2
changeset 251:733f1661fcb4
Implement TeX commands to allow to suppress the output of section numbers for some levels.
Prepare for suppressing section numbering for changlog entries.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Sun, 17 May 2026 11:38:47 +0200 |
| parents | 5d3f7d80766f |
| children | b607543d6a8d |
| files | docs/_latex/my-doc-style.sty |
| diffstat | 1 files changed, 41 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/_latex/my-doc-style.sty Sat May 16 22:28:55 2026 +0200 +++ b/docs/_latex/my-doc-style.sty Sun May 17 11:38:47 2026 +0200 @@ -42,4 +42,45 @@ } \fi +% +% Allow to suppress section numbering for some parts of the document +% (e.g. in changelog entries). +% +% Sphinx employs the "titlesec" package to style its chapter and section +% headings and uses its \titleformat command with a 0.5em separation +% (see \titleformat calls in sphinxlatexstyleheadings.sty). +% So make \the<section> output nothing (e.g. the section number) +% but just a compensation for this whitespace. +% +% Each suppress command suppresses its level and all levels below +% (compare with the \titleformat calls in sphinxlatexstyleheadings.sty). +% +% \EndSuppressNumbering ends exactly one preceding +% \SuppressSubsectionNumbering or \SuppressSubsubsectionNumbering. +% +\def\SuppressSectionNumbering{% + \begingroup + \renewcommand\thesection{\hspace{-0.5em}} + \renewcommand\thesubsection{\hspace{-0.5em}} + \renewcommand\thesubsubsection{\hspace{-0.5em}} + \renewcommand\theparagraph{\hspace{-0.5em}} + \renewcommand\thesubparagraph{\hspace{-0.5em}} +} +\def\SuppressSubsectionNumbering{% + \begingroup + \renewcommand\thesubsection{\hspace{-0.5em}} + \renewcommand\thesubsubsection{\hspace{-0.5em}} + \renewcommand\theparagraph{\hspace{-0.5em}} + \renewcommand\thesubparagraph{\hspace{-0.5em}} +} +\def\SuppressSubsubsectionNumbering{% + \begingroup + \renewcommand\thesubsubsection{\hspace{-0.5em}} + \renewcommand\theparagraph{\hspace{-0.5em}} + \renewcommand\thesubparagraph{\hspace{-0.5em}} +} +\def\EndSuppressNumbering{% + \endgroup +} + \endinput
