Debian Codegraph @

texmf-dist/source/latex/nchairx/chairxmathFonts.dtx

raw
1 % \iffalse meta-comment
2 %
3 % Copyright (C) 2018 - 2021 by ChairX
4 %
5 % This file may be distributed and/or modified under the
6 % conditions of the LaTeX Project Public License, either
7 % version 1.3 of this license or (at your option) any later
8 % version. The latest version of this license is in:
9 %
10 % http://www.latex-project.org/lppl.txt
11 %
12 % and version 1.3 or later is part of all distributions of
13 % LaTeX version 2005/12/01 or later.
14 %
15 % This file contains the implementation of all algebra related macros.
16 %
17 % Macros have to be described by (delete the first %)
18 % %\begin{macro}{\macro}
19 % % Description of the implementation.
20 % % \begin{macrocode}
21 %\newcommand{\macro}[] {}
22 % % \end{macrocode}
23 % %\end{macro}
24 %
25 % The implementation and description will appear in the implementation
26 % part of the documentation. Use \subsubsection{} etc. for structuring.
27 %
28 % The documentation of the macros defined here has to be written in
29 % chairxmathFontsDoc.dtx
30 %\fi
31 %
32 % First we check of macros should be included:
33 % \begin{macrocode}
34 \if@loadmath
35 % \end{macrocode}
36 %
37 %
38 % We provide several font names for easier usage and
39 % customization. The fonts are used in our macro definitions and can
40 % be changed by according to the individual needs.
41 %
42 %
43 %
44 % \subsubsection{Default Values for some Math Fonts}
45 %
46 %
47 % \begin{macro}{\mathbb}
48 %
49 % Redefine |\mathbb| to use the nicer |\mathbbm|.
50 %
51 % \begin{macrocode}
52 \DeclareMathAlphabet{\ch@airxmathbbm}{U}{bbm}{m}{n}
53 \SetMathAlphabet\ch@airxmathbbm{bold}{U}{bbm}{bx}{n}
54 \renewcommand{\mathbb}[1]{\ch@airxmathbbm{#1}}
55 % \end{macrocode}
56 %
57 % \end{macro}
58 %
59 % \begin{macro}{\mathscr}
60 %
61 % We load a script font and provide the command |\mathscr|
62 %
63 % \begin{macrocode}
64 \DeclareMathAlphabet{\mathscr}{U}{rsfso}{m}{n}
65 % \end{macrocode}
66 %
67 % \end{macro}
68 %
69 % \begin{macro}{\mathcal}
70 %
71 % We redefine the |\mathcal| command using the Euler font.
72 %
73 % \begin{macrocode}
74 \DeclareSymbolFont{EulerScript}{U}{eus}{m}{n}
75 \SetSymbolFont{EulerScript}{bold}{U}{eus}{b}{n}
76 \DeclareSymbolFontAlphabet\mathcal{EulerScript}
77 % \end{macrocode}
78 %
79 % \end{macro}
80 %
81 %
82 % \subsubsection{Setting Fonts for Various Math Groups}
83 %
84 % Definitions of fonts for the different groups.
85 %
86 % \begin{macro}{\ch@irxalgebrafont}
87 % \begin{macro}{\ch@irxbasisfont}
88 % \begin{macro}{\ch@irxcategoryfont}
89 % \begin{macro}{\ch@irxcategorynamefont}
90 % \begin{macro}{\ch@irxfieldfont}
91 % \begin{macro}{\ch@irxfilterfont}
92 % \begin{macro}{\ch@irxfunctorfont}
93 % \begin{macro}{\ch@irxgerstenhaberfont}
94 % \begin{macro}{\ch@irxgroupfont}
95 % \begin{macro}{\ch@irxgroupoidfont}
96 % \begin{macro}{\ch@irxhilbertfont}
97 % \begin{macro}{\ch@irxliealgfont}
98 % \begin{macro}{\ch@irxmodulefont}
99 % \begin{macro}{\ch@irxprehilbfont}
100 % \begin{macro}{\ch@irxoperatorfont}
101 % \begin{macro}{\ch@irxringfont}
102 % \begin{macro}{\ch@irxscriptfont}
103 % \begin{macro}{\ch@irxsheaffont}
104 % \begin{macro}{\ch@irxspacesfont}
105 % \begin{macro}{\ch@irxtopologyfont}
106 %
107 % We use |xkeyval| to define keys setting the different font
108 % groups. These keys can be used for the macro |\chairxfonts|.
109 % We use |\providecommand| to create the font macros if they do
110 % not already exist.
111 %
112 % \begin{macrocode}
113 \define@key[chairx]{fonts}{algebrafont}{
114 \providecommand{\ch@irxalgebrafont}[1]{ }
115 \renewcommand{\ch@irxalgebrafont}{#1}
116 }
117 \define@key[chairx]{fonts}{basisfont}{
118 \providecommand{\ch@irxbasisfont}[1]{ }
119 \renewcommand{\ch@irxbasisfont}{#1}
120 }
121 \define@key[chairx]{fonts}{categoryfont}{
122 \providecommand{\ch@irxcategoryfont}[1]{ }
123 \renewcommand{\ch@irxcategoryfont}{#1}
124 }
125 \define@key[chairx]{fonts}{categorynamefont}{
126 \providecommand{\ch@irxcategorynamefont}[1]{ }
127 \renewcommand{\ch@irxcategorynamefont}{#1}
128 }
129 \define@key[chairx]{fonts}{fieldfont}{
130 \providecommand{\ch@irxfieldfont}[1]{ }
131 \renewcommand{\ch@irxfieldfont}{#1}
132 }
133 \define@key[chairx]{fonts}{filterfont}{
134 \providecommand{\ch@irxfilterfont}[1]{ }
135 \renewcommand{\ch@irxfilterfont}{#1}
136 }
137 \define@key[chairx]{fonts}{functorfont}{
138 \providecommand{\ch@irxfunctorfont}[1]{ }
139 \renewcommand{\ch@irxfunctorfont}{#1}
140 }
141 \define@key[chairx]{fonts}{gerstenhaberfont}{
142 \providecommand{\ch@irxgerstenhaberfont}[1]{ }
143 \renewcommand{\ch@irxgerstenhaberfont}{#1}
144 }
145 \define@key[chairx]{fonts}{groupfont}{
146 \providecommand{\ch@irxgroupfont}[1]{ }
147 \renewcommand{\ch@irxgroupfont}{#1}
148 }
149 \define@key[chairx]{fonts}{groupoidfont}{
150 \providecommand{\ch@irxgroupoidfont}[1]{ }
151 \renewcommand{\ch@irxgroupoidfont}{#1}
152 }
153 \define@key[chairx]{fonts}{hilbertfont}{
154 \providecommand{\ch@irxhilbertfont}[1]{ }
155 \renewcommand{\ch@irxhilbertfont}{#1}
156 }
157 \define@key[chairx]{fonts}{liealgfont}{
158 \providecommand{\ch@irxliealgfont}[1]{ }
159 \renewcommand{\ch@irxliealgfont}{#1}
160 }
161 \define@key[chairx]{fonts}{modulefont}{
162 \providecommand{\ch@irxmodulefont}[1]{ }
163 \renewcommand{\ch@irxmodulefont}{#1}
164 }
165 \define@key[chairx]{fonts}{prehilbfont}{
166 \providecommand{\ch@irxprehilbfont}[1]{ }
167 \renewcommand{\ch@irxprehilbfont}{#1}
168 }
169 % \end{macrocode}
170 %
171 % Here we need to change the default operatorfont in order to get the
172 % chairxoperatorfont also for |\operatorname| and
173 % |\DeclareMathOperator|. Note that redefining |\operator@font| with
174 % a symbol alphabet and not a symbol font forces us to use an
175 % additional bracket in all definitions using |\operatorname| and
176 % |\DeclareMathOperator|.
177 %
178 % \begin{macrocode}
179 \define@key[chairx]{fonts}{operatorfont}{
180 \providecommand{\ch@irxoperatorfont}[1]{ }
181 \renewcommand{\ch@irxoperatorfont}{#1}
182 }
183 \define@key[chairx]{fonts}{ringfont}{
184 \providecommand{\ch@irxringfont}[1]{ }
185 \renewcommand{\ch@irxringfont}{#1}
186 }
187 \define@key[chairx]{fonts}{scriptfont}{
188 \providecommand{\ch@irxscriptfont}[1]{ }
189 \renewcommand{\ch@irxscriptfont}{#1}
190 }
191 \define@key[chairx]{fonts}{sheaffont}{
192 \providecommand{\ch@irxsheaffont}[1]{ }
193 \renewcommand{\ch@irxsheaffont}{#1}
194 }
195 \define@key[chairx]{fonts}{spacefont}{
196 \providecommand{\ch@irxspacefont}[1]{ }
197 \renewcommand{\ch@irxspacefont}{#1}
198 }
199 \define@key[chairx]{fonts}{topologyfont}{
200 \providecommand{\ch@irxtopologyfont}[1]{ }
201 \renewcommand{\ch@irxtopologyfont}{#1}
202 }
203 % \end{macrocode}
204 %
205 % \end{macro}
206 % \end{macro}
207 % \end{macro}
208 % \end{macro}
209 % \end{macro}
210 % \end{macro}
211 % \end{macro}
212 % \end{macro}
213 % \end{macro}
214 % \end{macro}
215 % \end{macro}
216 % \end{macro}
217 % \end{macro}
218 % \end{macro}
219 % \end{macro}
220 % \end{macro}
221 % \end{macro}
222 % \end{macro}
223 % \end{macro}
224 % \end{macro}
225 %
226 % \begin{macro}{\chairxfonts}
227 %
228 % Command for setting the fonts.
229 %
230 % \begin{macrocode}
231 \newcommand{\chairxfonts}[1]{
232 \setkeys[chairx]{fonts}{#1}
233 }
234 % \end{macrocode}
235 %
236 % \end{macro}
237 %
238 % We use the following default settings for fonts.
239 %
240 % \begin{macrocode}
241 \chairxfonts{
242 algebrafont = \mathscr,
243 basisfont = \mathit,
244 categoryfont = \mathfrak,
245 categorynamefont = \mathsf,
246 fieldfont = \mathbb,
247 filterfont = \mathfrak,
248 functorfont = \mathsf,
249 groupfont = \mathrm,
250 groupoidfont = \mathfrak,
251 gerstenhaberfont = \mathfrak,
252 hilbertfont = \mathfrak,
253 liealgfont = \mathfrak,
254 modulefont = \mathscr,
255 prehilbfont = \mathcal,
256 operatorfont = \mathrm,
257 ringfont = \mathsf,
258 scriptfont = \mathrm,
259 sheaffont = \mathscr,
260 spacefont = \mathscr,
261 topologyfont = \mathscr
262 }
263 % \end{macrocode}
264 %
265 % code for grabbing a single glyph from some random font without
266 % investing a new math alphabet: use only the wrapper macro as
267 % |\ch@irxmathsymbol[mathtype]{fontname}{glyph}| with |mathtype| being
268 % the optional type of the symbol with default being|\mathord|,
269 % |fontname| the name of the font where the symbol is to be found and
270 % |glyph| the number of the symbol inside the specified font.
271 %
272 % \begin{macrocode}
273 \newcommand{\ch@irxfont}[1]{\fontfamily{#1}\fontencoding{U}\fontseries{m}\fontshape{n}\selectfont}
274 \newcommand{\ch@irxsymbol}[2]{{\ch@irxfont{#1}\char#2}}
275 \newcommand\ch@irxmathsymbol[3][\mathord]{%
276 #1{\ch@irxm@thsymbol{#2}{#3}}}
277 \def\ch@irxm@thsymbol#1#2{\mathchoice
278 {\@ch@irxm@thsymbol{#1}{#2}\tf@size}
279 {\@ch@irxm@thsymbol{#1}{#2}\tf@size}
280 {\@ch@irxm@thsymbol{#1}{#2}\sf@size}
281 {\@ch@irxm@thsymbol{#1}{#2}\ssf@size}}
282 \def\@ch@irxm@thsymbol#1#2#3{\mbox{\fontsize{#3}{#3}\ch@irxsymbol{#1}{#2}}}
283 %
284 % \end{macrocode}
285 %
286 % \begin{macrocode}
287 \fi
288 % \end{macrocode}