Debian Codegraph @

texmf-dist/tex/xetex/unimath-plain-xetex/unimath-plain-xetex.tex

raw
1 %% unimath-plain-xetex.tex
2 %% ******************************************************
3 %% * This work may be distributed and/or modified under *
4 %% * the conditions of the LaTeX Project Public License *
5 %% * http://www.latex-project.org/lppl.txt *
6 %% * either version 1.3c of this license or any later *
7 %% * version. *
8 %% ******************************************************
9 \catcode`\@=11
10 \ifcsname XeTeXversion\endcsname
11 \ifdefined\textfontopt\else\def\textfontopt{mapping=tex-text}\fi
12 \else
13 \errmessage{unimath-plain-xetex Error: Needs XeTeX!}
14 \fi
15 % Here we change the definition of \newfam. XeTeX allows 255 fams at most.
16 \outer\def\newfam{\alloc@8\fam\chardef\@cclv}
17
18 \newdimen\um@tempdima
19 \newdimen\um@tempdimb
20 \newdimen\um@tempdimc
21 \newdimen\um@tempdimd
22
23 % text font and font sizes
24 \ifdefined\mainfontname\else
25 \gdef\mainfontname{Latin Modern Roman}
26 \fi
27 \ifdefined\sansfontname\else
28 \gdef\sansfontname{Latin Modern Sans}
29 \fi
30 \ifdefined\monofontname\else
31 \gdef\monofontname{Latin Modern Mono}
32 \fi
33
34 \font\tenrm = "\mainfontname/R:\textfontopt" at 10pt
35 \font\tenit = "\mainfontname/I:\textfontopt" at 10pt
36 \font\tenbf = "\mainfontname/B:\textfontopt" at 10pt
37 \font\tenbfit = "\mainfontname/BI:\textfontopt" at 10pt
38 % scaling sf and tt
39 \newdimen\sf@size
40 \newdimen\tt@size
41
42 \font\tensf@test = "\sansfontname/R:\textfontopt" at 10pt
43 \font\tentt@test = "\monofontname/R:\textfontopt" at 10pt
44 \um@tempdima\fontdimen5\tenrm
45 \um@tempdimb\fontdimen5\tensf@test
46 \gdef\sf@innerratio{\numexpr\dimexpr256\um@tempdima/\um@tempdimb\relax}
47 \um@tempdimc\fontdimen5\tentt@test
48 \gdef\tt@innerratio{\numexpr\dimexpr256\um@tempdima/\um@tempdimc\relax}
49 \let\tensf@test\relax \let\tentt@test\relax
50
51 \def\@sizeat#1{\um@tempdimd#1\relax
52 \sf@size=\dimexpr\sf@innerratio\um@tempdimd/256\relax
53 \tt@size=\dimexpr\tt@innerratio\um@tempdimd/256\relax
54 }
55 \@sizeat{10pt}
56 \font\tensf = "\sansfontname/R:\textfontopt" at \sf@size
57 \font\tensfit = "\sansfontname/I:\textfontopt" at \sf@size
58 \font\tensfbf = "\sansfontname/B:\textfontopt" at \sf@size
59 \font\tensfbfit = "\sansfontname/BI:\textfontopt" at \sf@size
60 \font\tentt = "\monofontname/R" at \tt@size
61 \font\tenttit = "\monofontname/I" at \tt@size
62 \font\tenttbf = "\monofontname/B" at \tt@size
63 \font\tenttbfit = "\monofontname/BI" at \tt@size
64 % other sizes
65 \def\genfontcmd#1#2{\@sizeat{#2}%
66 \expandafter\font\csname #1rm\endcsname = "\mainfontname/R:\textfontopt" at #2
67 \expandafter\font\csname #1it\endcsname = "\mainfontname/I:\textfontopt" at #2
68 \expandafter\font\csname #1bf\endcsname = "\mainfontname/B:\textfontopt" at #2
69 \expandafter\font\csname #1bfit\endcsname = "\mainfontname/BI:\textfontopt" at #2
70 \expandafter\font\csname #1sf\endcsname = "\sansfontname/R:\textfontopt" at \sf@size
71 \expandafter\font\csname #1sfit\endcsname = "\sansfontname/I:\textfontopt" at \sf@size
72 \expandafter\font\csname #1sfbf\endcsname = "\sansfontname/B:\textfontopt" at \sf@size
73 \expandafter\font\csname #1sfbfit\endcsname = "\sansfontname/BI:\textfontopt" at \sf@size
74 \expandafter\font\csname #1tt\endcsname = "\monofontname/R" at \tt@size
75 \expandafter\font\csname #1ttit\endcsname = "\monofontname/I" at \tt@size
76 \expandafter\font\csname #1ttbf\endcsname = "\monofontname/B" at \tt@size
77 \expandafter\font\csname #1ttbfit\endcsname = "\monofontname/BI" at \tt@size
78 }
79 \genfontcmd{five}{5pt}
80 \genfontcmd{seven}{7pt}
81 \genfontcmd{nine}{9pt}
82 \genfontcmd{twelve}{11.95pt}
83 \genfontcmd{twenty}{20pt}
84 \def\makefontcmdcompatible#1{%
85 \expandafter\let\csname #1itbf\expandafter\endcsname\csname #1bfit\endcsname
86 \expandafter\let\csname #1itsf\expandafter\endcsname\csname #1sfit\endcsname
87 \expandafter\let\csname #1bfsf\expandafter\endcsname\csname #1sfbf\endcsname
88 \expandafter\let\csname #1sfitbf\expandafter\endcsname\csname #1sfbfit\endcsname
89 \expandafter\let\csname #1bfsfit\expandafter\endcsname\csname #1sfbfit\endcsname
90 \expandafter\let\csname #1bfitsf\expandafter\endcsname\csname #1sfbfit\endcsname
91 \expandafter\let\csname #1itsfbf\expandafter\endcsname\csname #1sfbfit\endcsname
92 \expandafter\let\csname #1itbfsf\expandafter\endcsname\csname #1sfbfit\endcsname
93 \expandafter\let\csname #1ittt\expandafter\endcsname\csname #1ttit\endcsname
94 \expandafter\let\csname #1bftt\expandafter\endcsname\csname #1ttbf\endcsname
95 \expandafter\let\csname #1ttitbf\expandafter\endcsname\csname #1ttbfit\endcsname
96 \expandafter\let\csname #1bfttit\expandafter\endcsname\csname #1ttbfit\endcsname
97 \expandafter\let\csname #1bfittt\expandafter\endcsname\csname #1ttbfit\endcsname
98 \expandafter\let\csname #1itttbf\expandafter\endcsname\csname #1ttbfit\endcsname
99 \expandafter\let\csname #1itbftt\expandafter\endcsname\csname #1ttbfit\endcsname
100 }
101
102 % Math Font
103 % In plain format, \fam0 is "rm"; \fam1 is "normal"; \fam2 is "cal";
104 % \fam3 is "op"; \fam4 is "it"; \fam5 is "sl";
105 % \fam6 is "bf"; \fam7 is "tt".
106 % Families defined through \newfam:
107 % \itfam (4), \slfam (5), \bffam (6) and \ttfam (7).
108 %
109 % In XeTeX, there are up to 256 fams (\fam0 to \fam256).
110 % Here we just use \chardef to define the fams.
111 % Also we abandon plain format's default settings.
112 \ifdefined\mathfontname\else
113 \gdef\mathfontname{Latin Modern Math}
114 \fi
115 \chardef\unimathfam=0 % general fam
116 \font \tenmath = "\mathfontname:script=math" at 10pt
117 \font \sevenmath = "\mathfontname:script=math,+ssty=0" at 7pt
118 \font \fivemath = "\mathfontname:script=math,+ssty=1" at 5pt
119 \textfont \unimathfam = \tenmath
120 \scriptfont \unimathfam = \sevenmath
121 \scriptscriptfont \unimathfam = \fivemath
122
123 % delimiter, influencing \mathopen, \mathclose, \mathfence, \mathover(under)
124 \ifdefined\mathdelimiterfontname
125 \chardef\delimiterfam = 1
126 \font \tendelimiter = "\mathdelimiterfontname:script=math" at 10pt
127 \font \sevendelimiter = "\mathdelimiterfontname:script=math,+ssty=0" at 7pt
128 \font \fivedelimiter = "\mathdelimiterfontname:script=math,+ssty=1" at 5pt
129 \textfont \delimiterfam = \tendelimiter
130 \scriptfont \delimiterfam = \sevendelimiter
131 \scriptscriptfont \delimiterfam = \fivedelimiter
132 \else \let\delimiterfam=\unimathfam \fi
133 % ordinary, influencing \mathord, \mathpunct and `!'
134 \ifdefined\mathordfontname
135 \chardef\ordfam = 2
136 \font \tenord = "\mathordfontname:script=math" at 10pt
137 \font \sevenord = "\mathordfontname:script=math,+ssty=0" at 7pt
138 \font \fiveord = "\mathordfontname:script=math,+ssty=1" at 5pt
139 \textfont \ordfam = \tenord
140 \scriptfont \ordfam = \sevenord
141 \scriptscriptfont \ordfam = \fiveord
142 \else \let\ordfam=\unimathfam \fi
143 % large operator, influencing \mathop
144 \ifdefined\mathopfontname
145 \chardef\opfam = 3
146 \font \tenop = "\mathopfontname:script=math" at 10pt
147 \font \sevenop = "\mathopfontname:script=math,+ssty=0" at 7pt
148 \font \fiveop = "\mathopfontname:script=math,+ssty=1" at 5pt
149 \textfont \opfam = \tenop
150 \scriptfont \opfam = \sevenop
151 \scriptscriptfont \opfam = \fiveop
152 \else \let\opfam=\unimathfam \fi
153 % binary, influencing \mathbin and \mathrel
154 \ifdefined\mathbinfontname
155 \chardef\binfam = 4
156 \font \tenbin = "\mathbinfontname:script=math" at 10pt
157 \font \sevenbin = "\mathbinfontname:script=math,+ssty=0" at 7pt
158 \font \fivebin = "\mathbinfontname:script=math,+ssty=1" at 5pt
159 \textfont \binfam = \tenbin
160 \scriptfont \binfam = \sevenbin
161 \scriptscriptfont \binfam = \fivebin
162 \else \let\binfam=\unimathfam \fi
163 % accent, influencing all the accents except \mathover(close)
164 \ifdefined\mathaccentfontname
165 \chardef\accentfam = 5
166 \font \tenaccent = "\mathaccentfontname:script=math" at 10pt
167 \font \sevenaccent = "\mathaccentfontname:script=math,+ssty=0" at 7pt
168 \font \fiveaccent = "\mathaccentfontname:script=math,+ssty=1" at 5pt
169 \textfont \accentfam = \tenaccent
170 \scriptfont \accentfam = \sevenaccent
171 \scriptscriptfont \accentfam = \fiveaccent
172 \else \let\accentfam=\unimathfam \fi
173 %
174 % ---------------------------------------------------------------------- %
175 %
176 % math alphabet, using OpenType Math font
177 \ifdefined\mathalphafontname\else\let\mathalphafontname\mathfontname\fi
178 % \mrm, uses math font
179 \newfam\mrmfam
180 \font \tenmrm = "\mathalphafontname:script=math" at 10pt
181 \font\sevenmrm = "\mathalphafontname:script=math,+ssty=0" at 7pt
182 \font \fivemrm = "\mathalphafontname:script=math,+ssty=1" at 5pt
183 \textfont \mrmfam = \tenmrm
184 \scriptfont \mrmfam = \sevenmrm
185 \scriptscriptfont \mrmfam = \fivemrm
186 \def\mrm{\fam\mrmfam}
187 % \rm, uses text font
188 \newfam\textrmfam
189 \textfont \textrmfam = \tenrm
190 \scriptfont \textrmfam = \sevenrm
191 \scriptscriptfont \textrmfam = \fiverm
192 \def\rm{\fam\textrmfam\tenrm}
193 % \mit, redefined
194 \newfam\mitfam
195 \font \tenmit = "\mathalphafontname:script=math,mapping=unimath-it" at 10pt
196 \font\sevenmit = "\mathalphafontname:script=math,mapping=unimath-it,+ssty=0" at 7pt
197 \font \fivemit = "\mathalphafontname:script=math,mapping=unimath-it,+ssty=1" at 5pt
198 \textfont \mitfam = \tenmit
199 \scriptfont \mitfam = \sevenmit
200 \scriptscriptfont \mitfam = \fivemit
201 \def\mit{\fam\mitfam}
202 % \it
203 \newfam\textitfam
204 \textfont \textitfam = \tenit
205 \scriptfont \textitfam = \sevenit
206 \scriptscriptfont \textitfam = \fiveit
207 \def\it{\fam\textitfam\tenit}
208 % \mbf
209 \newfam\mbffam
210 \font \tenmbf = "\mathalphafontname:script=math,mapping=unimath-bf" at 10pt
211 \font\sevenmbf = "\mathalphafontname:script=math,mapping=unimath-bf,+ssty=0" at 7pt
212 \font \fivembf = "\mathalphafontname:script=math,mapping=unimath-bf,+ssty=1" at 5pt
213 \textfont \mbffam = \tenmbf
214 \scriptfont \mbffam = \sevenmbf
215 \scriptscriptfont \mbffam = \fivembf
216 \def\mbf{\fam\mbffam}
217 % \bf
218 \newfam\textbffam
219 \textfont \textbffam = \tenbf
220 \scriptfont \textbffam = \sevenbf
221 \scriptscriptfont \textbffam = \fivebf
222 \def\bf{\fam\textbffam\tenbf}
223 % \msf
224 \newfam\msffam
225 \font \tenmsf = "\mathalphafontname:script=math,mapping=unimath-sf" at 10pt
226 \font\sevenmsf = "\mathalphafontname:script=math,mapping=unimath-sf,+ssty=0" at 7pt
227 \font \fivemsf = "\mathalphafontname:script=math,mapping=unimath-sf,+ssty=1" at 5pt
228 \textfont \msffam = \tenmsf
229 \scriptfont \msffam = \sevenmsf
230 \scriptscriptfont \msffam = \fivemsf
231 \def\msf{\fam\msffam}
232 % \sf
233 \newfam\textsffam
234 \textfont \textsffam = \tensf
235 \scriptfont \textsffam = \sevensf
236 \scriptscriptfont \textsffam = \fivesf
237 \def\sf{\fam\textsffam\tensf}
238 % \mtt
239 \newfam\mttfam
240 \font \tenmtt = "\mathalphafontname:script=math,mapping=unimath-tt" at 10pt
241 \font\sevenmtt = "\mathalphafontname:script=math,mapping=unimath-tt,+ssty=0" at 7pt
242 \font \fivemtt = "\mathalphafontname:script=math,mapping=unimath-tt,+ssty=1" at 5pt
243 \textfont \mttfam = \tenmtt
244 \scriptfont \mttfam = \sevenmtt
245 \scriptscriptfont \mttfam = \fivemtt
246 \def\mtt{\fam\mttfam}
247 % \tt
248 \newfam\textttfam
249 \textfont \textttfam = \tentt
250 \scriptfont \textttfam = \seventt
251 \scriptscriptfont \textttfam = \fivett
252 \def\tt{\fam\textttfam\tentt}
253 % \mbfit
254 \newfam\mbfitfam
255 \font \tenmbfit = "\mathalphafontname:script=math,mapping=unimath-bfit" at 10pt
256 \font\sevenmbfit = "\mathalphafontname:script=math,mapping=unimath-bfit,+ssty=0" at 7pt
257 \font \fivembfit = "\mathalphafontname:script=math,mapping=unimath-bfit,+ssty=1" at 5pt
258 \textfont \mbfitfam = \tenmbfit
259 \scriptfont \mbfitfam = \sevenmbfit
260 \scriptscriptfont \mbfitfam = \fivembfit
261 \def\mbfit{\fam\mbfitfam}
262 % \bfit
263 \newfam\textbfitfam
264 \textfont \textbfitfam = \tenbfit
265 \scriptfont \textbfitfam = \sevenbfit
266 \scriptscriptfont \textbfitfam = \fivebfit
267 \def\bfit{\fam\textbfitfam\tenbfit}
268 % \msfbf
269 \newfam\msfbffam
270 \font \tenmsfbf = "\mathalphafontname:script=math,mapping=unimath-sfbf" at 10pt
271 \font\sevenmsfbf = "\mathalphafontname:script=math,mapping=unimath-sfbf,+ssty=0" at 7pt
272 \font \fivemsfbf = "\mathalphafontname:script=math,mapping=unimath-sfbf,+ssty=1" at 5pt
273 \textfont \msfbffam = \tenmsfbf
274 \scriptfont \msfbffam = \sevenmsfbf
275 \scriptscriptfont \msfbffam = \fivemsfbf
276 \def\msfbf{\fam\msfbffam}
277 % \sfbf
278 \newfam\textsfbffam
279 \textfont \textsfbffam = \tensfbf
280 \scriptfont \textsfbffam = \sevensfbf
281 \scriptscriptfont \textsfbffam = \fivesfbf
282 \def\sfbf{\fam\textsfbffam\tensfbf}
283 % \msfit
284 \newfam\msfitfam
285 \font \tenmsfit = "\mathalphafontname:script=math,mapping=unimath-sfit" at 10pt
286 \font\sevenmsfit = "\mathalphafontname:script=math,mapping=unimath-sfit,+ssty=0" at 7pt
287 \font \fivemsfit = "\mathalphafontname:script=math,mapping=unimath-sfit,+ssty=1" at 5pt
288 \textfont \msfitfam = \tenmsfit
289 \scriptfont \msfitfam = \sevenmsfit
290 \scriptscriptfont \msfitfam = \fivemsfit
291 \def\msfit{\fam\msfitfam}
292 % \sfit
293 \newfam\textsfitfam
294 \textfont \textsfitfam = \tensfit
295 \scriptfont \textsfitfam = \sevensfit
296 \scriptscriptfont \textsfitfam = \fivesfit
297 \def\sfit{\fam\textsfitfam\tensfit}
298 % \msfbfit
299 \newfam\msfbfitfam
300 \font \tenmsfbfit = "\mathalphafontname:script=math,mapping=unimath-sfbfit" at 10pt
301 \font\sevenmsfbfit = "\mathalphafontname:script=math,mapping=unimath-sfbfit,+ssty=0" at 7pt
302 \font \fivemsfbfit = "\mathalphafontname:script=math,mapping=unimath-sfbfit,+ssty=1" at 5pt
303 \textfont \msfbfitfam = \tenmsfbfit
304 \scriptfont \msfbfitfam = \sevenmsfbfit
305 \scriptscriptfont \msfbfitfam = \fivemsfbfit
306 \def\msfbfit{\fam\msfbfitfam}
307 % \sfbfit
308 \newfam\textsfbfitfam
309 \textfont \textsfbfitfam = \tensfbfit
310 \scriptfont \textsfbfitfam = \sevensfbfit
311 \scriptscriptfont \textsfbfitfam = \fivesfbfit
312 \def\sfbfit{\fam\textsfbfitfam\tensfbfit}
313 % ----------------- math only ----------------- %
314 % \scr
315 \newfam\scrfam
316 \font \tenscr = "\mathalphafontname:script=math,mapping=unimath-scr" at 10pt
317 \font\sevenscr = "\mathalphafontname:script=math,mapping=unimath-scr,+ssty=0" at 7pt
318 \font \fivescr = "\mathalphafontname:script=math,mapping=unimath-scr,+ssty=1" at 5pt
319 \textfont \scrfam = \tenscr
320 \scriptfont \scrfam = \sevenscr
321 \scriptscriptfont \scrfam = \fivescr
322 \def\scr{\fam\scrfam}
323 % \bb
324 \newfam\bbfam
325 \font \tenbb = "\mathalphafontname:script=math,mapping=unimath-bb" at 10pt
326 \font\sevenbb = "\mathalphafontname:script=math,mapping=unimath-bb,+ssty=0" at 7pt
327 \font \fivebb = "\mathalphafontname:script=math,mapping=unimath-bb,+ssty=1" at 5pt
328 \textfont \bbfam = \tenbb
329 \scriptfont \bbfam = \sevenbb
330 \scriptscriptfont \bbfam = \fivebb
331 \def\bb{\fam\bbfam}
332 % \frak
333 \newfam\frakfam
334 \font \tenfrak = "\mathalphafontname:script=math,mapping=unimath-frak" at 10pt
335 \font\sevenfrak = "\mathalphafontname:script=math,mapping=unimath-frak,+ssty=0" at 7pt
336 \font \fivefrak = "\mathalphafontname:script=math,mapping=unimath-frak,+ssty=1" at 5pt
337 \textfont \frakfam = \tenfrak
338 \scriptfont \frakfam = \sevenfrak
339 \scriptscriptfont \frakfam = \fivefrak
340 \def\frak{\fam\frakfam}
341 % \scrbf
342 \newfam\scrbffam
343 \font \tenscrbf = "\mathalphafontname:script=math,mapping=unimath-scrbf" at 10pt
344 \font\sevenscrbf = "\mathalphafontname:script=math,mapping=unimath-scrbf,+ssty=0" at 7pt
345 \font \fivescrbf = "\mathalphafontname:script=math,mapping=unimath-scrbf,+ssty=1" at 5pt
346 \textfont \scrbffam = \tenscrbf
347 \scriptfont \scrbffam = \sevenscrbf
348 \scriptscriptfont \scrbffam = \fivescrbf
349 \def\scrbf{\fam\scrbffam}
350 % \frakbf
351 \newfam\frakbffam
352 \font \tenfrakbf = "\mathalphafontname:script=math,mapping=unimath-frakbf" at 10pt
353 \font\sevenfrakbf = "\mathalphafontname:script=math,mapping=unimath-frakbf,+ssty=0" at 7pt
354 \font \fivefrakbf = "\mathalphafontname:script=math,mapping=unimath-frakbf,+ssty=1" at 5pt
355 \textfont \frakbffam = \tenfrakbf
356 \scriptfont \frakbffam = \sevenfrakbf
357 \scriptscriptfont \frakbffam = \fivefrakbf
358 \def\frakbf{\fam\frakbffam}
359 % \bbit
360 \newfam\bbitfam
361 \font \tenbbit = "\mathalphafontname:script=math,mapping=unimath-bbit" at 10pt
362 \font\sevenbbit = "\mathalphafontname:script=math,mapping=unimath-bbit,+ssty=0" at 7pt
363 \font \fivebbit = "\mathalphafontname:script=math,mapping=unimath-bbit,+ssty=1" at 5pt
364 \textfont \bbitfam = \tenbbit
365 \scriptfont \bbitfam = \sevenbbit
366 \scriptscriptfont \bbitfam = \fivebbit
367 \def\bbit{\fam\bbitfam}
368 % equivalent commands
369 \let\mitbf=\mbfit \let\mitsf=\msfit \let\mbfsf=\msfbf
370 \let\msfitbf=\msfbfit \let\mbfsfit=\msfbfit \let\mbfitsf=\msfbfit
371 \let\mitsfbf=\msfbfit \let\mitbfsf=\msfbfit
372 \let\itbf=\bfit \let\itsf=\sfit \let\bfsf=\sfbf
373 \let\sfitbf=\sfbfit \let\bfsfit=\sfbfit \let\bfitsf=\sfbfit
374 \let\itsfbf=\sfbfit \let\itbfsf=\sfbfit
375 \let\mscr=\scr \let\mcal=\scr \let\cal=\scr
376 \let\calbf=\scrbf \let\bfcal=\scrbf \let\mcalbf=\scrbf
377 \let\mbfcal=\scrbf \let\mscrbf=\scrbf \let\mbfscr=\scrbf
378 \let\bfscr=\scrbf
379 \let\bffrak=\frakbf \let\mfrakbf=\frakbf \let\mbffrak=\frakbf
380 \let\itbb=\bbit \let\mbbit=\bbit \let\mitbb=\bbit
381 %
382 % ---------------------------------------------------------------------- %
383 %
384 \ifdefined\unimathsettings
385 \unimathsettings
386 \fi
387
388 % loading unicode-math-table
389 \def\mathalpha{A}
390 \def\mathfence{F}
391 \def\mathaccentwide{Awo}
392 \def\mathaccentoverlay{Awo}
393 \def\mathover{O}
394 \def\mathunder{U}
395 \def\mathbotaccent{bA}
396 \def\mathbotaccentwide{bAw}
397 \def\sqrt{sqrt} \def\cuberoot{cuberoot}
398 \def\fourthroot{fourthroot} \def\longdivision{longdivision}
399 % \@activedef, used like LuaTeX
400 \begingroup%
401 \catcode`\^^@=13
402 \protected\gdef\@activedef#1#2{\begingroup% #1: char code; #2: definition
403 \lccode`\^^@=#1
404 \lowercase{\endgroup\gdef^^@{#2}}}%
405 \endgroup%
406 % \UnicodeMathSymbol in unicode-math-table
407 \def\UnicodeMathSymbol#1#2#3#4{% #1: char slot; #2: cmd; #3: \mathord, etc.
408 \ifx#3\mathord
409 \Umathchardef #2 = 0 \ordfam #1
410 \Umathcode #1 = 0 \ordfam #1
411 \else\ifx#3\mathalpha
412 \Umathchardef #2 = 0 \ordfam #1
413 \Umathcode #1 = 0 \ordfam #1
414 \else\ifx#3\mathop
415 \Umathchardef #2 = 1 \opfam #1
416 \Umathcode #1 = 1 \opfam #1
417 % The integrals
418 \ifnum#1>"222A\ifnum#1<"2A1D
419 \ifnum#1<"2234
420 \gdef#2{\Umathchar 1 \opfam #1\nolimits}%
421 \global\mathcode#1="8000 % make #1 active
422 \@activedef{#1}{#2}%
423 \else\ifnum#1>"2A0A
424 \gdef#2{\Umathchar 1 \opfam #1\nolimits}%
425 \global\mathcode#1="8000
426 \@activedef{#1}{#2}%
427 \fi\fi\fi\fi
428 \else\ifx#3\mathbin
429 \Umathchardef #2 = 2 \binfam #1
430 \Umathcode #1 = 2 \binfam #1
431 \else\ifx#3\mathrel
432 \Umathchardef #2 = 3 \binfam #1
433 \Umathcode #1 = 3 \binfam #1
434 \else\ifx#3\mathopen
435 \Umathcode #1 = 4 \delimiterfam #1
436 \Udelcode #1 = \delimiterfam #1
437 \gdef#2{\Udelimiter 4 \delimiterfam #1 }
438 \ifx#2\sqrt % = "221A
439 \gdef#2{\Uradical \delimiterfam #1 }
440 \fi\ifx#2\cuberoot % = "221B
441 \gdef#2{\Uradical \delimiterfam #1 }
442 \fi\ifx#2\fourthroot % = "221C
443 \gdef#2{\Uradical \delimiterfam #1 }
444 \fi\ifx#2\longdivision % = "27CC
445 \gdef#2{\Uradical \delimiterfam #1 }
446 \fi
447 \else\ifx#3\mathclose % `!' will be influenced, deal with it later
448 \Umathcode #1 = 5 \delimiterfam #1
449 \Udelcode #1 = \delimiterfam #1
450 \gdef#2{\Udelimiter 5 \delimiterfam #1 }
451 \else\ifx#3\mathpunct
452 \Umathchardef #2 = 6 \ordfam #1
453 \Umathcode #1 = 6 \ordfam #1
454 \else\ifx#3\mathfence % delimiter, in \mathord
455 \Umathchardef #2 = 0 \delimiterfam #1
456 \Umathcode #1 = 0 \delimiterfam #1
457 \Udelcode #1 = \delimiterfam #1
458 \gdef#2{\Udelimiter 0 \delimiterfam #1 }
459 \else\ifx#3\mathaccent
460 \gdef#2{\Umathaccent fixed 0 \accentfam #1 }
461 \else\ifx#3\mathaccentwide% or overlay
462 \gdef#2{\Umathaccent 0 \accentfam #1 }
463 \else\ifx#3\mathbotaccentwide
464 \gdef#2{\Umathaccent bottom 0 \accentfam #1 }
465 \else\ifx#3\mathover
466 \gdef#2##1{\mathop{\Umathaccent 0 \delimiterfam #1 {##1}}\limits}
467 \else\ifx#3\mathunder
468 \gdef#2##1{\mathop{\Umathaccent bottom 0 \delimiterfam #1 {##1}}\limits}
469 \else\ifx#3\mathbotaccent% This type's frequency is the lowest.
470 \gdef#2{\Umathaccent bottom fixed 0 \accentfam #1 }
471 \else% undefined math type
472 \message{There's an undefined math type. Math character command ignored.}%
473 \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi
474 }
475 \input unicode-math-table
476
477 % patch the delimiters
478 \Udelcode `\< = \delimiterfam "27E8
479 \Udelcode `\> = \delimiterfam "27E9
480 % According to xetexref, the math class of a delimiter should be 4 or 5,
481 % but here we use 0 instead.
482 \def\|{\Udelimiter 0 \delimiterfam "2016 }
483
484 % deal with `!'
485 \Umathcode `\! = 5 \ordfam "0021
486 \Umathchardef \mathexclam = 4 \ordfam "0021
487
488 % other symbols
489 \Umathcode `\* = 2 \binfam `\*
490 %\Umathcode `\+ = 2 \binfam `\+
491 %\Umathcode `\, = 6 \ordfam `\,
492 \Umathcode `\- = 2 \binfam "2212
493 %\Umathcode `\. = 0 \ordfam `\.
494 \Umathcode `\: = 3 \ordfam `\:
495 \Umathcode `\; = 6 \ordfam `\;
496 \Umathcode `\< = 3 \binfam `\<
497 \Umathcode `\= = 3 \binfam `\=
498 \Umathcode `\> = 3 \binfam `\>
499 %\Umathcode `\? = 5 \ordfam `\?
500 \Umathchardef \colon = 7 \ordfam `\:
501 \Umathcode `\_ = 0 \ordfam `\_
502 %\Umathcode `\| = 0 \delimiterfam `\|
503 %\Umathcode `\/ = 0 \delimiterfam `\/
504 %\Umathcode `\\ = 0 \delimiterfam `\\
505 %\Umathcode `\( = 4 \delimiterfam `\(
506 %\Umathcode `\) = 5 \delimiterfam `\)
507 %\Umathcode `\[ = 4 \delimiterfam `\[
508 %\Umathcode `\] = 5 \delimiterfam `\]
509 %\Umathcode `\{ = 4 \delimiterfam `\{
510 %\Umathcode `\} = 5 \delimiterfam `\}
511
512 \Umathcode `\0 = 7 \mrmfam `\0 %"30
513 \Umathcode `\1 = 7 \mrmfam `\1 %"31
514 \Umathcode `\2 = 7 \mrmfam `\2 %"32
515 \Umathcode `\3 = 7 \mrmfam `\3 %"33
516 \Umathcode `\4 = 7 \mrmfam `\4 %"34
517 \Umathcode `\5 = 7 \mrmfam `\5 %"35
518 \Umathcode `\6 = 7 \mrmfam `\6 %"36
519 \Umathcode `\7 = 7 \mrmfam `\7 %"37
520 \Umathcode `\8 = 7 \mrmfam `\8 %"38
521 \Umathcode `\9 = 7 \mrmfam `\9 %"39
522 \Umathcode `\A = 7 \mitfam `\A %"1D434
523 \Umathcode `\B = 7 \mitfam `\B %"1D435
524 \Umathcode `\C = 7 \mitfam `\C %"1D436
525 \Umathcode `\D = 7 \mitfam `\D %"1D437
526 \Umathcode `\E = 7 \mitfam `\E %"1D438
527 \Umathcode `\F = 7 \mitfam `\F %"1D439
528 \Umathcode `\G = 7 \mitfam `\G %"1D43A
529 \Umathcode `\H = 7 \mitfam `\H %"1D43B
530 \Umathcode `\I = 7 \mitfam `\I %"1D43C
531 \Umathcode `\J = 7 \mitfam `\J %"1D43D
532 \Umathcode `\K = 7 \mitfam `\K %"1D43E
533 \Umathcode `\L = 7 \mitfam `\L %"1D43F
534 \Umathcode `\M = 7 \mitfam `\M %"1D440
535 \Umathcode `\N = 7 \mitfam `\N %"1D441
536 \Umathcode `\O = 7 \mitfam `\O %"1D442
537 \Umathcode `\P = 7 \mitfam `\P %"1D443
538 \Umathcode `\Q = 7 \mitfam `\Q %"1D444
539 \Umathcode `\R = 7 \mitfam `\R %"1D445
540 \Umathcode `\S = 7 \mitfam `\S %"1D446
541 \Umathcode `\T = 7 \mitfam `\T %"1D447
542 \Umathcode `\U = 7 \mitfam `\U %"1D448
543 \Umathcode `\V = 7 \mitfam `\V %"1D449
544 \Umathcode `\W = 7 \mitfam `\W %"1D44A
545 \Umathcode `\X = 7 \mitfam `\X %"1D44B
546 \Umathcode `\Y = 7 \mitfam `\Y %"1D44C
547 \Umathcode `\Z = 7 \mitfam `\Z %"1D44D
548 \Umathcode `\a = 7 \mitfam `\a %"1D44E
549 \Umathcode `\b = 7 \mitfam `\b %"1D44F
550 \Umathcode `\c = 7 \mitfam `\c %"1D450
551 \Umathcode `\d = 7 \mitfam `\d %"1D451
552 \Umathcode `\e = 7 \mitfam `\e %"1D452
553 \Umathcode `\f = 7 \mitfam `\f %"1D453
554 \Umathcode `\g = 7 \mitfam `\g %"1D454
555 \Umathcode `\h = 7 \mitfam `\h %"0210E % Planck constant
556 \Umathcode `\i = 7 \mitfam `\i %"1D456
557 \Umathcode `\j = 7 \mitfam `\j %"1D457
558 \Umathcode `\k = 7 \mitfam `\k %"1D458
559 \Umathcode `\l = 7 \mitfam `\l %"1D459
560 \Umathcode `\m = 7 \mitfam `\m %"1D45A
561 \Umathcode `\n = 7 \mitfam `\n %"1D45B
562 \Umathcode `\o = 7 \mitfam `\o %"1D45C
563 \Umathcode `\p = 7 \mitfam `\p %"1D45D
564 \Umathcode `\q = 7 \mitfam `\q %"1D45E
565 \Umathcode `\r = 7 \mitfam `\r %"1D45F
566 \Umathcode `\s = 7 \mitfam `\s %"1D460
567 \Umathcode `\t = 7 \mitfam `\t %"1D461
568 \Umathcode `\u = 7 \mitfam `\u %"1D462
569 \Umathcode `\v = 7 \mitfam `\v %"1D463
570 \Umathcode `\w = 7 \mitfam `\w %"1D464
571 \Umathcode `\x = 7 \mitfam `\x %"1D465
572 \Umathcode `\y = 7 \mitfam `\y %"1D466
573 \Umathcode `\z = 7 \mitfam `\z %"1D467
574 \Umathcode `\Α = 7 \mrmfam `\Α %"1D6E2
575 \Umathcode `\Β = 7 \mrmfam `\Β %"1D6E3
576 \Umathcode `\Γ = 7 \mrmfam `\Γ %"1D6E4
577 \Umathcode `\Δ = 7 \mrmfam `\Δ %"1D6E5
578 \Umathcode `\Ε = 7 \mrmfam `\Ε %"1D6E6
579 \Umathcode `\Ζ = 7 \mrmfam `\Ζ %"1D6E7
580 \Umathcode `\Η = 7 \mrmfam `\Η %"1D6E8
581 \Umathcode `\Θ = 7 \mrmfam `\Θ %"1D6E9
582 \Umathcode `\Ι = 7 \mrmfam `\Ι %"1D6EA
583 \Umathcode `\Κ = 7 \mrmfam `\Κ %"1D6EB
584 \Umathcode `\Λ = 7 \mrmfam `\Λ %"1D6EC
585 \Umathcode `\Μ = 7 \mrmfam `\Μ %"1D6ED
586 \Umathcode `\Ν = 7 \mrmfam `\Ν %"1D6EE
587 \Umathcode `\Ξ = 7 \mrmfam `\Ξ %"1D6EF
588 \Umathcode `\Ο = 7 \mrmfam `\Ο %"1D6F0
589 \Umathcode `\Π = 7 \mrmfam `\Π %"1D6F1
590 \Umathcode `\Ρ = 7 \mrmfam `\Ρ %"1D6F2
591 \Umathcode `\Σ = 7 \mrmfam `\Σ %"1D6F4
592 \Umathcode `\Τ = 7 \mrmfam `\Τ %"1D6F5
593 \Umathcode `\Υ = 7 \mrmfam `\Υ %"1D6F6
594 \Umathcode `\Φ = 7 \mrmfam `\Φ %"1D6F7
595 \Umathcode `\Χ = 7 \mrmfam `\Χ %"1D6F8
596 \Umathcode `\Ψ = 7 \mrmfam `\Ψ %"1D6F9
597 \Umathcode `\Ω = 7 \mrmfam `\Ω %"1D6FA
598 \Umathcode `\α = 7 \mitfam `\α %"1D6FC
599 \Umathcode `\β = 7 \mitfam `\β %"1D6FD
600 \Umathcode `\γ = 7 \mitfam `\γ %"1D6FE
601 \Umathcode `\δ = 7 \mitfam `\δ %"1D6FF
602 \Umathcode `\ε = 7 \mitfam `\ε %"1D700
603 \Umathcode `\ζ = 7 \mitfam `\ζ %"1D701
604 \Umathcode `\η = 7 \mitfam `\η %"1D702
605 \Umathcode `\θ = 7 \mitfam `\θ %"1D703
606 \Umathcode `\ι = 7 \mitfam `\ι %"1D704
607 \Umathcode `\κ = 7 \mitfam `\κ %"1D705
608 \Umathcode `\λ = 7 \mitfam `\λ %"1D706
609 \Umathcode `\μ = 7 \mitfam `\μ %"1D707
610 \Umathcode `\ν = 7 \mitfam `\ν %"1D708
611 \Umathcode `\ξ = 7 \mitfam `\ξ %"1D709
612 \Umathcode `\ο = 7 \mitfam `\ο %"1D70A
613 \Umathcode `\π = 7 \mitfam `\π %"1D70B
614 \Umathcode `\ρ = 7 \mitfam `\ρ %"1D70C
615 \Umathcode `\ς = 7 \mitfam `\ς %"1D70D
616 \Umathcode `\σ = 7 \mitfam `\σ %"1D70E
617 \Umathcode `\τ = 7 \mitfam `\τ %"1D70F
618 \Umathcode `\υ = 7 \mitfam `\υ %"1D710
619 \Umathcode `\φ = 7 \mitfam `\φ %"1D719
620 \Umathcode `\χ = 7 \mitfam `\χ %"1D712
621 \Umathcode `\ψ = 7 \mitfam `\ψ %"1D713
622 \Umathcode `\ω = 7 \mitfam `\ω %"1D714
623 \Umathcode `\ϑ = 7 \mitfam `\ϑ %"1D717
624 \Umathcode `\ϕ = 7 \mitfam `\ϕ %"1D711
625 \Umathcode `\ϖ = 7 \mitfam `\ϖ %"1D71B
626 \Umathcode `\ϰ = 7 \mitfam `\ϰ %"1D718
627 \Umathcode `\ϱ = 7 \mitfam `\ϱ %"1D71A
628 \Umathcode `\ϴ = 7 \mrmfam `\ϴ %"1D6F3
629 \Umathcode `\ϵ = 7 \mitfam `\ϵ %"1D716
630 % Some rarely-used Greek letters
631 \Umathcode `\Ϝ = 0 \ordfam "003DC
632 \Umathcode `\ϝ = 0 \ordfam "003DD
633 \Umathcode `\϶ = 0 \ordfam "003F6
634
635 % Greek letter command
636 \let\Alpha=Α \let\Beta=Β \let\Gamma=Γ \let\Delta=Δ
637 \let\Epsilon=Ε \let\Zeta=Ζ \let\Eta=Η \let\Theta=Θ
638 \let\Iota=Ι \let\Kappa=Κ \let\Lambda=Λ \let\Mu=Μ
639 \let\Nu=Ν \let\Xi=Ξ \let\Omicron=Ο \let\Pi=Π
640 \let\Rho=Ρ \let\Sigma=Σ \let\Tau=Τ \let\Upsilon=Υ
641 \let\Phi=Φ \let\Chi=Χ \let\Psi=Ψ \let\Omega=Ω
642 \let\alpha=α \let\beta=β \let\gamma=γ \let\delta=δ
643 \let\varepsilon=ε \let\zeta=ζ \let\eta=η \let\theta=θ
644 \let\iota=ι \let\kappa=κ \let\lambda=λ \let\mu=μ
645 \let\nu=ν \let\xi=ξ \let\omicron=ο \let\pi=π
646 \let\rho=ρ \let\varsigma=ς \let\sigma=σ \let\tau=τ
647 \let\upsilon=υ \let\phi=φ \let\chi=χ \let\psi=ψ
648 \let\omega=ω \let\vartheta=ϑ \let\varphi=ϕ \let\varpi=ϖ
649 \let\varkappa=ϰ \let\varrho=ϱ \let\varTheta=ϴ \let\epsilon=ϵ
650 % \partial and \nabla
651 \let\partial=∂ \let\nabla=∇
652
653 % math commands
654 \protected\def\{{\ifmmode\lbrace\else\char`\{\fi} % plain.tex: \let\{=\lbrace
655 \protected\def\}{\ifmmode\rbrace\else\char`\}\fi} % plain.tex: \let\}=\rbrace
656 \let\neq=\ne
657 \let\le=\leq
658 \let\ge=\geq
659 \let\owns=\ni
660 \let\gets=\leftarrow
661 \let\to=\rightarrow
662 \let\hbar=\hslash
663 \def\cdots{\mathinner{\cdotp\mkern-1mu\cdotp\mkern-1mu\cdotp}}
664 \Umathchardef \ldotp = 2 \ordfam "2E
665 \def\ldots{\mathinner{\ldotp\mkern-1mu\ldotp\mkern-1mu\ldotp}}
666
667 % math and text kerns
668 \protected\def\leavevmode@ifvmode{\ifvmode\expandafter\indent\fi}
669 \protected\def\,{\ifmmode\mskip\thinmuskip\else
670 \leavevmode@ifvmode\kern.16667em\fi\relax}
671 \protected\def\>{\ifmmode\mskip\medmuskip\else
672 \leavevmode@ifvmode\kern.2222em\fi\relax}
673 \protected\def\;{\ifmmode\mskip\thickmuskip\else
674 \leavevmode@ifvmode\kern.2777em\fi\relax}
675 \protected\def\!{\ifmmode\mskip-\thinmuskip\else
676 \leavevmode@ifvmode\kern-.16667em\fi\relax}
677 \def\*{\discretionary{\thinspace\hbox{$\times$}}{}{}}
678
679 % text commands
680 \chardef\ss="00DF
681 \chardef\ae="00E6
682 \chardef\oe="0153
683 \chardef\o="00F8
684 \chardef\AE="00C6
685 \chardef\OE="0152
686 \chardef\O="00D8
687 \chardef\i="0131 \chardef\j="0237 % dotless letters
688 \chardef\aa="00E5
689 \chardef\l="0142
690 \chardef\L="0141
691 \chardef\AA="00C5
692 \protected\def\dag{\ifmmode{\dagger}\else\char"2020\fi}
693 \protected\def\ddag{\ifmmode{\ddagger}\else\char"2021\fi}
694 \chardef\S="00A7
695 \chardef\P"00B6
696 \chardef\copyright="00A9
697
698 % Primes. Patch on plain.tex, line 735--739
699 \newcount\c@primes% \c@primes=0
700 % If the quantity of primes were more than 4, use \nonUprim@s instead.
701 \newmuskip\betweenprimeskip
702 \betweenprimeskip=-2.7mu\relax
703 \def\after@prim@s{\ifcase\c@primes\or\prime\or\dprime\or\trprime\or\qprime%
704 \else\nonUprim@s\fi}
705 \def\nonUprim@s{\prime\loop\ifnum\c@primes>1 \advance\c@primes by -1%
706 \mskip\betweenprimeskip\prime\repeat}
707 \def\prim@s{\advance\c@primes by 1\futurelet\next\pr@m@s}
708 \def\pr@m@s{\ifx'\next\let\nxt\pr@@@s \else\ifx^\next\let\nxt\pr@@@t
709 \else\let\nxt\pr@@@f\fi\fi \nxt}
710 \def\pr@@@t#1#2{\after@prim@s#2\egroup}
711 \def\pr@@@f{\after@prim@s\egroup}
712 % The following command aims to avoid to use \dprime, \trprime, etc.
713 \def\unicodeprimesoff{\def\after@prim@s{\nonUprim@s}}
714
715 \catcode`\@=12
716 \tenrm
717 \endinput