# HG changeset patch # User Franz Glasner # Date 1778889169 -7200 # Node ID 48deafc1fd2fe05403c7b479dfc11e0da03d5920 # Parent ac7e98fe3e14aed5a2b17310566dfb880aa7ac5d Use the new implementations of my-doc-fonts.sty and my-doc-style.sty. Changed titlepage to contain build date the VCS revision. Needed some conf.py variable changes: today is now the logical date (revision date) and today is the build date. diff -r ac7e98fe3e14 -r 48deafc1fd2f docs/_latex/my-doc-fonts.sty --- a/docs/_latex/my-doc-fonts.sty Wed May 13 20:45:20 2026 +0200 +++ b/docs/_latex/my-doc-fonts.sty Sat May 16 01:52:49 2026 +0200 @@ -4,7 +4,7 @@ % \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{my-doc-fonts}[% - 2026/05/13 v0.2 (Franz Glasner) Fonts for Sphinx generated PDFs] + 2026/05/16 v0.3 (Franz Glasner) Fonts for Sphinx generated PDFs] \RequirePackage{xkeyval} \RequirePackage{fontspec} \IfFileExists{xcolor.sty}{% @@ -14,37 +14,126 @@ \RequirePackage{color} } -\newif\if@mdf@@sscode\@mdf@@sscodefalse -\newif\if@mdf@@inconsolata\@mdf@@inconsolatafalse +\newif\if@mdf@mono@dejavusansmono\@mdf@mono@dejavusansmonofalse +\newif\if@mdf@mono@cmmono\@mdf@mono@cmmonofalse +\newif\if@mdf@mono@robotomono\@mdf@mono@robotomonofalse +\newif\if@mdf@mono@sscode\@mdf@mono@sscodefalse +\newif\if@mdf@mono@inconsolata\@mdf@mono@inconsolatafalse +\newif\if@mdf@mono@libertinusmono\@mdf@mono@libertinusmonofalse +\newif\if@mdf@augment@libertinusmono\@mdf@augment@libertinusmonofalse \newif\if@mdf@WithDejaVuSansMono -\newif\if@mdf@WithPlexMono -\newif\if@mdf@WithAdobeSource +\newif\if@mdf@WithCM +\newif\if@mdf@WithRobotoMono +\newif\if@mdf@WithIBMPlex +\newif\if@mdf@WithIBMPlexDejaVuSansMono +\newif\if@mdf@WithAdobeSourcePro \newif\if@mdf@WithSpectral \newif\if@mdf@WithCharter - -\def\@mdf@reset@font@options{\@mdf@WithDejaVuSansMonofalse\@mdf@WithPlexMonofalse\@mdf@WithAdobeSourcefalse\@mdf@WithCharterfalse} +\newif\if@mdf@WithLibertinus +\newif\if@mdf@WithGaramond +\newif\if@mdf@WithTufte +\newif\if@mdf@WithPalatino +\newif\if@mdf@WithCrimson -\DeclareOptionX{dejavusansmono}[true]{\@mdf@reset@font@options\csname @mdf@WithDejaVuSansMono#1\endcsname} -\DeclareOptionX{plexmono}[true]{\@mdf@reset@font@options\csname @mdf@WithPlexMono#1\endcsname} -\DeclareOptionX{adobesource}[true]{\@mdf@reset@font@options\csname @mdf@WithAdobeSource#1\endcsname} -\DeclareOptionX{spectral}[true]{\@mdf@reset@font@options\csname @mdf@WithSpectral#1\endcsname} -\DeclareOptionX{charter}[true]{\@mdf@reset@font@options\csname @mdf@WithCharter#1\endcsname} +% A key compatible with options processing as option "fonts" but choices. +\define@choicekey*{my-doc-fonts.sty}{fonts}[\val\nr]{% + % do not change anything: just deactivate the default "dejavusansmono" + default, + % no augmentation needed: all characters available + dejavusansmono, % use DejaVu Sans Mono as monospaced font + % the fonts below are augmented for missing characters + cm, % assume CM fonts and just fix missing characters + robotomono, % use Roboto Mono as mono font + ibmplex, plex, % use the IBM Plex family (incl. Math) + plex-dejavusansmono, % use IBM Plex Serif/Sans and DejaVu Sans Mono + adobesourcepro, adobesource, % Use Adobe Source Serif/Sans/Mono + spectral, % use Spectral, Source Sans Pro and Source Code Pro + charter, % use XCharter (with XCharter Math), Lato and Inconsolata + libertinus, % use Libertinus family (incl. Math) + garamond, % EB Garamond (with Math), Libre Franklin and Inconsolata + tufte, % Tufte fonts: ETbb (with Math), GilliusADFNo2, DejaVu Sans Mono + palatino, % Palatino, Inter and Source Code Pro + crimson, % Crimson Pro, Cabin and Source Code Pro (incl. Erewhon Math) + }{% + % Not used for now : store the normalized option value (global and expanded) + \xdef\@mdf@fonts{\val}% + % Reset all option related font selection flags + \@mdf@WithDejaVuSansMonofalse + \@mdf@WithCMfalse + \@mdf@WithRobotoMonofalse + \@mdf@WithIBMPlexfalse + \@mdf@WithIBMPlexDejaVuSansMonofalse + \@mdf@WithAdobeSourceProfalse + \@mdf@WithSpectralfalse + \@mdf@WithCharterfalse + \@mdf@WithLibertinusfalse + \@mdf@WithGaramondfalse + \@mdf@WithTuftefalse + \@mdf@WithPalatinofalse + \@mdf@WithCrimsonfalse + % Now set the needed font selection flag + \ifcase\nr\relax + \relax + \or + \@mdf@WithDejaVuSansMonotrue + \or + \@mdf@WithCMtrue + \or + \@mdf@WithRobotoMonotrue + \or + \@mdf@WithIBMPlextrue + \or + \@mdf@WithIBMPlextrue + % Normalize the stored string + \gdef\@mdf@fonts{ibmplex} + \or + \@mdf@WithIBMPlexDejaVuSansMonotrue + \or + \@mdf@WithAdobeSourceProtrue + \or + \@mdf@WithAdobeSourceProtrue + % Normalize the stored string + \gdef\@mdf@fonts{adobesourcepro} + \or + \@mdf@WithSpectraltrue + \or + \@mdf@WithChartertrue + \or + \@mdf@WithLibertinustrue + \or + \@mdf@WithGaramondtrue + \or + \@mdf@WithTuftetrue + \or + \@mdf@WithPalatinotrue + \or + \@mdf@WithCrimsontrue + \fi +} % % By default use the safe option dejavusansmono because is contains % all characters without any hacks. % -\ExecuteOptionsX{dejavusansmono} -\ProcessOptionsX*\relax +\ExecuteOptionsX{fonts=dejavusansmono} +\ProcessOptionsX\relax \if@mdf@WithDejaVuSansMono - \RequirePackage[DefaultFeatures={Scale=0.92},mono=false]{plex-otf} - \RequirePackage[mono=true,serif=false,sans=false,math=false]{dejavu-otf} % all symbols are available + % default but with DejaVu Sans Mono as monospaced font + %\RequirePackage[DefaultFeatures={Scale=0.92},mono=false]{plex-otf} + %\RequirePackage[mono=true,serif=false,sans=false,math=false]{dejavu-otf} % all symbols are available + \@mdf@mono@dejavusansmonotrue +\fi +\if@mdf@WithCM + \@mdf@mono@cmmonotrue +\fi +\if@mdf@WithRobotoMono + \@mdf@mono@robotomonotrue \fi % % -\if@mdf@WithPlexMono +\if@mdf@WithIBMPlex \RequirePackage{newunicodechar} \RequirePackage[DefaultFeatures={Scale=0.92}]{plex-otf} % Dont keep all default font features from plex-otf @@ -79,7 +168,11 @@ verbatimcontinued={\textcolor{red}{{\DejaVuSansMono^^^^21aa}}}}% {sphinx} \fi -\if@mdf@WithAdobeSource +\if@mdf@WithIBMPlexDejaVuSansMono + \RequirePackage[DefaultFeatures={Scale=0.92},mono=false]{plex-otf} + \@mdf@mono@dejavusansmonotrue +\fi +\if@mdf@WithAdobeSourcePro \defaultfontfeatures{Ligatures=TeX,Numbers={Lining,Tabular}} \setmainfont{Source Serif Pro}[ UprightFont = *, @@ -93,9 +186,10 @@ ItalicFont = * Italic, BoldItalicFont = * Bold Italic, ] - \@mdf@@sscodetrue + \@mdf@mono@sscodetrue \fi \if@mdf@WithSpectral + \RequirePackage{unicode-math} \defaultfontfeatures{Ligatures=TeX,Numbers={Lining,Tabular}} \setmainfont{Spectral}[ UprightFont = * Regular, @@ -109,11 +203,12 @@ ItalicFont = * Italic, BoldItalicFont = * Bold Italic, ] - \@mdf@@sscodetrue + \setmathfont{STIX Two Math}[Scale=MatchLowercase] + \@mdf@mono@sscodetrue \fi \if@mdf@WithCharter \defaultfontfeatures{Ligatures=TeX,Numbers={Lining,Tabular}} - \setmainfont{XCharter} + \RequirePackage{xcharter-otf}% loads also XCharter Math \setsansfont{Lato}[ UprightFont = * Regular, BoldFont = * Bold, @@ -121,12 +216,92 @@ BoldItalicFont = * Bold Italic, Scale = MatchLowercase, ] - \@mdf@@inconsolatatrue + \@mdf@mono@inconsolatatrue +\fi +\if@mdf@WithLibertinus + \RequirePackage{newunicodechar} + \RequirePackage[lining,tabular]{libertinus-otf} + \@mdf@augment@libertinusmonotrue +\fi + +\if@mdf@WithGaramond + \RequirePackage[lining,tabular]{ebgaramond} + \RequirePackage{unicode-math} + \setmathfont{Garamond-Math}[Scale=MatchLowercase] + \setsansfont{Libre Franklin}[Scale=MatchLowercase,Ligatures=TeX] + \@mdf@mono@inconsolatatrue +\fi + +\if@mdf@WithTufte + \RequirePackage{unicode-math} + \defaultfontfeatures{Numbers={Lining,Tabular},Ligatures=TeX} + \setmainfont{ETbb} + \setsansfont{GilliusADFNo2}[Scale=MatchLowercase] + \setmathfont{Libertinus Math}[Scale=MatchLowercase] + \@mdf@mono@dejavusansmonotrue +\fi + +\if@mdf@WithPalatino + \RequirePackage{unicode-math} + \linespread{1.06} + \defaultfontfeatures{Numbers={Lining,Tabular},Ligatures=TeX} + \setmainfont{TeXGyrePagellaX} + \setsansfont{Inter}[Scale=MatchLowercase] + %\setsansfont{Rosario}[Scale=MatchLowercase,ScaleAgain=1.013] + %\setmathfont{Asana Math}[Scale=MatchLowercase] + \setmathfont{TeX Gyre Pagella Math}[Scale=MatchLowercase] + %\@mdf@mono@sscodetrue + \@mdf@mono@libertinusmonotrue +\fi + +\if@mdf@WithCrimson + \RequirePackage{unicode-math} + \defaultfontfeatures{Ligatures=TeX, Numbers={Lining,Tabular}} + \setmainfont{Crimson Pro} + \setsansfont{Cabin}[Scale=MatchLowercase] + \defaultfontfeatures{}% Erewhon Math needs this here! + \setmathfont{Erewhon Math}[Scale=MatchLowercase] + \@mdf@mono@sscodetrue \fi \defaultfontfeatures{} -\if@mdf@@sscode +\if@mdf@mono@dejavusansmono + % automatically applied with Scale=MatchLowercase,... + \RequirePackage[mono=true,serif=false,sans=false,math=false]{dejavu-otf} % all symbols are available + \fi + +\if@mdf@mono@cmmono + \RequirePackage{newunicodechar} + \defaultfontfeatures{Ligatures=TeX,Numbers={Lining,Tabular},Scale=MatchLowercase} + \newfontfamily\DejaVuSansMono{DejaVu Sans Mono}[% + UprightFont = *, + BoldFont = * Bold, + ItalicFont = * Oblique, + BoldItalicFont = * Bold Oblique, + ] + \newunicodechar{▷}{{\DejaVuSansMono ▷}}% U+25B7 + \newunicodechar{∶}{{\DejaVuSansMono ∶}}% U+2236 + \newunicodechar{◆}{{\DejaVuSansMono ◆}}% U+25C6 + \newunicodechar{⟵}{{\DejaVuSansMono ⟵}}% U+27F5 + \newunicodechar{⟶}{{\DejaVuSansMono ⟶}}% U+27F6 + \newunicodechar{⟷}{{\DejaVuSansMono ⟷}}% U+27F7 + \newunicodechar{⇒}{{\DejaVuSansMono ⇒}}% U+21D2 + \newunicodechar{⇔}{{\DejaVuSansMono ⇔}}% U+21D4 + \newunicodechar{▪}{{\DejaVuSansMono ▪}}% U+25AA + \newunicodechar{≟}{{\DejaVuSansMono ≟}}% U+225F + \newunicodechar{∈}{{\DejaVuSansMono ∈}}% U+2208 + \newunicodechar{∌}{{\DejaVuSansMono ∌}}% U+220C + \newunicodechar{≠}{{\DejaVuSansMono ≠}}% U+2260 + \newunicodechar{≤}{{\DejaVuSansMono ≤}}% U+2264 + \newunicodechar{≥}{{\DejaVuSansMono ≥}}% U+2265 + \PassOptionsToPackage{% + verbatimvisiblespace={\textcolor{red}{{\DejaVuSansMono^^^^2423}}},% + verbatimcontinued={\textcolor{red}{{\DejaVuSansMono^^^^21aa}}}}% + {sphinx} +\fi + +\if@mdf@mono@sscode \RequirePackage{newunicodechar} \defaultfontfeatures{Ligatures=TeX,Numbers={Lining,Tabular},Scale=MatchLowercase} \setmonofont{Source Code Pro}[ @@ -135,7 +310,6 @@ ItalicFont = * Italic, BoldItalicFont = * Bold Italic, ] - \defaultfontfeatures{} \newfontfamily\DejaVuSansMono{DejaVu Sans Mono}[% UprightFont = *, BoldFont = * Bold, @@ -157,7 +331,7 @@ {sphinx} \fi -\if@mdf@@inconsolata +\if@mdf@mono@inconsolata \RequirePackage{newunicodechar} \defaultfontfeatures{Ligatures=TeX,Numbers={Lining,Tabular},Scale=MatchLowercase} \setmonofont{Inconsolata LGC Nerd Font Mono}[% @@ -166,7 +340,6 @@ ItalicFont = * Italic, BoldItalicFont = * Bold Italic, ] - \defaultfontfeatures{} \newfontfamily\DejaVuSansMono{DejaVu Sans Mono}[% UprightFont = *, BoldFont = * Bold, @@ -182,6 +355,101 @@ \newunicodechar{∌}{{\DejaVuSansMono ∌}}% U+220C \fi +\if@mdf@mono@robotomono + \RequirePackage{newunicodechar} + \defaultfontfeatures{Ligatures=TeX,Numbers={Lining,Tabular},Scale=MatchLowercase} + \setmonofont{Roboto Mono}[% + UprightFont = *, + BoldFont = * Bold, + ItalicFont = * Italic, + BoldItalicFont = * Bold Italic, + ] + \newfontfamily\DejaVuSansMono{DejaVu Sans Mono}[% + UprightFont = *, + BoldFont = * Bold, + ItalicFont = * Oblique, + BoldItalicFont = * Bold Oblique, + ] + \newunicodechar{▷}{{\DejaVuSansMono ▷}}% U+25B7 + \newunicodechar{∶}{{\DejaVuSansMono ∶}}% U+2236 + \newunicodechar{◆}{{\DejaVuSansMono ◆}}% U+25C6 + \newunicodechar{⟵}{{\DejaVuSansMono ⟵}}% U+27F5 + \newunicodechar{⟶}{{\DejaVuSansMono ⟶}}% U+27F6 + \newunicodechar{⟷}{{\DejaVuSansMono ⟷}}% U+27F7 + \newunicodechar{⇒}{{\DejaVuSansMono ⇒}}% U+21D2 + \newunicodechar{⇔}{{\DejaVuSansMono ⇔}}% U+21D4 + \newunicodechar{▪}{{\DejaVuSansMono ▪}}% U+25AA + \newunicodechar{≟}{{\DejaVuSansMono ≟}}% U+225F + \newunicodechar{∈}{{\DejaVuSansMono ∈}}% U+2208 + \newunicodechar{∌}{{\DejaVuSansMono ∌}}% U+220C + + \PassOptionsToPackage{% + verbatimvisiblespace={\textcolor{red}{{\DejaVuSansMono^^^^2423}}},% + verbatimcontinued={\textcolor{red}{{\DejaVuSansMono^^^^21aa}}}}% + {sphinx} +\fi + +\if@mdf@mono@libertinusmono + % This is stolen from libertinus-otf.sty! + \setmonofont{LibertinusMono}[% + Ligatures = TeX, + Numbers = {Lining, Tabular}, + Scale = MatchLowercase, + FakeStretch = 0.94, + UprightFont = *-Regular, + ItalicFont = *-Regular, + ItalicFeatures = {FakeSlant=0.2}, + SlantedFont = *-Regular, + SlantedFeatures= {FakeSlant=0.2}, + BoldFont = *-Regular, + BoldFeatures = {RawFeature={embolden=3}}, + BoldItalicFont = *-Regular, + BoldItalicFeatures={FakeSlant=0.2,RawFeature={embolden=3}}, + Extension = .otf, + ] + \@mdf@augment@libertinusmonotrue +\fi + +\if@mdf@augment@libertinusmono + \RequirePackage{newunicodechar} + \newfontfamily\DejaVuSansMono{DejaVu Sans Mono}[% + UprightFont = *, + BoldFont = * Bold, + ItalicFont = * Oblique, + BoldItalicFont = * Bold Oblique, + Scale=MatchLowercase, + Ligatures=TeX, + ] + \newunicodechar{▷}{{\DejaVuSansMono ▷}}% U+25B7 + \newunicodechar{∶}{{\DejaVuSansMono ∶}}% U+2236 + \newunicodechar{◆}{{\DejaVuSansMono ◆}}% U+25C6 + \newunicodechar{▪}{{\DejaVuSansMono ▪}}% U+25AA + \newunicodechar{⟵}{{\DejaVuSansMono ⟵}}% U+27F5 + \newunicodechar{⟶}{{\DejaVuSansMono ⟶}}% U+27F6 + \newunicodechar{⟷}{{\DejaVuSansMono ⟷}}% U+27F7 + \newunicodechar{⇒}{{\DejaVuSansMono ⇒}}% U+21D2 + \newunicodechar{⇔}{{\DejaVuSansMono ⇔}}% U+21D4 + \newunicodechar{≟}{{\DejaVuSansMono ≟}}% U+225F + \newunicodechar{∈}{{\DejaVuSansMono ∈}}% U+2208 + \newunicodechar{∌}{{\DejaVuSansMono ∌}}% U+220C + \newunicodechar{≠}{{\DejaVuSansMono ≠}}% U+2260 + \newunicodechar{≤}{{\DejaVuSansMono ≤}}% U+2264 + \newunicodechar{≥}{{\DejaVuSansMono ≥}}% U+2265 + %\newunicodechar{␣}{{\DejaVuSansMono ␣}}% U+2423 Missing! + %\newunicodechar{^^^^2423}{{\DejaVuSansMono^^^^2423}}% U+2423 + %\newunicodechar{␣}{\textvisiblespace}% U+2423 + %\catcode`^^^^2423\active\protected\def^^^^2423{\textvisiblespace} + + \PassOptionsToPackage{% + verbatimvisiblespace={\textcolor{red}{{\DejaVuSansMono^^^^2423}}},% + verbatimcontinued={\textcolor{red}{{\DejaVuSansMono^^^^21aa}}}}% + {sphinx} +\fi + \defaultfontfeatures{} +\def\testmdf{ + Normalized: \@mdf@fonts\newline +} + \endinput diff -r ac7e98fe3e14 -r 48deafc1fd2f docs/_latex/my-doc-style.sty --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/_latex/my-doc-style.sty Sat May 16 01:52:49 2026 +0200 @@ -0,0 +1,45 @@ +% -*- coding: utf-8 -*- +% +% Some font hacks for my Sphinx PDF documents +% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{my-doc-style}[% + 2026/05/15 v0.2 (Franz Glasner) Some style customizations (title et al.)] +\RequirePackage{xkeyval} + +% A key compatible with options processing but bool (because DeclareBoolOptionX) +% If given than the Sphinx standard titlepage is used without changes. +\define@boolkey{my-doc-style.sty}{stdtitle}[true]{} + +\ExecuteOptionsX{stdtitle=false} +\ProcessOptionsX\relax + +% +% For the title page: "Last updated on ..." +% +\DeclareRobustCommand*\vcsrevision[1]{\gdef\mds@vcs@revision{#1}} +\DeclareRobustCommand*\builddate[1]{\gdef\mds@builddate{#1}} +\vcsrevision{} +\builddate{} +% +% If the option "stdtitle" was not enabled augment the titlepage with +% the documentation build date and the VCS revision id. +% +\csname ifKV@my-doc-style.sty@stdtitle\endcsname + \relax +\else + % \sphinxmaketitle calls the macro \@thanks: abuse this + \gdef\@thanks{% + \ifx\mds@builddate\@empty\relax% + \ifx\mds@vcs@revision\@empty\relax% + \else% + \hfill\normalsize\textsf{(rv:\mds@vcs@revision )}% + \fi% + \else% + \hfill\normalsize\textsf{Last updated on \mds@builddate% + \ifx\mds@vcs@revision\@empty\relax\else\enspace(rv:\mds@vcs@revision )\fi} + \fi% + } +\fi + +\endinput diff -r ac7e98fe3e14 -r 48deafc1fd2f docs/conf.py --- a/docs/conf.py Wed May 13 20:45:20 2026 +0200 +++ b/docs/conf.py Sat May 16 01:52:49 2026 +0200 @@ -34,9 +34,9 @@ version = '.'.join(configmix.__version__.split('.')[:2]) # The full version, including alpha/beta/rc tags release = configmix.__version__ -release_date = configmix.__date__ +release_date = today = configmix.__date__ -today = datetime.date.today().isoformat() +current_date = datetime.date.today().isoformat() # -- General configuration --------------------------------------------------- @@ -96,7 +96,7 @@ html_theme = 'haiku' # for the Haiku title html_short_title = u("%s %s") % (project, release) -html_last_updated_fmt = "%s (rev %s)" % (today, configmix.__revision__) +html_last_updated_fmt = "%s (rev %s)" % (current_date, configmix.__revision__) # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -144,7 +144,10 @@ 'pointsize': '11pt', 'babel': r'\usepackage{babel}', - 'fontpkg': r'\usepackage[charter]{my-doc-fonts}', + 'preamble': r'\usepackage[stdtitle=false]{my-doc-style}', + 'maketitle': r'\builddate{%s}\vcsrevision{%s}\sphinxmaketitle' \ + % (current_date, configmix.__revision__), + 'fontpkg': r'\usepackage[fonts=charter]{my-doc-fonts}', # Latex figure (float) alignment # @@ -156,6 +159,7 @@ } latex_additional_files = [ "_latex/my-doc-fonts.sty", + "_latex/my-doc-style.sty", ] # Grouping the document tree into LaTeX files. List of tuples