Debian Codegraph @

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

raw
1 %% The document of unimath-plain-xetex
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 \overfullrule0pt
10 \def\mainfontname{Latin Modern Roman}
11 \def\sansfontname{Latin Modern Sans}
12 \def\monofontname{Latin Modern Mono}
13 \def\mathfontname{Latin Modern Math}
14 \def\textfontopt{mapping=tex-text,}
15 \input unimath-plain-xetex
16
17 \unicodeprimesoff
18 \betweenprimeskip=-1mu\relax
19
20 \def\xetex{X\kern-.125em\lower.5ex\hbox{\char"018E}\kern-.1667em%
21 T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX}
22 \let\XeTeX\xetex
23 \let\tex\TeX
24 \def\latex{L\kern-.24em{\setbox0=\hbox{T}\vbox to \ht0{\hbox{\sevenrm A}\vss}}%
25 \kern-.12em\TeX}
26 \def\umpx{unimath-plain-\xetex}
27 \def\biggskip{\vskip24pt plus 8pt minus 4pt}
28 \def\pkg#1{{\tensf #1}}
29 \font\hugesans="\sansfontname" at 35pt
30 \font\Hugesansbf="\sansfontname/B" at 72pt
31 \font\sevenlmmath="Latin Modern Math:script=math,+ssty=0" at 7pt
32 \makefontcmdcompatible{ten}
33
34 \font\manfnt="manfnt" at 10pt
35 \def\dbend{{\manfnt\char127}}
36 \def\ddanger{\noindent\hangindent=32pt\hangafter=-2
37 \hbox to 0pt{\hss\dbend\kern1pt\dbend\kern3pt}}
38 \def\ttverbatim{\begingroup
39 \catcode`\\=12 \catcode`\{=12 \catcode`\}=12 \catcode`\$=12
40 \catcode`\&=12 \catcode`\#=12 \catcode`\%=12 \catcode`\~=12
41 \catcode`\_=12 \catcode`\^=12 \catcode`\ =12 \obeylines \tentt}
42 \outer\def\begintt{$$\let\par=\endgraf \ttverbatim \parskip=0pt
43 \catcode`\|=0 \rightskip-2pc \ttfinish}
44 {\catcode`\|=0 |catcode`|\=12 % | is temporary escape character
45 |obeylines % end of line is active
46 |gdef|ttfinish#1^^M#2\endtt{#1|vbox{#2}|endgroup$$}}
47 \def\charhex{\char"}
48 \catcode`\"=\active
49 {\obeylines \gdef"{\ttverbatim \spaceskip.5em \let^^M=\ \let"=\endgroup}}
50 \def\<#1>{$\langle${\it#1\/}$\rangle$}
51
52 \long\def\scalehbox#1#2#3{%
53 \leavevmode
54 \setbox0\hbox{{#3}}%
55 \setbox1\hbox{%
56 \special{pdf:btrans}%
57 \special{x:scale #1 #2}%
58 \hbox to 0pt{\copy0\hss}%
59 \special{pdf:etrans}%
60 }%
61 \ht1#2\ht0
62 \dp1#2\dp0
63 \hbox to#1\wd0{\box1\kern#1\wd0\hss}%
64 }
65 \long\def\colorspec#1#2#3#4{\special{color push rgb #1 #2 #3}#4
66 \special{color pop}}
67 \def\green{\colorspec{0.08}{0.52}{0.08}}
68
69 \newdimen\paperwd
70 \newdimen\paperht
71 \newdimen\hmarginwd
72 \newdimen\vmarginht
73 \hsize=12cm
74 \vsize=16cm
75 \hmarginwd=3cm
76 \vmarginht=3cm
77 \hoffset=\dimexpr\hmarginwd-1in\relax
78 \voffset=\dimexpr\vmarginht-1in\relax
79 \paperwd=\dimexpr2\hmarginwd+\hsize\relax
80 \paperht=\dimexpr2\vmarginht+\vsize\relax
81 \special{papersize=\the\paperwd,\the\paperht}
82 \headline={\ifnum\pageno=1\hss\else\hss\vbox to 0pt{\vss\hbox to 0pt{\kern28pt%
83 \colorspec{0.72}{0.88}{0.72}{\Hugesansbf\folio}\hss}\kern4pt}\fi}
84 \footline={\hss}
85 \long\def\protectedwrite#1#2{\edef\wrt{\write#1{#2}}\wrt}
86
87 \newcount\secno
88 \secno=0
89 \newwrite\tocout
90 \edef\tocname{\jobname.toc}
91 \openout\tocout=\tocname
92 \newread\tocin
93 \openin\tocin=\tocname
94 \long\outer\def\section#1{\par\bigskip\penalty-1000%
95 \noindent \advance\secno by 1\relax
96 {\green{%
97 \twelvebf\hbox to 0pt{\hss\twentybf\the\secno\kern12pt}#1%
98 }}%
99 \protectedwrite\tocout{\the\secno\quad
100 #1\hskip.5em\leaders\hbox to 1.2em{.\hss}\hfill}%
101 \write\tocout{\hbox to .5em{\hss\the\pageno}\par}%
102 \par\medskip\penalty1000\relax}
103 \parindent=2pc
104 \parskip=3pt plus 2pt minus 1pt\relax
105
106 % title
107 \centerline{\twentyrm\green{The
108 \scalehbox{0.5}{0.5}{\special{pdf:code q 1 Tr}%
109 {\hugesans\umpx}%
110 \special{pdf:code Q}} package}}
111 \biggskip
112
113 \centerline{Zhang Tingxuan}
114 \medskip
115
116 \centerline{2024/10/08\quad Version 0.2c}
117 \biggskip
118
119 \begingroup\parskip0pt
120 \centerline{\bf Abstract}
121 \smallskip
122 \leftskip=4pc\rightskip=4pc\parindent=1.5pc\relax
123 The {\sf\umpx} package provides OpenType math font support in
124 {\it plain \tex\/} format. The {\sf\umpx} package needs \xetex.\par
125
126 % TOC
127 \bigskip
128 \centerline{\bf Contents}
129 \smallskip
130 \parindent=0pt\relax
131 \ifeof\tocin\else\closein\tocin\input\tocname\fi
132 \endgroup\bigskip
133
134
135 \section{How to use this package?}
136 Please notice again that you're using {\it plain\/} format but not
137 \latex\ format. If you are using \latex\ format, please use
138 \pkg{unicode-math} package instead.
139
140 In your document, write
141 \begintt
142 \input unimath-plain-xetex
143 \endtt
144 Then compile your document with "xetex", you can get OpenType math support
145 in your document. The package will set the math font ``Latin Modern Math''
146 with ``Latin Modern'' text fonts in default. To change the font, you can
147 define some names before loading the package. For example,
148 \begintt
149 \def\mainfontname{TeX Gyre Termes}
150 \def\sansfontname{TeX Gyre Heros}
151 \def\monofontname{TeX Gyre Cursors}
152 \def\mathfontname{TeX Gyre Termes Math}
153 \input unimath-plain-xetex
154 \endtt
155 Your text fonts will be set in the first 3 lines and your math font will
156 be set in the fourth line.
157
158 Currently, the package supports only font family names to use, if
159 you want to use the file names, you can revise the code in
160 "unimath-plain-xetex.tex".
161
162
163
164 \section{Text font commands}
165 The package provides text font commands in the format of
166 $$\hbox{"\"\<pt-size>\<family>\<series>\<shape>}$$
167 such as "\tensfbfit", "\twelvebf", etc. The packages provides
168 font commands in size of 5\,pt, 7\,pt, 9\,pt, 10\,pt, 12\,pt and 20\,pt,
169 such as "\fiverm", "\sevensf", "\twelvett", etc.
170
171 Take ten point as an example,
172 $$\begingroup\let\tentt\seventt%
173 \vbox{\openup-1pt\halign{#\hfil&\ \ #\hfil&\ \ #\hfil\cr
174 \green{\sevenrm(Serif)} & {\sevenrm Upright} & {\sevenit Italic} \cr
175 {\sevenrm Medium}& "\tenrm" & "\tenit" \cr
176 {\sevenbf Bold} & "\tenbf" & "\tenbfit" \cr}}\ \vrule\ \
177 \vbox{\openup-1pt\halign{#\hfil&\ \ #\hfil&\ \ #\hfil\cr
178 \green{\sevensf(Sans)} & {\sevensf Upright} & {\sevensfit Italic} \cr
179 {\sevensf Medium} & "\tensf" & "\tensfit" \cr
180 {\sevensfbf Bold} & "\tensfbf" & "\tensfbfit" \cr}}\ \vrule\ \
181 \vbox{\openup-1pt\halign{#\hfil&\ \ #\hfil&\ \ #\hfil\cr
182 \green{\seventt(Mono)} & {\seventt Upright} & {\seventtit Italic} \cr
183 {\seventt Medium} & "\tentt" & "\tenttit" \cr
184 {\seventtbf Bold} & "\tenttbf" & "\tenttbfit" \cr}}
185 \endgroup$$
186 The font commands can be used as those provided in "plain.tex", for example,
187 "{\tenbfit ABC}" yields {\tenbfit ABC}.
188
189 But if you would't like to remember that many commands, you can write
190 $$\hbox{\tentt"\makefontcmdcompatible"\{\<pt-size>\}}$$
191 after loading the package. For example, if you write
192 \begintt
193 \makefontcmdcompatible{ten}
194 \endtt
195 the \<family>-\<series>-\<shape> order of "\ten"\<some> commands
196 can be write randomly: writing "\tenbfsfit" is the same as "\tensfbfit".
197
198 You can also get more text font commands through the "\genfontcmd" command:
199 $$\hbox{\tentt"\genfontcmd"\{\<pt-size>\}\{\<dimension>\}}$$
200 For example,
201 \begintt
202 \genfontcmd{fortyfour}{44pt}
203 \genfontcmd{verytiny}{2bp}
204 \endtt
205 will make commands like "\fortyfourrm" and "\verytinysfbfit" available.
206
207
208
209 \section{Math font commands}
210 You can input math formulae just like using traditional plain \tex. But
211 OpenType math font is loaded. For example, "$a{\mbf0}={\mbf0}$" yields
212 $a{\mbf0}={\mbf0}$. Available math font commands are listed below:
213 \begintt
214 \mrm, \mbf, \mit, \msf, \mtt,
215 \mbfit, \msfbf, \msfit, \msfbfit,
216 \cal, \calbf, \bb, \bbit, \frak, \frakbf
217 \endtt
218 The \<family>-\<series>-\<shape> order of these commands allows being random;
219 "cal" can be replaced by "scr".
220
221 \ddanger{\bf Please notice,} that the commands in the first and second
222 line of the chart above contain an extra ``"m"'' in the beginning of commands.
223 For example, the first ``"m"'' in the ``"\mrm"'' command in the first line.
224 If you didn't write the ``"m"'' in these commands, the font selected by the
225 commands would be no more math font, but text font.
226
227 The ``math font'' we said here means the font selected by "\mathfontname",
228 "\mathalphafontname" and so on; the ``text font'' means the font selected by
229 "\mainfontname", "\sansfontname" and "\monofontname". For example,
230 $$\vbox{\openup3pt\halign{#\hfil&\qquad#\hfil\cr
231 {\tenit Input}&{\tenit yields}\cr
232 "$\mit abcdefg \mbfit hijklmn$" &
233 $\mit abcdefg \mbfit hijklmn$\cr
234 "$\it abcdefg \bfit hijklmn$" &
235 $\it abcdefg \bfit hijklmn$\cr
236 "$\msfit abcdefg \msfbfit hijklmn$" &
237 $\msfit abcdefg \msfbfit hijklmn$\cr
238 "$\sfit abcdefg \sfbfit hijklmn$" &
239 $\sfit abcdefg \sfbfit hijklmn$\cr}}$$
240 A group of symbols in math font can be regarded as separate symbols, and
241 a group of symbols in text font can be regarded as a whole.
242
243 This package uses "unicode-math-symbols.tex" to generate math symbol commands,
244 the source file can be found in \pkg{unicode-math} (\latex) package. To find
245 all of the math symbol commands, you can execute
246 \begintt
247 texdoc unimath-symbols
248 \endtt
249 in Terminal.
250
251 You can also input Unicode math characters in your document's source file.
252 For example,
253 $$\vbox{\openup3pt\halign{#\hfil&\qquad#\hfil\cr
254 {\tenit Input}&{\tenit yields}\cr
255 "$ ∑_{i=0}^∞ ∫_a^b ρ_i \, {\rm d} τ' $" &
256 $∑_{i=0}^∞ ∫_a^b ρ_i\,{\rm d}τ'$\cr
257 "$$∑_{i=0}^∞ ∫_a^b ρ_i \, {\rm d} τ'$$" &
258 $\displaystyle ∑_{i=0}^∞ ∫_a^b ρ_i\,{\rm d}τ'$\cr}}$$
259
260
261
262 \section{Primes ($'$)}
263 The package changed ``"'"'' command in math mode, which yields prime(s)
264 in superscript. After loading this package, the primes produced by ``"'"''
265 will be turned into Unicode primes:
266 $$\vbox{\openup2pt\halign{#\hfil\quad&\quad#\hfil\quad&\quad#\hfil\cr
267 {\tenit Input} & {\tenit yields} & {\tenit Unicode slot}\cr
268 "$'$" & $^{\hbox{\sevenlmmath\charhex2032}}$ & U+2032 \cr
269 "$''$" & $^{\hbox{\sevenlmmath\charhex2033}}$ & U+2033 \cr
270 "$'''$" & $^{\hbox{\sevenlmmath\charhex2034}}$ & U+2034 \cr
271 "$''''$" & $^{\hbox{\sevenlmmath\charhex2057}}$ & U+2057 \cr
272 "$'''''$" & $^{\hbox{\sevenlmmath\charhex2032
273 \hskip-.15em\charhex2032
274 \hskip-.15em\charhex2032
275 \hskip-.15em\charhex2032
276 \hskip-.15em\charhex2032}}$
277 & $(\hbox{U+2032})\times5$\cr
278 $\vdots$ & $\vdots$ & $\vdots$ \cr
279 $(\hbox{"'"})\times N$ & $(^{\hbox{\sevenlmmath\charhex2032}})\times N$ &
280 $(\hbox{U+2032})\times N$\hbox to 20pt{\quad$(N>4)$\hss} \cr
281 }}$$
282 However, some OpenType math fonts don't contain some of the characters above.
283 For example, there is no U+2032, U+2033 or U+2034 in Erewhon Math.
284 When using such fonts, you can ``turn off'' the Unicode primes easily
285 by inputing the following line {\it after} loading the package:
286 \begintt
287 \unicodeprimesoff
288 \endtt
289 Then when you input ``"'"'' $n$ times you will get $n$ primes,
290 and each prime's Unicode character slot is U+2032, even when $n\leq 4$.
291
292 If the primes contain more than one single prime encoded U+2032,
293 a negative math skip will inserted between every two single primes.
294 This math skip is defined as "\betweenprimeskip" and its default value
295 is "-2.7mu", which is proper for Latin Modern Math. To change the value
296 of "\betweenprimeskip" is just like change any math skip, for example,
297 \begintt
298 \betweenprimeskip=-1mu
299 \endtt
300 This line should also be written {\it after} loading the package.
301
302 \section{Using multiple math fonts}
303 You can use more than one OpenType math fonts in math mode.
304 This is the method to set multiple math fonts:
305 $$\vbox{%
306 \hbox{"\def\mathalphafontname{"\<font family name>"}"}%
307 \hbox{"\def\mathdelimiterfontname{"\<font family name>"}"}%
308 \hbox{"\def\mathordfontname{"\<font family name>"}"}%
309 \hbox{"\def\mathopfontname{"\<font family name>"}"}%
310 \hbox{"\def\mathbinfontname{"\<font family name>"}"}%
311 \hbox{"\def\mathaccentfontname{"\<font family name>"}"}%
312 }$$
313 Such definitions should be written {\tenit before} "\input"ing the package.
314 For example,
315 \begintt
316 \def\mathfontname{XITS Math}
317 \def\mathalphafontname{TeX Gyre Pagella Math}
318 \input unimath-plain-xetex
319 \endtt
320 Then your math font will be set as XITS Math and the font of variable family
321 (numbers, Latin and Greek letters) will be set as \TeX\ Gyre Pagella Math.
322
323 "\mathalphafontname" will influence the font of numbers ("0"--"9"), Latin
324 letters ("A"--"Z", "a"--"z") and Greek letters ("\alpha" and so on).
325
326 "\mathdelimiterfontname" will influence the font of math delimiters,
327 for example, extensible open symbols, close symbols and ordinary symbols
328 like "\{", "\}", "\vert" and so on.
329 Horizontal delimiters (or very long accents) are also influenced by
330 "\mathdelimiterfontname".
331
332 "\mathordfontname" will influence the font of non-delimiter ordinary
333 symbols, punctuations and ``"!"''. For example, ``","'', ``":"'' and
334 "\colon"'s font will be influenced by it.
335
336 "\mathopfontname" will influence the font of large operators like "\sum".
337
338 "\mathbinfontname" will influence the font of binary operators and relations
339 like ``"+"'' and ``"="''.
340
341 "\mathaccentfontname" will influence the font of math accents like "\dot".
342
343
344
345 \closeout\tocout
346 \bye