1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
% \iffalse meta-comment
%
% File: se2fonts.dtx Copyright (C) 2022--2023 Stephan Lukasczyk
%
% It may be distributed and/or modified under the conditions of the
% LaTeX Project Public License (LPPL), either version 1.3c of this
% license or (at your option) any later version. The latest version
% of this license is in the file
%
% https://www.latex-project.org/lppl.txt
%
% This file is part of the "se2thesis bundle" (The Work in LPPL)
% and all files in that bundle must be distributed together.
%
% The released version of this bundle is available from CTAN.
%
% ---------------------------------------------------------------------
%
% The development version of the bundle can be found at
%
% https://github.com/se2p/se2thesis
%
% for those people who are interested.
%
% ---------------------------------------------------------------------
%
%<*driver>
\documentclass{l3doc}
% The next line is needed so that \GetFileInfo will be able to pick up
% version data.
\usepackage{se2fonts}
\usepackage[UKenglish]{babel}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{hvlogos}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
% \GetFileInfo{se2fonts.sty}
%
% \title{^^A
% \pkg{se2fonts}---Font Definitions for the \pkg{se2thesis} Bundle^^A
% \thanks{This file describes \fileversion, last revised \filedate.}^^A
% }
%
% \author{^^A
% Stephan Lukasczyk^^A
% \thanks{^^A
% E-mail: \href{mailto:stephan@dante.de}{stephan@dante.de}^^A
% }^^A
% }
%
% \date{Released \filedate}
%
% \maketitle
%
% \begin{documentation}
%
% \section{The \pkg{se2fonts} package}\label{sec:doc-se2fonts}
%
% The \pkg{se2fonts} package sets the fonts of the document.
% In the first version of the bundle, we were running to use Hermann Zaph's
% \emph{Palatino}, \emph{Helvetica}, and \emph{Neo Euler} fonts.
% However, we figured out that they are not part of a standard \LaTeX{}
% installation, and thus required manual work by the user to install them.
% Furthermore, loading the fonts did not always work in a correct way.
%
% Thus, we decided to rethink this decision and---as a consequence---now use
% different fonts that are part of a recent standard \LaTeX{} installation:
% we use the \emph{Libertinus} fonts\footnote{
% \href{https://github.com/alerque/libertinus}{https://github.com/alerque/libertinus}
% } for serif, sans-serif, and math typesetting
% and the \emph{Inconsolata} font\footnote{
% \href{http://levien.com/type/myfonts/inconsolata.html}{http://levien.com/type/myfonts/inconsolata.html}
% } as a monospaced font.
%
% \emph{Please note:} this change might affect they way your documents look,
% and also might affect paragraph and line breaks!
%
% If you are using \LuaTeX{},
% fonts are expected to be present as open-type fonts;
% using \pdfLaTeX{} will fallback to Type-1 fonts.
%
% \emph{Please note:} the package does not support \XeTeX{}!
%
% The following options are defined by the \pkg{se2fonts} package
% to influence the selection of the fonts.
%
% The following list provides examples for each of the fonts:
% \begin{itemize}
% \item {\fontspec{LibertinusSerif}An example text in Libertinus Serif}
% \item {\fontspec{LibertinusSans}An example text in Libertinus Sans}
% \item {\fontspec{InconsolataLGCNerdFont}An example text in Inconsolata}
% \end{itemize}
%
% The package provides additional helper functions
% that are also available to the user.
%
% \begin{function}{\pdftexengine, \xetexengine, \luatexengine}
% \begin{syntax}
% \cmd{\pdftexengine}
% \cmd{\xetexengine}
% \cmd{\luatexengine}
% \end{syntax}
% These commands alias the built-in \LaTeX3{} macros
% \cs{sys_if_engine_pdftex_p:},
% \cs{sys_if_engine_xetex_p:}, and
% \cs{sys_if_engine_luatex_p:}.
% They can be used to check which engine the user is currently running.
% \end{function}
%
% \begin{function}{\ifengineTF, \ifengineT, \ifengineF}
% \begin{syntax}
% \cmd{\ifengineTF} \marg{engine} \marg{then block} \marg{else block}
% \cmd{\ifengineT} \marg{engine} \marg{then block}
% \cmd{\ifengineF} \marg{engine} \marg{then block}
% \end{syntax}
% Allows to execute code based on the running engine.
% The base variant \cs{ifengineTF} expects the user to specify a condition,
% which can be built of combinations of the \cs{pdftexengine},
% \cs{xetexengine}, and \cs{luatexengine} macros,
% followed by the code that will be executed if the condition holds
% and the code that will be executed if the condition does not hold.
%
% For convenience,
% we provide the variants \cs{ifengineT} and \cs{ifengineF}
% that allow to omit an empty then or else branch, respectively.
% \end{function}
%
% \end{documentation}
%
% \begin{implementation}
%
% \section{\pkg{se2fonts} implementation}
%
% Start the \pkg{DocStrip} guards.
% \begin{macrocode}
%<*package>
% \end{macrocode}
%
% Identify the internal prefix (\LaTeX3 \pkg{DocStrip} convention): only
% internal material in this \emph{submodule} should be used directly.
% \begin{macrocode}
%<@@=slcd_fonts>
% \end{macrocode}
%
% Identify the package and give the overall version information.
% \begin{macrocode}
\ProvidesExplPackage {se2fonts} {2024-04-20} {3.4.0}
{A font-selection support package for the se2thesis bundle}
% \end{macrocode}
%
% \subsection{Load-time options}
%
% \begin{macro}{\l_@@_fontmode_tl}
% Holds the font-selection mode specified by the user as a package
% load-time option.
% \emph{Please note:} this option is deprecated!
% \begin{macrocode}
\tl_new:N \l_@@_fontmode_tl
\keys_define:nn { seiifonts }
{
fmode .choice:,
fmode / original .code:n = {
\tl_gset:Nn \l_@@_fontmode_tl {original}
},
fmode / replacement .code:n = {
\tl_gset:Nn \l_@@_fontmode_tl {replacement}
},
fmode / auto .code:n = {
\tl_gset:Nn \l_@@_fontmode_tl {auto}
},
original .meta:n = {fmode=original},
replacement .meta:n = {fmode=replacement},
auto .meta:n = {fmode=auto},
}
% \end{macrocode}
% \end{macro}
%
% \subsection{Option handling}
%
% \begin{macrocode}
\IfFormatAtLeastTF { 2022-06-01 }
{ \ProcessKeyOptions [ seiifonts ] }
{
\RequirePackage{ l3keys2e }
\ProcessKeysOptions { seiifonts }
}
% \end{macrocode}
%
% Define a warning message
% \begin{macrocode}
\msg_set:nnnn { seiifonts } { deprecated-option }
{ The~ option~ fmode~ to~ the~ se2fonts~ package~ is~ deprecated. }
{ Remove~ it~ from~ your~ code.}
% \end{macrocode}
%
% Raise the warning if the option was used
% \begin{macrocode}
\tl_if_empty:NF \l_@@_fontmode_tl
{
\msg_warning:nn { seiifonts } { deprecated-option }
}
% \end{macrocode}
%
% \subsection{Helper macros}
%
% \begin{macro}{\pdftexengine, \xetexengine, \luatexengine}
% We define several alias macros to identify which engine the user is running.
% \begin{macrocode}
\cs_new_eq:NN \pdftexengine \sys_if_engine_pdftex_p:
\cs_new_eq:NN \xetexengine \sys_if_engine_xetex_p:
\cs_new_eq:NN \luatexengine \sys_if_engine_luatex_p:
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ifengineTF, \ifengineT, \ifengineF}
% True, if the engine used matches the given first argument.
% \begin{macrocode}
\NewExpandableDocumentCommand \ifengineTF { mmm }
{
\bool_if:nTF { #1 } { #2 } { #3 }
}
\NewExpandableDocumentCommand \ifengineT { mm }
{
\bool_if:nT { #1 } { #2 }
}
\NewExpandableDocumentCommand \ifengineF { mm }
{
\bool_if:nF { #1 } { #2 }
}
% \end{macrocode}
% \end{macro}
%
% The package is not tested with \XeTeX{}, thus we provide an error to the user
% and stop the execution if they want to use the package with \XeTeX.
% \begin{macrocode}
\ifengineT { \xetexengine }
{
\msg_set:nnnn { seiifonts } { xetex-not-supported }
{ XeTeX~ is~ not~ supported~ by~ the~ se2fonts~ package. }
{ Switch~ to~ pdfTeX~ or~ (preferably)~ LuaTeX. }
\msg_error:nn { seiifonts } { xetex-not-supported }
}
% \end{macrocode}
%
% \subsection{Font loading}
%
% Depending on the engine used by the user,
% we can use \pkg{fontspec} for loading fonts.
% \begin{macrocode}
\ifengineTF { \luatexengine }
{
% \end{macrocode}
%
% If the user uses \LuaTeX{}, load \pkg{fontspec} and \pkg{unicode-math}.
% \begin{macrocode}
\RequirePackage{fontspec}
\RequirePackage{unicode-math}
% \end{macrocode}
%
% To make sure the scaling of the fonts matches, we let \pkg{fontspec} do this
% matching based on the lower-case characters.
% \begin{macrocode}
\defaultfontfeatures{ Scale = MatchLowercase }
\defaultfontfeatures[\rmfamily]{ Scale = 1 }
% \end{macrocode}
%
% Load the respective \pkg{libertinus-otf} package and omit the monospaced font.
% \begin{macrocode}
\PassOptionsToPackage{mono=false}{libertinus-otf}
\RequirePackage{libertinus-otf}
% \end{macrocode}
%
% Load the \emph{Inconsolata Nerd Font} monospaced font.
% \begin{macrocode}
\RequirePackage{inconsolata-nerd-font}
% \end{macrocode}
%
% \begin{macrocode}
} {
% \end{macrocode}
%
% The user does not use \LuaTeX{}, thus fallback to T1 fonts.
% \begin{macrocode}
\PassOptionsToPackage{T1}{fontenc}
\PassOptionsToPackage{scaled=0.9,varl}{inconsolata}
\PassOptionsToPackage{mono=false}{libertinus-type1}
\RequirePackage{fontenc}
\RequirePackage{inconsolata}
\RequirePackage{libertinus-type1}
}
% \end{macrocode}
%
% \begin{macrocode}
%</package>
% \end{macrocode}
%
% \end{implementation}
%
% \PrintIndex
|