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