comparison docs/_latex/my-doc-fonts.sty @ 242:0737faace808

A style variant with "Crimson Pro", "Cabin", "Source Code Pro" and "Erewhon Math"
author Franz Glasner <fzglas.hg@dom66.de>
date Sat, 16 May 2026 01:13:28 +0200
parents e18c4bec7889
children 255c5598abd7
comparison
equal deleted inserted replaced
241:7df1fd3bab87 242:0737faace808
32 \newif\if@mdf@WithCharter 32 \newif\if@mdf@WithCharter
33 \newif\if@mdf@WithLibertinus 33 \newif\if@mdf@WithLibertinus
34 \newif\if@mdf@WithGaramond 34 \newif\if@mdf@WithGaramond
35 \newif\if@mdf@WithTufte 35 \newif\if@mdf@WithTufte
36 \newif\if@mdf@WithPalatino 36 \newif\if@mdf@WithPalatino
37 \newif\if@mdf@WithCrimson
37 38
38 % A key compatible with options processing as option "fonts" but choices. 39 % A key compatible with options processing as option "fonts" but choices.
39 \define@choicekey*{my-doc-fonts.sty}{fonts}[\val\nr]{% 40 \define@choicekey*{my-doc-fonts.sty}{fonts}[\val\nr]{%
40 % do not change anything: just deactivate the default "dejavusansmono" 41 % do not change anything: just deactivate the default "dejavusansmono"
41 default, 42 default,
51 charter, % use XCharter (with XCharter Math), Lato and Inconsolata 52 charter, % use XCharter (with XCharter Math), Lato and Inconsolata
52 libertinus, % use Libertinus family (incl. Math) 53 libertinus, % use Libertinus family (incl. Math)
53 garamond, % EB Garamond (with Math), Libre Franklin and Inconsolata 54 garamond, % EB Garamond (with Math), Libre Franklin and Inconsolata
54 tufte, % Tufte fonts: ETbb (with Math), GilliusADFNo2, DejaVu Sans Mono 55 tufte, % Tufte fonts: ETbb (with Math), GilliusADFNo2, DejaVu Sans Mono
55 palatino, % Palatino, Inter and Source Code Pro 56 palatino, % Palatino, Inter and Source Code Pro
57 crimson, % Crimson Pro, Cabin and Source Code Pro (incl. Erewhon Math)
56 }{% 58 }{%
57 % Not used for now : store the normalized option value (global and expanded) 59 % Not used for now : store the normalized option value (global and expanded)
58 \xdef\@mdf@fonts{\val}% 60 \xdef\@mdf@fonts{\val}%
59 % Reset all option related font selection flags 61 % Reset all option related font selection flags
60 \@mdf@WithDejaVuSansMonofalse 62 \@mdf@WithDejaVuSansMonofalse
67 \@mdf@WithCharterfalse 69 \@mdf@WithCharterfalse
68 \@mdf@WithLibertinusfalse 70 \@mdf@WithLibertinusfalse
69 \@mdf@WithGaramondfalse 71 \@mdf@WithGaramondfalse
70 \@mdf@WithTuftefalse 72 \@mdf@WithTuftefalse
71 \@mdf@WithPalatinofalse 73 \@mdf@WithPalatinofalse
74 \@mdf@WithCrimsonfalse
72 % Now set the needed font selection flag 75 % Now set the needed font selection flag
73 \ifcase\nr\relax 76 \ifcase\nr\relax
74 \relax 77 \relax
75 \or 78 \or
76 \@mdf@WithDejaVuSansMonotrue 79 \@mdf@WithDejaVuSansMonotrue
102 \@mdf@WithGaramondtrue 105 \@mdf@WithGaramondtrue
103 \or 106 \or
104 \@mdf@WithTuftetrue 107 \@mdf@WithTuftetrue
105 \or 108 \or
106 \@mdf@WithPalatinotrue 109 \@mdf@WithPalatinotrue
110 \or
111 \@mdf@WithCrimsontrue
107 \fi 112 \fi
108 } 113 }
109 114
110 % 115 %
111 % By default use the safe option dejavusansmono because is contains 116 % By default use the safe option dejavusansmono because is contains
247 \setmathfont{TeX Gyre Pagella Math}[Scale=MatchLowercase] 252 \setmathfont{TeX Gyre Pagella Math}[Scale=MatchLowercase]
248 %\@mdf@mono@sscodetrue 253 %\@mdf@mono@sscodetrue
249 \@mdf@mono@libertinusmonotrue 254 \@mdf@mono@libertinusmonotrue
250 \fi 255 \fi
251 256
257 \if@mdf@WithCrimson
258 \RequirePackage{unicode-math}
259 \defaultfontfeatures{Ligatures=TeX, Numbers={Lining,Tabular}}
260 \setmainfont{Crimson Pro}
261 \setsansfont{Cabin}[Scale=MatchLowercase]
262 \defaultfontfeatures{}% Erewhon Math needs this here!
263 \setmathfont{Erewhon Math}[Scale=MatchLowercase]
264 \@mdf@mono@sscodetrue
265 \fi
266
252 \defaultfontfeatures{} 267 \defaultfontfeatures{}
253 268
254 \if@mdf@mono@dejavusansmono 269 \if@mdf@mono@dejavusansmono
255 % automatically applied with Scale=MatchLowercase,... 270 % automatically applied with Scale=MatchLowercase,...
256 \RequirePackage[mono=true,serif=false,sans=false,math=false]{dejavu-otf} % all symbols are available 271 \RequirePackage[mono=true,serif=false,sans=false,math=false]{dejavu-otf} % all symbols are available
375 \fi 390 \fi
376 391
377 \if@mdf@mono@libertinusmono 392 \if@mdf@mono@libertinusmono
378 % This is stolen from libertinus-otf.sty! 393 % This is stolen from libertinus-otf.sty!
379 \setmonofont{LibertinusMono}[% 394 \setmonofont{LibertinusMono}[%
380 Ligatures = TeX, 395 Ligatures = TeX,
381 Numbers = {Lining, Tabular}, 396 Numbers = {Lining, Tabular},
382 Scale = MatchLowercase, 397 Scale = MatchLowercase,
383 FakeStretch = 0.94, 398 FakeStretch = 0.94,
384 UprightFont = *-Regular, 399 UprightFont = *-Regular,
385 ItalicFont = *-Regular, 400 ItalicFont = *-Regular,