-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-unicode-math-input.tex
182 lines (126 loc) · 3.88 KB
/
test-unicode-math-input.tex
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
%! TEX program = pdflatex
\documentclass{article}
\usepackage{amsmath}
%\usepackage{amssymb}
\usepackage{bm}
\usepackage{hyperref}
\usepackage{iftex}
\usepackage{newtxmath}
\newif\ifonehalfPredefined
\onehalfPredefinedtrue
\newif\iftimesPredefined
\timesPredefinedtrue
\ifTUTeX
\usepackage{fancyvrb}
\usepackage{fontspec}
\else
\ifcsname u8:\detokenize{½}\endcsname
\else
\onehalfPredefinedfalse % in older LaTeX versions ½ is not defined in text mode
\fi
\ifcsname u8:\detokenize{×}\endcsname
\else
\timesPredefinedfalse % in older LaTeX versions ½ is not defined in text mode
\fi
\fi
\tracinglostchars=3
\usepackage{l3benchmark}
\csname benchmark_tic:\endcsname
\usepackage[ignore-patch-prime]{unicode-math-input}
\csname benchmark_toc:\endcsname % exclude the time to process AtBeginDocument, but because hyperref takes time AtBeginDocument too
\begin{document}
\csname sys_if_engine_pdftex:TF\endcsname{\iftrue}{\iffalse}
\else
\newfontfamily{\mymono}{Liberation Mono}[NFSSFamily=LiberationMono]
\fvset{fontfamily=LiberationMono}
The $α$ and $β$ must be in mono font instead of math font below:
\begin{Verbatim}
1+α=β
\end{Verbatim}
\fi
$a\overbrace{a}b$
\ifdefined\dprime
$a^{\prime\prime}$ is worse than $a^{\dprime}$
\fi
$a‵$ is $a^{\backprime}$
$a‶$ is the same as $a‵‵$
$a‶‵‶$ is the same as $a‵‵‵‵‵$
$a`$ is not $a^{\backprime}$ without unicode-math
use not:
$\not\leftarrow, x_{\not\leftarrow}$
$\not\exists, x_{\not\exists}$
$\not\equiv, x_{\not\equiv}$
$\not\cong, x_{\not\cong}$
\begin{align*}
\alpha + \beta &= \gamma \\
α + β &= γ \\
× & ±
\end{align*}
use built-in:
$\nleftarrow, x_{\nleftarrow}$
$\nexists, x_{\nexists}$
%$\nequiv, x_{\nequiv}$
$\ncong, x_{\ncong}$
use unicode characters: $∄ \quad x ≢ y \quad ⊭$
circ: $\circ$ / $ℤ ℝ ½ ∘ ↚ □$
\newcommand\test{123}
\section{a \iftimesPredefined ×\fi b = \texorpdfstring{$a × b$}{a \iftimesPredefined ×\fi b} Ü \"U \test}
$\left\uparrow \frac{1}{2} \right\downarrow$
\expandafter\def\csname u8:↑\endcsname{\uparrow}
\expandafter\def\csname u8:↓\endcsname{\downarrow}
$\Big{↑} \frac{1}{2} \Big{↓}$
\ifonehalfPredefined
a ½ b
\fi
\[ a = ½ + {\textstyle \frac{1}{2}} + \frac{3}{4} \]
$G'^{34}$
$G'^\bgroup34\egroup$
\umiPatchPrime
% the definition of TeX is somewhat interesting to make the above correct
% (or happens to be correct)
Type with ASCII gives $a''$, $a''''$ and $a'''''$.
default fraction: \[½\]
\let\umiFrac\tfrac
patched fraction: \[½\]
%$G^2'$ % cannot work
$G¹²³₄₅₆$
\[\int¹²³₄₅₆ x\,dx\]
\[∫¹²³₄₅₆ x\,dx\]
$G²'$
multiplication: \iftimesPredefined a × b\fi, $a × b$
prime: $a′$, $b″$
bracket: $⟨a+b⟩, \left⟨ \frac{1}{2} \right⟩ $
\umiPatchCmdUnicodeTwoArgs \frac
$\frac αβ$
\umiUnpatchCmdUnicodeArg \frac
Big: $\Big\langle 5 \Big\rangle$
\umiUnpatchCmdUnicodeArg \Big
\umiPatchCmdUnicodeArgExtraGroup \Big
Big: $\Big\langle 5 \Big\rangle$
$\Big( \Big) \Big\{ \Big\} \Big< \Big>$
Bigl/r: $\Bigl⟨ 5 \Bigr⟩$
\umiUnpatchCmdUnicodeArg \Big
Bigl/r: $\Bigl\langle 5 \Bigr\rangle$
$√2 + √{23^{45}} + ∛{78a}$
Test umiDeclareMathChar (with \# token):
\umiDeclareMathChar {'} {\def\test#1{ab#1ef}\test{cd}}%
\umiDeclareMathChar {↑} {\def\test#1{ab#1ef}\test{cd}}%
$'=↑$
\tableofcontents
{\setbox0\vbox{
\nonstopmode
\errorcontextlines=10
\umiDeclareMathChar {12} {34} % if is Unicode engine this will raise error, otherwise it's not checked
\errmessage{Expected "Redefining this special character..."}
\umiDeclareMathChar {&} {34} % will raise an error
\errmessage{^}
\errmessage{Expected "...already patched..."}
\umiPatchPrime % error: already patched
\errmessage{^}
\umiUnpatchPrime % success
\errmessage{Expected "...not patched..."}
\umiUnpatchPrime % error: not patched
\errmessage{^}
\errorstopmode
}} % throw away the box to avoid \tracinglostchars giving fatal error
\end{document}