summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nchairx/source/chairxmathFonts.dtx
blob: 64b4dafd10d4170fa205fc45e53f8bd40f4614cf (plain)
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
% \iffalse meta-comment
%
% Copyright (C) 2018 - 2021 by ChairX
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.3 of this license or (at your option) any later
% version.  The latest version of this license is in:
%
%    http://www.latex-project.org/lppl.txt
%
% and version 1.3 or later is part of all distributions of
% LaTeX version 2005/12/01 or later.
%
% This file contains the implementation of all algebra related macros.
%
% Macros have to be described by (delete the first %)
% %\begin{macro}{\macro}
% % Description of the implementation.
% %    \begin{macrocode}
%\newcommand{\macro}[]         {}
% %    \end{macrocode}
% %\end{macro}
%
% The implementation and description will appear in the implementation
% part of the documentation. Use \subsubsection{} etc. for structuring.
%
% The documentation of the macros defined here has to be written in
% chairxmathFontsDoc.dtx
%\fi
%
% First we check of macros should be included:
%    \begin{macrocode}
\if@loadmath
%    \end{macrocode}
%
%
% We provide several font names for easier usage and
% customization. The fonts are used in our macro definitions and can
% be changed by according to the individual needs.
%
%
%
% \subsubsection{Default Values for some Math Fonts}
%
%
% \begin{macro}{\mathbb}
%
%     Redefine |\mathbb| to use the nicer |\mathbbm|.
%
%    \begin{macrocode}
\DeclareMathAlphabet{\ch@airxmathbbm}{U}{bbm}{m}{n}
\SetMathAlphabet\ch@airxmathbbm{bold}{U}{bbm}{bx}{n}
\renewcommand{\mathbb}[1]{\ch@airxmathbbm{#1}}
%    \end{macrocode}
%
% \end{macro}
%
% \begin{macro}{\mathscr}
%
%     We load a script font and provide the command |\mathscr|
%
%    \begin{macrocode}
\DeclareMathAlphabet{\mathscr}{U}{rsfso}{m}{n}
%    \end{macrocode}
%
% \end{macro}
%
% \begin{macro}{\mathcal}
%
%     We redefine the |\mathcal| command using the Euler font.
%
%    \begin{macrocode}
\DeclareSymbolFont{EulerScript}{U}{eus}{m}{n}
\SetSymbolFont{EulerScript}{bold}{U}{eus}{b}{n}
\DeclareSymbolFontAlphabet\mathcal{EulerScript}
%    \end{macrocode}
%
% \end{macro}
%
%
% \subsubsection{Setting Fonts for Various Math Groups}
%
% Definitions of fonts for the different groups.
%
% \begin{macro}{\ch@irxalgebrafont}
% \begin{macro}{\ch@irxbasisfont}
% \begin{macro}{\ch@irxcategoryfont}
% \begin{macro}{\ch@irxcategorynamefont}
% \begin{macro}{\ch@irxfieldfont}
% \begin{macro}{\ch@irxfilterfont}
% \begin{macro}{\ch@irxfunctorfont}
% \begin{macro}{\ch@irxgerstenhaberfont}
% \begin{macro}{\ch@irxgroupfont}
% \begin{macro}{\ch@irxgroupoidfont}
% \begin{macro}{\ch@irxhilbertfont}
% \begin{macro}{\ch@irxliealgfont}
% \begin{macro}{\ch@irxmodulefont}
% \begin{macro}{\ch@irxprehilbfont}
% \begin{macro}{\ch@irxoperatorfont}
% \begin{macro}{\ch@irxringfont}
% \begin{macro}{\ch@irxscriptfont}
% \begin{macro}{\ch@irxsheaffont}
% \begin{macro}{\ch@irxspacesfont}
% \begin{macro}{\ch@irxtopologyfont}
%
%     We use |xkeyval| to define keys setting the different font
%     groups.  These keys can be used for the macro |\chairxfonts|.
%     We use |\providecommand| to create the font macros if they do
%     not already exist.
%
%    \begin{macrocode}
\define@key[chairx]{fonts}{algebrafont}{
    \providecommand{\ch@irxalgebrafont}[1]{ }
    \renewcommand{\ch@irxalgebrafont}{#1}
}
\define@key[chairx]{fonts}{basisfont}{
	\providecommand{\ch@irxbasisfont}[1]{ }
	\renewcommand{\ch@irxbasisfont}{#1}
}
\define@key[chairx]{fonts}{categoryfont}{
    \providecommand{\ch@irxcategoryfont}[1]{ }
    \renewcommand{\ch@irxcategoryfont}{#1}
}
\define@key[chairx]{fonts}{categorynamefont}{
    \providecommand{\ch@irxcategorynamefont}[1]{ }
    \renewcommand{\ch@irxcategorynamefont}{#1}
}
\define@key[chairx]{fonts}{fieldfont}{
	\providecommand{\ch@irxfieldfont}[1]{ }
	\renewcommand{\ch@irxfieldfont}{#1}
}
\define@key[chairx]{fonts}{filterfont}{
	\providecommand{\ch@irxfilterfont}[1]{ }
	\renewcommand{\ch@irxfilterfont}{#1}
}
\define@key[chairx]{fonts}{functorfont}{
	\providecommand{\ch@irxfunctorfont}[1]{ }
	\renewcommand{\ch@irxfunctorfont}{#1}
}
\define@key[chairx]{fonts}{gerstenhaberfont}{
	\providecommand{\ch@irxgerstenhaberfont}[1]{ }
	\renewcommand{\ch@irxgerstenhaberfont}{#1}
}
\define@key[chairx]{fonts}{groupfont}{
	\providecommand{\ch@irxgroupfont}[1]{ }
	\renewcommand{\ch@irxgroupfont}{#1}
}
\define@key[chairx]{fonts}{groupoidfont}{
	\providecommand{\ch@irxgroupoidfont}[1]{ }
	\renewcommand{\ch@irxgroupoidfont}{#1}
}
\define@key[chairx]{fonts}{hilbertfont}{
	\providecommand{\ch@irxhilbertfont}[1]{ }
	\renewcommand{\ch@irxhilbertfont}{#1}
}
\define@key[chairx]{fonts}{liealgfont}{
	\providecommand{\ch@irxliealgfont}[1]{ }
	\renewcommand{\ch@irxliealgfont}{#1}
}
\define@key[chairx]{fonts}{modulefont}{
	\providecommand{\ch@irxmodulefont}[1]{ }
	\renewcommand{\ch@irxmodulefont}{#1}
}
\define@key[chairx]{fonts}{prehilbfont}{
	\providecommand{\ch@irxprehilbfont}[1]{ }
	\renewcommand{\ch@irxprehilbfont}{#1}
}
%    \end{macrocode}
%
% Here we need to change the default operatorfont in order to get the
% chairxoperatorfont also for |\operatorname| and
% |\DeclareMathOperator|.  Note that redefining |\operator@font| with
% a symbol alphabet and not a symbol font forces us to use an
% additional bracket in all definitions using |\operatorname| and
% |\DeclareMathOperator|.
%
%    \begin{macrocode}
\define@key[chairx]{fonts}{operatorfont}{
    \providecommand{\ch@irxoperatorfont}[1]{ }
    \renewcommand{\ch@irxoperatorfont}{#1}
}
\define@key[chairx]{fonts}{ringfont}{
	\providecommand{\ch@irxringfont}[1]{ }
	\renewcommand{\ch@irxringfont}{#1}
}
\define@key[chairx]{fonts}{scriptfont}{
    \providecommand{\ch@irxscriptfont}[1]{ }
    \renewcommand{\ch@irxscriptfont}{#1}
}
\define@key[chairx]{fonts}{sheaffont}{
	\providecommand{\ch@irxsheaffont}[1]{ }
	\renewcommand{\ch@irxsheaffont}{#1}
}
\define@key[chairx]{fonts}{spacefont}{
    \providecommand{\ch@irxspacefont}[1]{ }
    \renewcommand{\ch@irxspacefont}{#1}
}
\define@key[chairx]{fonts}{topologyfont}{
	\providecommand{\ch@irxtopologyfont}[1]{ }
	\renewcommand{\ch@irxtopologyfont}{#1}
}
%    \end{macrocode}
%
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\chairxfonts}
%
%     Command for setting the fonts.
%
%    \begin{macrocode}
\newcommand{\chairxfonts}[1]{
  \setkeys[chairx]{fonts}{#1}
}
%    \end{macrocode}
%
% \end{macro}
%
% We use the following default settings for fonts.
%
%    \begin{macrocode}
\chairxfonts{
    algebrafont = \mathscr,
    basisfont = \mathit,
    categoryfont = \mathfrak,
    categorynamefont = \mathsf,
    fieldfont = \mathbb,
    filterfont = \mathfrak,
    functorfont = \mathsf,
    groupfont = \mathrm,
    groupoidfont = \mathfrak,
    gerstenhaberfont = \mathfrak,
    hilbertfont = \mathfrak,
    liealgfont = \mathfrak,
    modulefont = \mathscr,
    prehilbfont = \mathcal,
    operatorfont = \mathrm,
    ringfont = \mathsf,
    scriptfont = \mathrm,
    sheaffont = \mathscr,
    spacefont = \mathscr,
    topologyfont = \mathscr
}
%    \end{macrocode}
%
% code for grabbing a single glyph from some random font without
% investing a new math alphabet: use only the wrapper macro as
% |\ch@irxmathsymbol[mathtype]{fontname}{glyph}| with |mathtype| being
% the optional type of the symbol with default being|\mathord|,
% |fontname| the name of the font where the symbol is to be found and
% |glyph| the number of the symbol inside the specified font.
%
%    \begin{macrocode}
\newcommand{\ch@irxfont}[1]{\fontfamily{#1}\fontencoding{U}\fontseries{m}\fontshape{n}\selectfont}
\newcommand{\ch@irxsymbol}[2]{{\ch@irxfont{#1}\char#2}}
\newcommand\ch@irxmathsymbol[3][\mathord]{%
  #1{\ch@irxm@thsymbol{#2}{#3}}}
\def\ch@irxm@thsymbol#1#2{\mathchoice
  {\@ch@irxm@thsymbol{#1}{#2}\tf@size}
  {\@ch@irxm@thsymbol{#1}{#2}\tf@size}
  {\@ch@irxm@thsymbol{#1}{#2}\sf@size}
  {\@ch@irxm@thsymbol{#1}{#2}\ssf@size}}
\def\@ch@irxm@thsymbol#1#2#3{\mbox{\fontsize{#3}{#3}\ch@irxsymbol{#1}{#2}}}
%
%    \end{macrocode}
%
%    \begin{macrocode}
\fi
%    \end{macrocode}