| 1 |
% This is part of the OpTeX project, see http://petr.olsak.net/optex |
| 2 |
|
| 3 |
\_codedecl \sin {Math macros plus mathchardefs <2026-03-18>} % preloaded in format |
| 4 |
|
| 5 |
\_doc ----------------------------- |
| 6 |
The category code of the character `_` remains as the letter (11) and the mathcode |
| 7 |
of it is `"8000`. |
| 8 |
It means that it is an active character in math mode. It is defined as the subscript prefix. |
| 9 |
|
| 10 |
There is a problem: The `x_n` is tokenized as `x`, `_`, `n` and it works |
| 11 |
without problems. But `\int``_a^b` is tokenized as `\int``_a`, `^`, `b`. The |
| 12 |
control sequence `\int``_a` isn't defined. We must write `\int _a^b`. |
| 13 |
|
| 14 |
The Lua code presented here solves this problem. But you cannot set your own |
| 15 |
control sequence in the form `\<word>_` or `\<word>_<one-letter>` (where |
| 16 |
<word> is a sequence of letters) because such control sequences are |
| 17 |
inaccessible: preprocessor rewrites it. |
| 18 |
|
| 19 |
The \`\mathsbon` macro activates the rewriting rule `\<word>_<nonleter>` to |
| 20 |
`\<word> _<nonletter>` and |
| 21 |
`\<word>``_<letter><nonletter>` to `\<word> _<letter><nonletter>` at input |
| 22 |
processor level. The \`\mathsboff` deactivates it. |
| 23 |
You can ask by \`\_ifmathsb` if this feature is activated or deactivated. |
| 24 |
By default, it is activated in the `\everyjob`, see section~\ref[init]. |
| 25 |
Note, that the `\everyjob` is processed after the first line of the document is |
| 26 |
read, so the \^`\mathsbon` is activated from the second line of the document. |
| 27 |
\_cod ----------------------------- |
| 28 |
|
| 29 |
\catcode`\_ = 8 \let\sb = _ |
| 30 |
\catcode`\_ = 13 \let _ = \sb |
| 31 |
\catcode`\_ = 11 |
| 32 |
\_private \sb ; |
| 33 |
|
| 34 |
\_newifi\_ifmathsb \_mathsbfalse |
| 35 |
\_def \_mathsbon {% |
| 36 |
\_ifmathsb \_else \_directlua{ |
| 37 |
callback.add_to_callback("process_input_buffer", |
| 38 |
function (str) |
| 39 |
local num |
| 40 |
str, num = string.gsub(str.." ", \_gsubrule) |
| 41 |
if num>0 then str = string.gsub(str, \_gsubrule) end % \phi_i\rho_j -> \phi _i\rho _j |
| 42 |
return str |
| 43 |
end, "_mathsb") }\_fi |
| 44 |
\_global\_mathsbtrue |
| 45 |
} |
| 46 |
\_def \_mathsboff {% |
| 47 |
\_ifmathsb \_directlua{ callback.remove_from_callback("process_input_buffer", "_mathsb") }\_fi |
| 48 |
\_global \_mathsbfalse |
| 49 |
} |
| 50 |
\_edef\_gsubrule{"(\_nbb[a-zA-Z]+)_([a-zA-Z]?[^_a-zA-Z])", "\_pcent 1 _\_pcent 2"} |
| 51 |
|
| 52 |
\_public \mathsboff \mathsbon ; |
| 53 |
|
| 54 |
\_doc ----------------------------- |
| 55 |
All mathcodes are set to equal values as in plain\TeX/. |
| 56 |
But all encoding-dependent declarations (like these) will be set |
| 57 |
to different values when a Unicode-math font is used. |
| 58 |
\_cod ----------------------------- |
| 59 |
|
| 60 |
\_mathcode`\^^@="2201 % \cdot |
| 61 |
\_mathcode`\^^A="3223 % \downarrow |
| 62 |
\_mathcode`\^^B="010B % \alpha |
| 63 |
\_mathcode`\^^C="010C % \beta |
| 64 |
\_mathcode`\^^D="225E % \land |
| 65 |
\_mathcode`\^^E="023A % \lnot |
| 66 |
\_mathcode`\^^F="3232 % \in |
| 67 |
\_mathcode`\^^G="0119 % \pi |
| 68 |
\_mathcode`\^^H="0115 % \lambda |
| 69 |
\_mathcode`\^^I="010D % \gamma |
| 70 |
\_mathcode`\^^J="010E % \delta |
| 71 |
\_mathcode`\^^K="3222 % \uparrow |
| 72 |
\_mathcode`\^^L="2206 % \pm |
| 73 |
\_mathcode`\^^M="2208 % \oplus |
| 74 |
\_mathcode`\^^N="0231 % \infty |
| 75 |
\_mathcode`\^^O="0140 % \partial |
| 76 |
\_mathcode`\^^P="321A % \subset |
| 77 |
\_mathcode`\^^Q="321B % \supset |
| 78 |
\_mathcode`\^^R="225C % \cap |
| 79 |
\_mathcode`\^^S="225B % \cup |
| 80 |
\_mathcode`\^^T="0238 % \forall |
| 81 |
\_mathcode`\^^U="0239 % \exists |
| 82 |
\_mathcode`\^^V="220A % \otimes |
| 83 |
\_mathcode`\^^W="3224 % \leftrightarrow |
| 84 |
\_mathcode`\^^X="3220 % \leftarrow |
| 85 |
\_mathcode`\^^Y="3221 % \rightarrow |
| 86 |
\_mathcode`\^^Z="8000 % \ne |
| 87 |
\_mathcode`\^^[="2205 % \diamond |
| 88 |
\_mathcode`\^^\="3214 % \le |
| 89 |
\_mathcode`\^^]="3215 % \ge |
| 90 |
\_mathcode`\^^^="3211 % \equiv |
| 91 |
\_mathcode`\^^_="225F % \lor |
| 92 |
\_mathcode`\ ="8000 % \space |
| 93 |
\_mathcode`\!="5021 |
| 94 |
\_mathcode`\'="8000 % ^\prime |
| 95 |
\_mathcode`\(="4028 |
| 96 |
\_mathcode`\)="5029 |
| 97 |
\_mathcode`\*="2203 % \ast |
| 98 |
\_mathcode`\+="202B |
| 99 |
\_mathcode`\,="613B |
| 100 |
\_mathcode`\-="2200 |
| 101 |
\_mathcode`\.="013A |
| 102 |
\_mathcode`\/="013D |
| 103 |
\_mathcode`\:="303A |
| 104 |
\_mathcode`\;="603B |
| 105 |
\_mathcode`\<="313C |
| 106 |
\_mathcode`\=="303D |
| 107 |
\_mathcode`\>="313E |
| 108 |
\_mathcode`\?="503F |
| 109 |
\_mathcode`\[="405B |
| 110 |
\_mathcode`\\="026E % \backslash |
| 111 |
\_mathcode`\]="505D |
| 112 |
\_mathcode`\_="8000 % math-active subscript |
| 113 |
\_mathcode`\{="4266 |
| 114 |
\_mathcode`\|="026A |
| 115 |
\_mathcode`\}="5267 |
| 116 |
\_mathcode`\^^?="1273 % \smallint |
| 117 |
|
| 118 |
\_delcode`\(="028300 |
| 119 |
\_delcode`\)="029301 |
| 120 |
\_delcode`\[="05B302 |
| 121 |
\_delcode`\]="05D303 |
| 122 |
\_delcode`\<="26830A |
| 123 |
\_delcode`\>="26930B |
| 124 |
\_delcode`\/="02F30E |
| 125 |
\_delcode`\|="26A30C |
| 126 |
\_delcode`\\="26E30F |
| 127 |
|
| 128 |
\_doc ----------------------------- |
| 129 |
All control sequences declared by `\mathchardef` are supposed (by default) |
| 130 |
only for public usage. It means that they are declared without `_` prefix. |
| 131 |
If such sequences are used in internal \OpTeX/ macro then their internal |
| 132 |
prefixed form is declared using `\_private` macro.\nl |
| 133 |
These encoding dependent declarations will be set to different values |
| 134 |
when Unicode-math font is loaded.\nl |
| 135 |
The declared sequences for math symbols are not hyperlinked in this documentation. |
| 136 |
\maxlines=15 |
| 137 |
\_cod ----------------------------- |
| 138 |
|
| 139 |
\_mathchardef\alpha="010B |
| 140 |
\_mathchardef\beta="010C |
| 141 |
\_mathchardef\gamma="010D |
| 142 |
\_mathchardef\delta="010E |
| 143 |
\_mathchardef\epsilon="010F |
| 144 |
\_mathchardef\zeta="0110 |
| 145 |
\_mathchardef\eta="0111 |
| 146 |
\_mathchardef\theta="0112 |
| 147 |
\_mathchardef\iota="0113 |
| 148 |
\_mathchardef\kappa="0114 |
| 149 |
\_mathchardef\lambda="0115 |
| 150 |
\_mathchardef\mu="0116 |
| 151 |
\_mathchardef\nu="0117 |
| 152 |
\_mathchardef\xi="0118 |
| 153 |
\_mathchardef\pi="0119 |
| 154 |
\_mathchardef\rho="011A |
| 155 |
\_mathchardef\sigma="011B |
| 156 |
\_mathchardef\tau="011C |
| 157 |
\_mathchardef\upsilon="011D |
| 158 |
\_mathchardef\phi="011E |
| 159 |
\_mathchardef\chi="011F |
| 160 |
\_mathchardef\psi="0120 |
| 161 |
\_mathchardef\omega="0121 |
| 162 |
\_mathchardef\varepsilon="0122 |
| 163 |
\_mathchardef\vartheta="0123 |
| 164 |
\_mathchardef\varpi="0124 |
| 165 |
\_mathchardef\varrho="0125 |
| 166 |
\_mathchardef\varsigma="0126 |
| 167 |
\_mathchardef\varphi="0127 |
| 168 |
\_mathchardef\Gamma="7000 |
| 169 |
\_mathchardef\Delta="7001 |
| 170 |
\_mathchardef\Theta="7002 |
| 171 |
\_mathchardef\Lambda="7003 |
| 172 |
\_mathchardef\Xi="7004 |
| 173 |
\_mathchardef\Pi="7005 |
| 174 |
\_mathchardef\Sigma="7006 |
| 175 |
\_mathchardef\Upsilon="7007 |
| 176 |
\_mathchardef\Phi="7008 |
| 177 |
\_mathchardef\Psi="7009 |
| 178 |
\_mathchardef\Omega="700A |
| 179 |
|
| 180 |
\_mathchardef\aleph="0240 |
| 181 |
\_mathchardef\imath="017B |
| 182 |
\_mathchardef\jmath="017C |
| 183 |
\_mathchardef\ell="0160 |
| 184 |
\_mathchardef\wp="017D |
| 185 |
\_mathchardef\Re="023C |
| 186 |
\_mathchardef\Im="023D |
| 187 |
\_mathchardef\partial="0140 |
| 188 |
\_mathchardef\infty="0231 |
| 189 |
\_mathchardef\prime="0230 |
| 190 |
\_mathchardef\emptyset="023B |
| 191 |
\_mathchardef\nabla="0272 |
| 192 |
\_protected\_def \surd{{\_mathchar"1270}} |
| 193 |
\_mathchardef\top="023E |
| 194 |
\_mathchardef\bot="023F |
| 195 |
\_mathchardef\triangle="0234 |
| 196 |
\_mathchardef\forall="0238 |
| 197 |
\_mathchardef\exists="0239 |
| 198 |
\_mathchardef\neg="023A \_let\lnot=\neg |
| 199 |
\_mathchardef\flat="015B |
| 200 |
\_mathchardef\natural="015C |
| 201 |
\_mathchardef\sharp="015D |
| 202 |
\_mathchardef\clubsuit="027C |
| 203 |
\_mathchardef\diamondsuit="027D |
| 204 |
\_mathchardef\heartsuit="027E |
| 205 |
\_mathchardef\spadesuit="027F |
| 206 |
|
| 207 |
\_mathchardef\coprod="1360 |
| 208 |
\_mathchardef\bigvee="1357 |
| 209 |
\_mathchardef\bigwedge="1356 |
| 210 |
\_mathchardef\biguplus="1355 |
| 211 |
\_mathchardef\bigcap="1354 |
| 212 |
\_mathchardef\bigcup="1353 |
| 213 |
\_mathchardef\intop="1352 |
| 214 |
\_protected\_def \int{\_intop\_nolimits} \_private \intop; |
| 215 |
\_mathchardef\prod="1351 |
| 216 |
\_mathchardef\sum="1350 |
| 217 |
\_mathchardef\bigotimes="134E |
| 218 |
\_mathchardef\bigoplus="134C |
| 219 |
\_mathchardef\bigodot="134A |
| 220 |
\_mathchardef\ointop="1348 |
| 221 |
\_protected\_def\_oint {\_ointop\_nolimits} \_private \ointop; |
| 222 |
\_mathchardef\bigsqcup="1346 |
| 223 |
\_mathchardef\smallint="1273 |
| 224 |
|
| 225 |
\_mathchardef\triangleleft="212F \_private \triangleleft; |
| 226 |
\_mathchardef\triangleright="212E \_private \triangleright; |
| 227 |
\_mathchardef\bigtriangleup="2234 |
| 228 |
\_mathchardef\bigtriangledown="2235 |
| 229 |
\_mathchardef\wedge="225E \let\land=\wedge |
| 230 |
\_mathchardef\vee="225F \let\lor=\vee |
| 231 |
\_mathchardef\cap="225C |
| 232 |
\_mathchardef\cup="225B |
| 233 |
\_mathchardef\ddagger="227A |
| 234 |
\_mathchardef\dagger="2279 |
| 235 |
\_mathchardef\sqcap="2275 |
| 236 |
\_mathchardef\sqcup="2274 |
| 237 |
\_mathchardef\uplus="225D |
| 238 |
\_mathchardef\amalg="2271 |
| 239 |
\_mathchardef\diamond="2205 |
| 240 |
\_mathchardef\bullet="220F \_private \bullet; |
| 241 |
\_mathchardef\wr="226F |
| 242 |
\_mathchardef\div="2204 |
| 243 |
\_mathchardef\odot="220C |
| 244 |
\_mathchardef\oslash="220B |
| 245 |
\_mathchardef\otimes="220A |
| 246 |
\_mathchardef\ominus="2209 |
| 247 |
\_mathchardef\oplus="2208 |
| 248 |
\_mathchardef\mp="2207 |
| 249 |
\_mathchardef\pm="2206 |
| 250 |
\_mathchardef\circ="220E |
| 251 |
\_mathchardef\bigcirc="220D |
| 252 |
\_mathchardef\setminus="226E % for set difference A\setminus B |
| 253 |
\_mathchardef\cdot="2201 |
| 254 |
\_mathchardef\ast="2203 |
| 255 |
\_mathchardef\times="2202 |
| 256 |
\_mathchardef\star="213F |
| 257 |
|
| 258 |
\_mathchardef\propto="322F |
| 259 |
\_mathchardef\sqsubseteq="3276 |
| 260 |
\_mathchardef\sqsupseteq="3277 |
| 261 |
\_mathchardef\parallel="326B |
| 262 |
\_mathchardef\mid="326A |
| 263 |
\_mathchardef\dashv="3261 |
| 264 |
\_mathchardef\vdash="3260 |
| 265 |
\_mathchardef\nearrow="3225 |
| 266 |
\_mathchardef\searrow="3226 |
| 267 |
\_mathchardef\nwarrow="322D |
| 268 |
\_mathchardef\swarrow="322E |
| 269 |
\_mathchardef\Leftrightarrow="322C |
| 270 |
\_mathchardef\Leftarrow="3228 |
| 271 |
\_mathchardef\Rightarrow="3229 |
| 272 |
\_protected\_def \neq{\_not=} \_let\ne=\neq |
| 273 |
\_mathchardef\leq="3214 \let\le=\leq |
| 274 |
\_mathchardef\geq="3215 \let\ge=\geq |
| 275 |
\_mathchardef\succ="321F |
| 276 |
\_mathchardef\prec="321E |
| 277 |
\_mathchardef\approx="3219 |
| 278 |
\_mathchardef\succeq="3217 |
| 279 |
\_mathchardef\preceq="3216 |
| 280 |
\_mathchardef\supset="321B |
| 281 |
\_mathchardef\subset="321A |
| 282 |
\_mathchardef\supseteq="3213 |
| 283 |
\_mathchardef\subseteq="3212 |
| 284 |
\_mathchardef\in="3232 |
| 285 |
\_mathchardef\ni="3233 \let\owns=\ni |
| 286 |
\_mathchardef\gg="321D |
| 287 |
\_mathchardef\ll="321C |
| 288 |
% \_mathchardef\not="3236 % defined below |
| 289 |
\_mathchardef\leftrightarrow="3224 |
| 290 |
\_mathchardef\leftarrow="3220 \_let\gets=\leftarrow |
| 291 |
\_mathchardef\rightarrow="3221 \_let\to=\rightarrow |
| 292 |
\_mathchardef\mapstochar="3237 |
| 293 |
\_protected\_def\mapsto{\_mapstochar\_rightarrow} \_private \mapstochar \rightarrow ; |
| 294 |
\_mathchardef\sim="3218 |
| 295 |
\_mathchardef\simeq="3227 |
| 296 |
\_mathchardef\perp="323F |
| 297 |
\_mathchardef\equiv="3211 |
| 298 |
\_mathchardef\asymp="3210 |
| 299 |
\_mathchardef\smile="315E |
| 300 |
\_mathchardef\frown="315F |
| 301 |
\_mathchardef\leftharpoonup="3128 |
| 302 |
\_mathchardef\leftharpoondown="3129 |
| 303 |
\_mathchardef\rightharpoonup="312A |
| 304 |
\_mathchardef\rightharpoondown="312B |
| 305 |
|
| 306 |
\_doc ----------------------------- |
| 307 |
The math functions like log, sin, cos are declared in the same way as in |
| 308 |
plain\TeX/, but they are `\protected` in \OpTeX/. |
| 309 |
\_cod ----------------------------- |
| 310 |
|
| 311 |
\_protected\_def\log {\_mathop{\_rm log}\_nolimits} |
| 312 |
\_protected\_def\lg {\_mathop{\_rm lg}\_nolimits} |
| 313 |
\_protected\_def\ln {\_mathop{\_rm ln}\_nolimits} |
| 314 |
\_protected\_def\lim {\_mathop{\_rm lim}} |
| 315 |
\_protected\_def\limsup {\_mathop{\_rm lim\_thinsk sup}} |
| 316 |
\_protected\_def\liminf {\_mathop{\_rm lim\_thinsk inf}} |
| 317 |
\_protected\_def\sin {\_mathop{\_rm sin}\_nolimits} |
| 318 |
\_protected\_def\arcsin {\_mathop{\_rm arcsin}\_nolimits} |
| 319 |
\_protected\_def\sinh {\_mathop{\_rm sinh}\_nolimits} |
| 320 |
\_protected\_def\cos {\_mathop{\_rm cos}\_nolimits} |
| 321 |
\_protected\_def\arccos {\_mathop{\_rm arccos}\_nolimits} |
| 322 |
\_protected\_def\cosh {\_mathop{\_rm cosh}\_nolimits} |
| 323 |
\_protected\_def\tan {\_mathop{\_rm tan}\_nolimits} |
| 324 |
\_protected\_def\arctan {\_mathop{\_rm arctan}\_nolimits} |
| 325 |
\_protected\_def\tanh {\_mathop{\_rm tanh}\_nolimits} |
| 326 |
\_protected\_def\cot {\_mathop{\_rm cot}\_nolimits} |
| 327 |
\_protected\_def\coth {\_mathop{\_rm coth}\_nolimits} |
| 328 |
%\_protected\_def\sec {\_mathop{\_rm sec}\_nolimits} % \sec is section |
| 329 |
\_protected\_def\secant {\_mathop{\_rm sec}\_nolimits} |
| 330 |
\_protected\_def\csc {\_mathop{\_rm csc}\_nolimits} |
| 331 |
\_protected\_def\max {\_mathop{\_rm max}} |
| 332 |
\_protected\_def\min {\_mathop{\_rm min}} |
| 333 |
\_protected\_def\sup {\_mathop{\_rm sup}} |
| 334 |
\_protected\_def\inf {\_mathop{\_rm inf}} |
| 335 |
\_protected\_def\arg {\_mathop{\_rm arg}\_nolimits} |
| 336 |
\_protected\_def\ker {\_mathop{\_rm ker}\_nolimits} |
| 337 |
\_protected\_def\dim {\_mathop{\_rm dim}\_nolimits} |
| 338 |
\_protected\_def\hom {\_mathop{\_rm hom}\_nolimits} |
| 339 |
\_protected\_def\det {\_mathop{\_rm det}} |
| 340 |
\_protected\_def\exp {\_mathop{\_rm exp}\_nolimits} |
| 341 |
\_protected\_def\Pr {\_mathop{\_rm Pr}} |
| 342 |
\_protected\_def\gcd {\_mathop{\_rm gcd}} |
| 343 |
\_protected\_def\deg {\_mathop{\_rm deg}\_nolimits} |
| 344 |
|
| 345 |
\_doc ----------------------------- |
| 346 |
These macros are defined similarly as in plain\TeX. Only internal macro |
| 347 |
names from plain\TeX/ with `@` character are re-written in a more readable |
| 348 |
form.\nl |
| 349 |
\`\sp` is an alternative for `^`. The \`\sb` alternative for `_` was defined |
| 350 |
at line 27 of the file `math-macros.opm`.\nl |
| 351 |
\`\_thinsk`, \`\_medsk`, \`\_thicksk` and \`\_thinneg` should be used |
| 352 |
instead `\,`, `\>`, `\;` and `\!` in macros because a user can re-define |
| 353 |
these single-letter sequences. |
| 354 |
\_cod ----------------------------- |
| 355 |
|
| 356 |
\_let\_sp=^ \public \sp ; |
| 357 |
% \sb=_ , defined at beginning of this file |
| 358 |
|
| 359 |
\_def\_thinsk {\_mskip\_thinmuskip} |
| 360 |
\_protected\_def\,{\_relax\_ifmmode \_thinsk \_else \_thinspace \_fi} |
| 361 |
\_protected\_def\>{\_mskip\_medmuskip} \let\_medsk = \> |
| 362 |
\_protected\_def\;{\_mskip\_thickmuskip} \let\_thicksk = \; |
| 363 |
\_protected\_def\!{\_mskip-\_thinmuskip} \let\_thinneg = \! |
| 364 |
%\_def\*{\discretionary{\thinspace\the\textfont2\char2}{}{}} % obsolete |
| 365 |
|
| 366 |
\_doc ----------------------------- |
| 367 |
Active \`\prime` character is defined here. |
| 368 |
\_cod ----------------------------- |
| 369 |
|
| 370 |
{\_catcode`\'=\active \_gdef'{^\_bgroup\_primes}} % primes dance |
| 371 |
\_def\_primes{\_prime\_isnextchar'{\_primesA}% |
| 372 |
{\_isnextchar^{\_primesB}{\_egroup}}} |
| 373 |
\_def\_primesA #1{\_primes} |
| 374 |
\_def\_primesB #1#2{#2\_egroup} |
| 375 |
\_private \prime ; |
| 376 |
|
| 377 |
\_doc ----------------------------- |
| 378 |
\`\big`, \`\bbig`, \`\Big`, \`\bBig`, \`\bigg`, \`\Bigg`, |
| 379 |
\`\bigl`, \`\bigm`, \`\bigr`, \`\bbigl`, \`\bbigm`, \`\bbigr`, \`\bBigl`, \`\Bigl`, |
| 380 |
\`\Bigm`, \`\bBigm`, \`\Bigr`, \`\bBigr`, \`\biggl`, \`\biggm`, \`\biggr`, \`\Biggl`, |
| 381 |
\`\Biggm`, \`\Biggr` |
| 382 |
are based on the \`\_scalebig``<fence><num>;` macro because we need the dependency on |
| 383 |
the various sizes of the fonts. |
| 384 |
The \`\_scalebigcoef``<num>` returns relevant coefficient for these |
| 385 |
macros. Multiply this coefficient by two and you get the strut |
| 386 |
height+depth in em units. If the <num> is bigger than 6 then the next |
| 387 |
parameter is used directly, for example `\def\morebig#1{\_scalebig{#1}7{1.8}}`\nl |
| 388 |
The \^`\big`, \^`\Big`, \^`\bigg`, \^`\Bigg` macros keep the strut height+depth |
| 389 |
from plain \TeX/ and \^`\bbig` is a new macro in \OpTeX/. It generates the size |
| 390 |
1.44\,em between \^`\big` and \^`\Big` which is |
| 391 |
accessible in most of Unicode math fonts (but not in classical `cmex10`). |
| 392 |
\_cod ----------------------------- |
| 393 |
|
| 394 |
%{\catcode`\^^Z=\active \gdef^^Z{\not=}} % ^^Z is like \ne in math %obsolete |
| 395 |
|
| 396 |
\_def\_scalebig#1#2#3{{\_left#1% |
| 397 |
\_raise\_Umathaxis\_textstyle\_vbox to\_scalebigcoef{#2}{#3}\_fontdimen6\_textfont1{}% |
| 398 |
\_kern-\_nulldelimiterspace\_right.}} |
| 399 |
\_def\_scalebigcoef#1#2{\_ifcase #1 0\_or |
| 400 |
% \big (1.22) \bbig (1.44) \Big (1.8) \Bibg (2.1) \bigg (2.4) \Bigg (3.0) % \_scalebig7{scale} |
| 401 |
.62\_or .72\_or .9\_or 1.05\or 1.2\_or 1.5\_else #2\_fi} |
| 402 |
\_protected\_def\_big #1{\_scalebig{#1}1;} |
| 403 |
\_protected\_def\_bbig#1{\_scalebig{#1}2;} |
| 404 |
\_protected\_def\_Big #1{\_scalebig{#1}3;} |
| 405 |
\_protected\_def\_bBig#1{\_scalebig{#1}4;} |
| 406 |
\_protected\_def\_bigg#1{\_scalebig{#1}5;} |
| 407 |
\_protected\_def\_Bigg#1{\_scalebig{#1}6;} |
| 408 |
\_public \big \bbig \Big \bBig \bigg \Bigg ; % only \big \Big \bigg \Bigg in original plain TeX |
| 409 |
|
| 410 |
\_protected\_def\_bigl{\_mathopen\_big} |
| 411 |
\_protected\_def\_bigm{\_mathrel\_big} |
| 412 |
\_protected\_def\_bigr{\_mathclose\_big} |
| 413 |
\_protected\_def\_bbigl{\_mathopen\_bbig} |
| 414 |
\_protected\_def\_bbigm{\_mathrel\_bbig} |
| 415 |
\_protected\_def\_bbigr{\_mathclose\_bbig} |
| 416 |
\_protected\_def\_Bigl{\_mathopen\_Big} |
| 417 |
\_protected\_def\_bBigl{\_mathopen\_bBig} |
| 418 |
\_protected\_def\_Bigm{\_mathrel\_Big} |
| 419 |
\_protected\_def\_bBigm{\_mathrel\_bBig} |
| 420 |
\_protected\_def\_Bigr{\_mathclose\_Big} |
| 421 |
\_protected\_def\_bBigr{\_mathclose\_bBig} |
| 422 |
\_protected\_def\_biggl{\_mathopen\_bigg} |
| 423 |
\_protected\_def\_biggm{\_mathrel\_bigg} |
| 424 |
\_protected\_def\_biggr{\_mathclose\_bigg} |
| 425 |
\_protected\_def\_Biggl{\_mathopen\_Bigg} |
| 426 |
\_protected\_def\_Biggm{\_mathrel\_Bigg} |
| 427 |
\_protected\_def\_Biggr{\_mathclose\_Bigg} |
| 428 |
\_public \bigl \bigm \bigr \bbigl \bbigm \bbigr |
| 429 |
\Bigl \Bigm \Bigr \bBigl \bBigm \bBigr \biggl \biggm \biggr \Biggl \Biggm \Biggr ; |
| 430 |
|
| 431 |
\_doc ----------------------------- |
| 432 |
Math relations defined by the \`\jointrel` plain \TeX/ macro: |
| 433 |
\_cod ----------------------------- |
| 434 |
|
| 435 |
\_protected\_def\_joinrel{\_mathrel{\_mkern-2.5mu}} % -3mu in plainTeX |
| 436 |
\_protected\_def\relbar{\_mathrel{\_smash-}} % \_smash, because - has the same height as + |
| 437 |
\_protected\_def\Relbar{\_mathrel=} |
| 438 |
\_mathchardef\lhook="312C |
| 439 |
\_protected\_def\hookrightarrow{\_lhook\_joinrel\_rightarrow} |
| 440 |
\_mathchardef\rhook="312D |
| 441 |
\_protected\_def\hookleftarrow{\_leftarrow\_joinrel\_rhook} |
| 442 |
\_protected\_def\bowtie{\_mathrel\_triangleright\_joinrel\_mathrel\_triangleleft} |
| 443 |
\_protected\_def\models{\_mathrel|\_joinrel=} |
| 444 |
\_protected\_def\Longrightarrow{\_Relbar\_joinrel\_Rightarrow} |
| 445 |
\_protected\_def\longrightarrow{\_relbar\_joinrel\_rightarrow} |
| 446 |
\_protected\_def\longleftarrow{\_leftarrow\_joinrel\_relbar} |
| 447 |
\_protected\_def\Longleftarrow{\_Leftarrow\_joinrel\_Relbar} |
| 448 |
\_protected\_def\longmapsto{\_mapstochar\_longrightarrow} |
| 449 |
\_protected\_def\longleftrightarrow{\_leftarrow\_joinrel\_rightarrow} |
| 450 |
\_protected\_def\Longleftrightarrow{\_Leftarrow\_joinrel\_Rightarrow} |
| 451 |
\_protected\_def\iff{\_thicksk\_Longleftrightarrow\_thicksk} |
| 452 |
\_private \lhook \rightarrow \leftarrow \rhook \triangleright \triangleleft |
| 453 |
\Relbar \Rightarrow \relbar \rightarrow \Leftarrow \mapstochar |
| 454 |
\longrightarrow \Longleftrightarrow ; |
| 455 |
\_public \joinrel ; |
| 456 |
|
| 457 |
\_doc ----------------------------- |
| 458 |
\`\ldots`, \`\cdots`, \`\vdots`, \`\ddots` from plain \TeX/ |
| 459 |
\_cod ----------------------------- |
| 460 |
|
| 461 |
\_mathchardef\_ldotp="613A % ldot as a punctuation mark |
| 462 |
\_mathchardef\_cdotp="6201 % cdot as a punctuation mark |
| 463 |
\_mathchardef\_colon="603A % colon as a punctuation mark |
| 464 |
\_public \ldotp \cdotp \colon ; |
| 465 |
|
| 466 |
\_protected\_def\_ldots{\_mathinner{\_ldotp\_ldotp\_ldotp}} |
| 467 |
\_protected\_def\_cdots{\_mathinner{\_cdotp\_cdotp\_cdotp}} |
| 468 |
\_protected\_def\_vdots{\_vbox{\_baselineskip=.4em \_lineskiplimit=\_zo |
| 469 |
\_kern.6em \_hbox{.}\_hbox{.}\_hbox{.}}} |
| 470 |
\_protected\_def\_ddots{\_mathinner{% |
| 471 |
\_mkern1mu\_raise.7em\_vbox{\_kern.7em\_hbox{.}}\_mkern2mu |
| 472 |
\_raise.4em\_hbox{.}\_mkern2mu\_raise.1em\_hbox{.}\_mkern1mu}} |
| 473 |
|
| 474 |
\_public \ldots \cdots \vdots \ddots ; |
| 475 |
|
| 476 |
\_doc ----------------------------- |
| 477 |
\`\adots` inspired by plain \TeX/ |
| 478 |
\_cod ----------------------------- |
| 479 |
|
| 480 |
\_protected\_def\_adots{\_mathinner{% |
| 481 |
\_mkern1mu\_raise.1em\_hbox{.}\_mkern2mu |
| 482 |
\_raise.4em\_hbox{.}\_mkern2mu\_raise.7em\_vbox{\_kern.7em\_hbox{.}}\_mkern1mu}} |
| 483 |
|
| 484 |
\_public \adots ; |
| 485 |
|
| 486 |
\_doc ----------------------------- |
| 487 |
Math accents (encoding dependent declarations). |
| 488 |
\_cod ----------------------------- |
| 489 |
|
| 490 |
\_protected\_def\acute{\_mathaccent"7013 } |
| 491 |
\_protected\_def\grave{\_mathaccent"7012 } |
| 492 |
\_protected\_def\ddot{\_mathaccent"707F } |
| 493 |
\_protected\_def\tilde{\_mathaccent"707E } |
| 494 |
\_protected\_def\bar{\_mathaccent"7016 } |
| 495 |
\_protected\_def\breve{\_mathaccent"7015 } |
| 496 |
\_protected\_def\check{\_mathaccent"7014 } |
| 497 |
\_protected\_def\hat{\_mathaccent"705E } |
| 498 |
\_protected\_def\vec{\_mathaccent"017E } |
| 499 |
\_protected\_def\dot{\_mathaccent"705F } |
| 500 |
\_protected\_def\widetilde{\_mathaccent"0365 } |
| 501 |
\_protected\_def\widehat{\_mathaccent"0362 } |
| 502 |
|
| 503 |
\_doc ----------------------------- |
| 504 |
\`\_math`, \`\skew`, |
| 505 |
\`\overrightarrow`, \`\overleftarrow`, \`\overbrace`, \`\underbrace` macros. |
| 506 |
The last four are redefined when Unicode math is loaded. |
| 507 |
\_cod ----------------------------- |
| 508 |
|
| 509 |
\_def\_math{\_mathsurround\_zo} |
| 510 |
\_protected\_def\_skew #1#2#3{{\_muskip0=#1mu\_divide\_muskip0by2 \_mkern\_muskip0 |
| 511 |
#2{\_mkern-\_muskip0{#3}\_mkern\_muskip0}\_mkern-\_muskip0}{}} |
| 512 |
\_protected\_def\_overrightarrow #1{\_vbox{\_math\_ialign{##\_crcr |
| 513 |
\_rightarrowfill\_crcr\_noalign{\_kern-.1em \_nointerlineskip} |
| 514 |
$\_hfil\_displaystyle{#1}\_hfil$\_crcr}}} |
| 515 |
\_protected\_def\_overleftarrow #1{\_vbox{\_math\_ialign{##\_crcr |
| 516 |
\_leftarrowfill\_crcr\_noalign{\_kern-.1em \_nointerlineskip} |
| 517 |
$\_hfil\_displaystyle{#1}\_hfil$\_crcr}}} |
| 518 |
\_protected\_def\_overbrace #1{\_mathop{% |
| 519 |
\_vbox{\_math\_ialign{##\_crcr\_noalign{\_kern.3em} |
| 520 |
\_downbracefill\_crcr\_noalign{\_kern.3em \_nointerlineskip} |
| 521 |
$\_hfil\_displaystyle{#1}\_hfil$\_crcr}}}\_limits} |
| 522 |
\_protected\_def\_underbrace #1{\_mathop{\_vtop{\_math\_ialign{##\_crcr |
| 523 |
$\_hfil\_displaystyle{#1}\_hfil$\_crcr\_noalign{\_kern.3em \_nointerlineskip} |
| 524 |
\_upbracefill\_crcr\_noalign{\_kern.3em}}}}\_limits} |
| 525 |
|
| 526 |
\_public \overrightarrow \overleftarrow \overbrace \underbrace \skew ; |
| 527 |
|
| 528 |
\_doc ----------------------------- |
| 529 |
Macros based on `\delimiter`, `\*witdelims` and `\radical` primitives. |
| 530 |
\_cod ----------------------------- |
| 531 |
|
| 532 |
\_protected\_def\lmoustache{\_delimiter"437A340 } % top from (, bottom from ) |
| 533 |
\_protected\_def\rmoustache{\_delimiter"537B341 } % top from ), bottom from ( |
| 534 |
\_protected\_def\lgroup{\_delimiter"462833A } % extensible ( with sharper tips |
| 535 |
\_protected\_def\rgroup{\_delimiter"562933B } % extensible ) with sharper tips |
| 536 |
\_protected\_def\arrowvert{\_delimiter"26A33C } % arrow without arrowheads |
| 537 |
\_protected\_def\Arrowvert{\_delimiter"26B33D } % double arrow without arrowheads |
| 538 |
\_protected\_def\bracevert{\_delimiter"77C33E } % the vertical bar that extends braces |
| 539 |
\_protected\_def\Vert{\_delimiter"26B30D } \_let\|=\Vert |
| 540 |
\_protected\_def\vert{\_delimiter"26A30C } |
| 541 |
\_protected\_def\uparrow{\_delimiter"3222378 } |
| 542 |
\_protected\_def\downarrow{\_delimiter"3223379 } |
| 543 |
\_protected\_def\updownarrow{\_delimiter"326C33F } |
| 544 |
\_protected\_def\Uparrow{\_delimiter"322A37E } |
| 545 |
\_protected\_def\Downarrow{\_delimiter"322B37F } |
| 546 |
\_protected\_def\Updownarrow{\_delimiter"326D377 } |
| 547 |
\_protected\_def\backslash{\_delimiter"26E30F } % for double coset G\_backslash H |
| 548 |
\_protected\_def\langle{\_delimiter"426830A } |
| 549 |
\_protected\_def\rangle{\_delimiter"526930B } |
| 550 |
\_protected\_def\lbrace{\_delimiter"4266308 } \_let\_lbrace=\lbrace |
| 551 |
\_protected\_def\rbrace{\_delimiter"5267309 } \_let\_rbrace=\rbrace |
| 552 |
\_protected\_def\{{\_ifmmode \_lbrace\_else\_char`\{ \_fi} |
| 553 |
\_protected\_def\}{\_ifmmode \_rbrace\_else\_char`\} \_fi} |
| 554 |
|
| 555 |
\_protected\_def\rceil{\_delimiter"5265307 } |
| 556 |
\_protected\_def\lceil{\_delimiter"4264306 } |
| 557 |
\_protected\_def\rfloor{\_delimiter"5263305 } |
| 558 |
\_protected\_def\lfloor{\_delimiter"4262304 } |
| 559 |
|
| 560 |
\_protected\_def\choose{\_atopwithdelims()} |
| 561 |
\_protected\_def\brack{\_atopwithdelims[]} |
| 562 |
\_protected\_def\brace{\_atopwithdelims\_lbrace\_rbrace} |
| 563 |
|
| 564 |
\_protected\_def\_sqrt{\_radical"270370 } \_public \sqrt ; |
| 565 |
|
| 566 |
\_doc ----------------------------- |
| 567 |
\`\mathpalette`, \`\vphantom`, \`\hphantom`, \`\phantom`, \`\mathstrut`, and |
| 568 |
\`\smash` macros from plain \TeX. |
| 569 |
\_cod ----------------------------- |
| 570 |
|
| 571 |
\_def\_mathpalette#1#2{\_mathchoice{#1\_displaystyle{#2}}% |
| 572 |
{#1\_textstyle{#2}}{#1\_scriptstyle{#2}}{#1\_scriptscriptstyle{#2}}} |
| 573 |
\_newbox\_rootbox |
| 574 |
\_protected\_def\root#1\of{\_setbox\_rootbox |
| 575 |
\_hbox{$\_math\_scriptscriptstyle{#1}$}\_mathpalette\_rootA} |
| 576 |
\_def\_rootA#1#2{\_setbox0=\_hbox{$\_math#1\_sqrt{#2}$}\_dimen0=\_ht0 |
| 577 |
\_advance\_dimen0by-\_dp0 |
| 578 |
\_mkern5mu\_raise.6\_dimen0\_copy\_rootbox \_mkern-10mu\_box0 } |
| 579 |
\_newifi\_ifvp \_newifi\_ifhp |
| 580 |
\_protected\_def\_vphantom{\_vptrue\_hpfalse\_phant} |
| 581 |
\_protected\_def\_hphantom{\_vpfalse\_hptrue\_phant} |
| 582 |
\_protected\_def\_phantom{\_vptrue\_hptrue\_phant} |
| 583 |
\_def\_phant{\_ifmmode\_def\_next{\_mathpalette\_mathphant}% |
| 584 |
\_else\_let\_next=\_makephant\_fi\_next} |
| 585 |
\_def\_makephant#1{\_setbox0\_hbox{#1}\_finphant} |
| 586 |
\_def\_mathphant#1#2{\_setbox0=\_hbox{$\_math#1{#2}$}\_finphant} |
| 587 |
\_def\_finphant{\_setbox2=\_null |
| 588 |
\_ifvp \_ht2=\_ht0 \_dp2=\_dp0 \_fi |
| 589 |
\_ifhp \_wd2=\_wd0 \_fi \_hbox{\_box2}} |
| 590 |
\_def\_mathstrut{\_vphantom(} |
| 591 |
\_protected\_def\_smash{\_relax % \_relax, in case this comes first in \halign |
| 592 |
\_ifmmode\_def\_next{\_mathpalette\_mathsmash}\_else\_let\_next\_makesmash |
| 593 |
\_fi\_next} |
| 594 |
\_def\_makesmash#1{\_setbox0=\_hbox{#1}\_finsmash} |
| 595 |
\_def\_mathsmash#1#2{\_setbox0=\_hbox{$\_math#1{#2}$}\_finsmash} |
| 596 |
\_def\_finsmash{\_ht0=\_zo \_dp0=\_zo \_hbox{\_box0}} |
| 597 |
\_public \mathpalette \vphantom \hphantom \phantom \mathstrut \smash ; |
| 598 |
|
| 599 |
\_doc ----------------------------- |
| 600 |
\`\cong`, \`\notin`, \`\rightleftharpoons`, \`\buildrel`, \`\doteq`, \`\bmod` |
| 601 |
and \`\pmod` macros from plain \TeX/. |
| 602 |
\_cod ----------------------------- |
| 603 |
|
| 604 |
\_protected\_def\_cong{\_mathrel{\_mathpalette\_overeq\_sim}} % congruence sign |
| 605 |
\_def\_overeq#1#2{\_lower.05em\_vbox{\_lineskiplimit\_maxdimen\_lineskip=-.05em |
| 606 |
\_ialign{$\_math#1\_hfil##\_hfil$\_crcr#2\_crcr=\_crcr}}} |
| 607 |
\_protected\_def\_notin{\_mathrel{\_mathpalette\_icancel\_in}} |
| 608 |
\_def\_icancel#1#2{\_math\_ooalign{$\_hfil#1\_mkern1mu/\_hfil$\_crcr$#1#2$}} |
| 609 |
\_protected\_def\_rightleftharpoons{\_mathrel{\_mathpalette\_rlhp{}}} |
| 610 |
\_def\_rlhp#1{\_vcenter{\_math\_hbox{\_ooalign{\_raise.2em |
| 611 |
\_hbox{$#1\_rightharpoonup$}\_crcr |
| 612 |
$#1\_leftharpoondown$}}}} |
| 613 |
\_protected\_def\_buildrel#1\over#2{\_mathrel{\_mathop{\_kern\_zo #2}\_limits^{#1}}} |
| 614 |
\_protected\_def\_doteq{\_buildrel\_textstyle.\over=} |
| 615 |
\_private \in \sim ; |
| 616 |
\_public \cong \notin \rightleftharpoons \buildrel \doteq ; |
| 617 |
|
| 618 |
\_protected\_def\_bmod{\_nonscript\_mskip-\_medmuskip\_mkern5mu |
| 619 |
\_mathbin{\_rm mod}\_penalty900\_mkern5mu\_nonscript\_mskip-\_medmuskip} |
| 620 |
\_protected\_def\_pmod#1{\_allowbreak\_mkern18mu({\_rm mod}\_thinsk\_thinsk#1)} |
| 621 |
\_public \bmod \pmod ; |
| 622 |
|
| 623 |
\_doc ----------------------------- |
| 624 |
\`\matrix` and \`\pmatrix` |
| 625 |
behave as in Plain \TeX/, if it is used in the |
| 626 |
`\displaystyle`. On the other hand, it is printed in smaller size |
| 627 |
(by appropriate amount) in `\textstyle` = `\scriptstyle` and `\scriptscriptstyle`. |
| 628 |
This feature is new in \OpTeX/. |
| 629 |
\_cod ----------------------------- |
| 630 |
|
| 631 |
\_protected\_def\_matrix#1{\_null\_thinsk |
| 632 |
\_edef\_tmpa{\_the\_numexpr \_mathstyle/4\_relax}% 0 0 1 1 1 1 2 2 |
| 633 |
\_vcenter{\_matrixbaselines\_math |
| 634 |
\_ialign{\_the\_lmfil$\_matrixstyle##$\_hfil&&\_quad\_the\_lmfil$\_matrixstyle##$\_hfil\_crcr |
| 635 |
\_mathstrut\_crcr\_noalign{\_kern-\_baselineskip} |
| 636 |
#1\_crcr\_mathstrut\_crcr\_noalign{\_kern-\_baselineskip}}}\_thinsk} |
| 637 |
|
| 638 |
\_def\_matrixbaselines{\_normalbaselines \_def\_matrixstyle{}% |
| 639 |
\_let\_matrixbaselines=\_relax % \matrix inside matrix does not change size again |
| 640 |
\_ifcase\_tmpa \_or |
| 641 |
\_baselineskip=.7\_baselineskip \_def\_quad {\_hskip.7em\_relax}% |
| 642 |
\_let\_matrixstyle=\_scriptstyle |
| 643 |
\_or |
| 644 |
\_baselineskip=.5\_baselineskip \_def\_quad {\_hskip.5em\_relax}% |
| 645 |
\_let\_matrixstyle=\_scriptscriptstyle |
| 646 |
\_fi |
| 647 |
} |
| 648 |
\_protected\_def\_pmatrix#1{\_left(\_matrix{#1}\_right)} |
| 649 |
|
| 650 |
\_public \matrix \pmatrix ; |
| 651 |
|
| 652 |
\_doc ----------------------------- |
| 653 |
The \`\cases` and \`\bordermatrix` macros are almost identical as in plain \TeX/. |
| 654 |
You can simply re-define `\bordermatrix` with other delimiters |
| 655 |
using the common \`\_bordermatrixwithdelims` macro. |
| 656 |
\_cod ----------------------------- |
| 657 |
|
| 658 |
\_protected\_long\_def\_cases#1{\_left\{\_thinsk\_vcenter{\_normalbaselines\_math |
| 659 |
\_ialign{$##\_hfil$&\_quad{##\_unsskip}\_hfil\_crcr#1\_crcr}}\_right.} |
| 660 |
|
| 661 |
\_newdimen\_ptrenwd |
| 662 |
\_ptrenwd=8.75pt % width of the big left ( |
| 663 |
\_protected\_def\_bordermatrix{\_bordermatrixwithdelims()} |
| 664 |
\_def\_bordermatrixwithdelims#1#2#3{\_begingroup \_math |
| 665 |
\_setbox0=\_vbox{\_bordermatrixA #3\_stopbmatrix}% |
| 666 |
\_setbox2=\_vbox{\_unvcopy0 \_global\_setbox1=\_lastbox}% |
| 667 |
\_setbox2=\_hbox{\_unhbox1 \_unskip\_global\_setbox1=\_lastbox}% |
| 668 |
\_setbox2=\_hbox{$\_kern\_wd1 \_kern-\_ptrenwd\_left#1\_kern-\_wd1 |
| 669 |
\_global\_setbox1=\_vbox{\_box1 \_kern.2em}% |
| 670 |
\_vcenter{\_kern-\_ht1 \_unvbox0 \_kern-\_baselineskip}\_thinsk\_right#2$}% |
| 671 |
\_null\_thicksk\_vbox{\_kern\_ht1 \_box2}\_endgroup} |
| 672 |
\_def\_bordermatrixA #1\cr#2\_stopbmatrix{% |
| 673 |
\_ialign{$##$\_hfil\_kern.2em\_kern\_ptrenwd&\_thinspace\_hfil$##$\_hfil |
| 674 |
&&\_quad\_hfil$##$\_hfil\_crcr |
| 675 |
\_omit\_strut\_hfil\_crcr\_noalign{\_kern-\_baselineskip}% |
| 676 |
#1\_crcr\_noalign{\_kern.2em}#2\_crcr\_omit\_strut\_cr}} |
| 677 |
|
| 678 |
\_public \cases \bordermatrix ; |
| 679 |
|
| 680 |
\_doc ----------------------------- |
| 681 |
The \`\eqalign` macro behaves like in Plain \TeX/ by default. |
| 682 |
It creates the `\vcenter` in the math mode. The content is two column |
| 683 |
`\halign` with right-aligned left column and left-aligned right column. |
| 684 |
The table items are in `\displaystyle` and the `\baselineskip` is |
| 685 |
advanced by `\jot` (3pt in plain \TeX). It follows from the default |
| 686 |
settings of \^`\eqlines` and \^`\eqstyle` parameters. |
| 687 |
|
| 688 |
In \OpTeX/, this macro is more flexible. See section 4.4 in the |
| 689 |
\ulink[http://petr.olsak.net/ftp/olsak/optex/optex-math.pdf] |
| 690 |
{Typesetting Math with \OpTeX/}. |
| 691 |
The `\baselineskip` value is set by the \^`\eqlines` parameter and math style |
| 692 |
by the \^`\eqstyle` parameter. |
| 693 |
|
| 694 |
There are more possible columns than two (used in classical Plain TeX): |
| 695 |
`rlcrlcrlc` etc.\ where `r` and `l` columns are without spaces and `c` column |
| 696 |
(if used) has space \^`\eqspace`/2 at its both sides. |
| 697 |
\_cod ----------------------------- |
| 698 |
|
| 699 |
\_long\_def\_eqalign#1{\_null\_thinsk\_vcenter{\_the\_eqlines\_math |
| 700 |
\_ialign{&\_hfil$\_the\_eqstyle{##}$&$\_the\_eqstyle{{}##}$\_hfil |
| 701 |
&\_hskip.5\_eqspace\_hfil$\_the\_eqstyle{##}$\_hskip.5\_eqspace\_hfil |
| 702 |
\_crcr#1\_crcr}}\_thinsk} |
| 703 |
|
| 704 |
\_public \eqalign ; |
| 705 |
|
| 706 |
\_doc ----------------------------- |
| 707 |
The \`\displaylines``{<formula>\cr<formula>\cr...<formula>}` |
| 708 |
creates horizontally centered formulae. |
| 709 |
It behaves exactly as in Plain \TeX/. The `\halign` is applied directly |
| 710 |
in the outer display environment with lines of type `\hbox to\displaywidth`. |
| 711 |
This enables to break lines inside such display to more pages but it is |
| 712 |
impossible to use `\eqno` or `\leqno` or \^`\eqmark`. |
| 713 |
|
| 714 |
\OpTeX/ offers |
| 715 |
`\displaylines to<dimen>{<formula>\cr<formula>\cr...<formula>}` |
| 716 |
as an alternative case of usage `\displaylines`. See section 4.3 in the |
| 717 |
\ulink[http://petr.olsak.net/ftp/olsak/optex/optex-math.pdf] |
| 718 |
{Typesetting Math with \OpTeX/}. |
| 719 |
The centered formulas are in `\vcenter` in this case, |
| 720 |
so lines cannot be broken into more pages, but this case |
| 721 |
enables to use `\eqno` or `\leqno` or \^`\eqmark`. |
| 722 |
\_cod ----------------------------- |
| 723 |
|
| 724 |
\_def\_displaylines #1#{\_ifx&\_ea\_displaylinesD |
| 725 |
\_else \_def\_tmp to##1\_end{\_def\_tmp{\_dimexpr ##1}}\_tmp #1\_end |
| 726 |
\_ea\_displaylinesto \_fi} |
| 727 |
\_long\_def\_displaylinesD #1{\_display \_tabskip=\_zoskip |
| 728 |
\_halign{\_hbox to\_displaywidth{$\_elign\_hfil\_displaystyle##\_hfil$}\_crcr |
| 729 |
#1\_crcr}} |
| 730 |
\_long\_def\_displaylinesto #1{\_vcenter{\_openup\_jot \_math \_tabskip=\_zoskip |
| 731 |
\_halign{\_strut\_hbox to\_span\_tmp{$\_hss\_displaystyle##\_hss$}\_crcr |
| 732 |
#1\_crcr}}} |
| 733 |
|
| 734 |
\_public\displaylines ; |
| 735 |
|
| 736 |
\_doc ----------------------------- |
| 737 |
\`\openup`, \`\eqalignno` and \`\leqalignno` macros are inspired from |
| 738 |
Plain \TeX/, but internal macros \`\_begeqanno`, \`\_eqnoright`, \`\_eqnoleft` |
| 739 |
are used to make the macros more economical. |
| 740 |
\_cod ----------------------------- |
| 741 |
|
| 742 |
\_def\_openup{\_afterassignment\_openupA\_dimen0=} |
| 743 |
\_def\_openupA{\_advance\_lineskip by\_dimen0 |
| 744 |
\_advance\_baselineskip by\_dimen0 |
| 745 |
\_advance\_lineskiplimit by\_dimen0 } |
| 746 |
\_newifi\_ifdtop |
| 747 |
\_def\_display{\_global\_dtoptrue\_openup\_jot\_math |
| 748 |
\_everycr{\_noalign{\_ifdtop \_global\_dtopfalse \_ifdim\_prevdepth>-1000pt |
| 749 |
\_vskip-\_lineskiplimit \_vskip\_normallineskiplimit \_fi |
| 750 |
\_else \_penalty\_interdisplaylinepenalty \_fi}}} |
| 751 |
\_def\_elign{\_tabskip=\_zoskip\_everycr{}} % restore inside \_display |
| 752 |
\_long\_def\_eqalignno#1{\_begeqanno &\_eqnoright{##}\_tabskip=\_zoskip\_crcr #1\_crcr\_egroup} |
| 753 |
\_long\_def\_leqalignno#1{\_begeqanno &\_eqnoleft{##}\_tabskip=\_zoskip\_crcr #1\_crcr\_egroup} |
| 754 |
\_def\_begeqanno{\_unless\_ifnum\_predisplaydirection=0 \_swapeqno\_fi |
| 755 |
\_display \_tabskip=\_centering |
| 756 |
\_halign to\_displaywidth\_bgroup\_hfil$\_elign\_displaystyle{##}$\_tabskip=\_zoskip |
| 757 |
&$\_elign\_displaystyle{{}##}$\_hfil\_tabskip\_centering} |
| 758 |
\_def\_eqnoright#1{\_hbox to\_zo{\_hss$\_elign#1$}} |
| 759 |
\_def\_eqnoleft #1{\_hbox to\_zo{\_kern-\_displaywidth$\_elign#1$\_hss}} |
| 760 |
|
| 761 |
\_public \openup \eqalignno \leqalignno ; |
| 762 |
|
| 763 |
\_doc ----------------------------- |
| 764 |
These macros are inspired by `ams-math.tex` file. |
| 765 |
\maxlines=15 |
| 766 |
\_cod ----------------------------- |
| 767 |
|
| 768 |
\_def\_amsafam{4} \_def\_amsbfam{5} |
| 769 |
|
| 770 |
\_mathchardef \boxdot "2\_amsafam 00 |
| 771 |
\_mathchardef \boxplus "2\_amsafam 01 |
| 772 |
\_mathchardef \boxtimes "2\_amsafam 02 |
| 773 |
\_mathchardef \square "0\_amsafam 03 |
| 774 |
\_mathchardef \blacksquare "0\_amsafam 04 |
| 775 |
\_mathchardef \centerdot "2\_amsafam 05 |
| 776 |
\_mathchardef \lozenge "0\_amsafam 06 |
| 777 |
\_mathchardef \blacklozenge "0\_amsafam 07 |
| 778 |
\_mathchardef \circlearrowright "3\_amsafam 08 |
| 779 |
\_mathchardef \circlearrowleft "3\_amsafam 09 |
| 780 |
\_mathchardef \rightleftharpoons "3\_amsafam 0A |
| 781 |
\_mathchardef \leftrightharpoons "3\_amsafam 0B |
| 782 |
\_mathchardef \boxminus "2\_amsafam 0C |
| 783 |
\_mathchardef \Vdash "3\_amsafam 0D |
| 784 |
\_mathchardef \Vvdash "3\_amsafam 0E |
| 785 |
\_mathchardef \vDash "3\_amsafam 0F |
| 786 |
\_mathchardef \twoheadrightarrow "3\_amsafam 10 |
| 787 |
\_mathchardef \twoheadleftarrow "3\_amsafam 11 |
| 788 |
\_mathchardef \leftleftarrows "3\_amsafam 12 |
| 789 |
\_mathchardef \rightrightarrows "3\_amsafam 13 |
| 790 |
\_mathchardef \upuparrows "3\_amsafam 14 |
| 791 |
\_mathchardef \downdownarrows "3\_amsafam 15 |
| 792 |
\_mathchardef \upharpoonright "3\_amsafam 16 |
| 793 |
\_mathchardef \downharpoonright "3\_amsafam 17 |
| 794 |
\_mathchardef \upharpoonleft "3\_amsafam 18 |
| 795 |
\_mathchardef \downharpoonleft "3\_amsafam 19 |
| 796 |
\_mathchardef \rightarrowtail "3\_amsafam 1A |
| 797 |
\_mathchardef \leftarrowtail "3\_amsafam 1B |
| 798 |
\_mathchardef \leftrightarrows "3\_amsafam 1C |
| 799 |
\_mathchardef \rightleftarrows "3\_amsafam 1D |
| 800 |
\_mathchardef \Lsh "3\_amsafam 1E |
| 801 |
\_mathchardef \Rsh "3\_amsafam 1F |
| 802 |
\_mathchardef \rightsquigarrow "3\_amsafam 20 |
| 803 |
\_mathchardef \leftrightsquigarrow "3\_amsafam 21 |
| 804 |
\_mathchardef \looparrowleft "3\_amsafam 22 |
| 805 |
\_mathchardef \looparrowright "3\_amsafam 23 |
| 806 |
\_mathchardef \circeq "3\_amsafam 24 |
| 807 |
\_mathchardef \succsim "3\_amsafam 25 |
| 808 |
\_mathchardef \gtrsim "3\_amsafam 26 |
| 809 |
\_mathchardef \gtrapprox "3\_amsafam 27 |
| 810 |
\_mathchardef \multimap "3\_amsafam 28 |
| 811 |
\_mathchardef \therefore "3\_amsafam 29 |
| 812 |
\_mathchardef \because "3\_amsafam 2A |
| 813 |
\_mathchardef \doteqdot "3\_amsafam 2B |
| 814 |
\_mathchardef \triangleq "3\_amsafam 2C |
| 815 |
\_mathchardef \precsim "3\_amsafam 2D |
| 816 |
\_mathchardef \lesssim "3\_amsafam 2E |
| 817 |
\_mathchardef \lessapprox "3\_amsafam 2F |
| 818 |
\_mathchardef \eqslantless "3\_amsafam 30 |
| 819 |
\_mathchardef \eqslantgtr "3\_amsafam 31 |
| 820 |
\_mathchardef \curlyeqprec "3\_amsafam 32 |
| 821 |
\_mathchardef \curlyeqsucc "3\_amsafam 33 |
| 822 |
\_mathchardef \preccurlyeq "3\_amsafam 34 |
| 823 |
\_mathchardef \leqq "3\_amsafam 35 |
| 824 |
\_mathchardef \leqslant "3\_amsafam 36 |
| 825 |
\_mathchardef \lessgtr "3\_amsafam 37 |
| 826 |
\_mathchardef \backprime "0\_amsafam 38 |
| 827 |
\_mathchardef \risingdotseq "3\_amsafam 3A |
| 828 |
\_mathchardef \fallingdotseq "3\_amsafam 3B |
| 829 |
\_mathchardef \succcurlyeq "3\_amsafam 3C |
| 830 |
\_mathchardef \geqq "3\_amsafam 3D |
| 831 |
\_mathchardef \geqslant "3\_amsafam 3E |
| 832 |
\_mathchardef \gtrless "3\_amsafam 3F |
| 833 |
\_mathchardef \sqsubset "3\_amsafam 40 |
| 834 |
\_mathchardef \sqsupset "3\_amsafam 41 |
| 835 |
\_mathchardef \vartriangleright "3\_amsafam 42 |
| 836 |
\_mathchardef \vartriangleleft "3\_amsafam 43 |
| 837 |
\_mathchardef \trianglerighteq "3\_amsafam 44 |
| 838 |
\_mathchardef \trianglelefteq "3\_amsafam 45 |
| 839 |
\_mathchardef \bigstar "0\_amsafam 46 |
| 840 |
\_mathchardef \between "3\_amsafam 47 |
| 841 |
\_mathchardef \blacktriangledown "0\_amsafam 48 |
| 842 |
\_mathchardef \blacktriangleright "3\_amsafam 49 |
| 843 |
\_mathchardef \blacktriangleleft "3\_amsafam 4A |
| 844 |
\_mathchardef \vartriangle "3\_amsafam 4D |
| 845 |
\_mathchardef \blacktriangle "0\_amsafam 4E |
| 846 |
\_mathchardef \triangledown "0\_amsafam 4F |
| 847 |
\_mathchardef \eqcirc "3\_amsafam 50 |
| 848 |
\_mathchardef \lesseqgtr "3\_amsafam 51 |
| 849 |
\_mathchardef \gtreqless "3\_amsafam 52 |
| 850 |
\_mathchardef \lesseqqgtr "3\_amsafam 53 |
| 851 |
\_mathchardef \gtreqqless "3\_amsafam 54 |
| 852 |
\_mathchardef \Rrightarrow "3\_amsafam 56 |
| 853 |
\_mathchardef \Lleftarrow "3\_amsafam 57 |
| 854 |
\_mathchardef \veebar "2\_amsafam 59 |
| 855 |
\_mathchardef \barwedge "2\_amsafam 5A |
| 856 |
\_mathchardef \doublebarwedge "2\_amsafam 5B |
| 857 |
\_mathchardef \angle "0\_amsafam 5C |
| 858 |
\_mathchardef \measuredangle "0\_amsafam 5D |
| 859 |
\_mathchardef \sphericalangle "0\_amsafam 5E |
| 860 |
\_mathchardef \varpropto "3\_amsafam 5F |
| 861 |
\_mathchardef \smallsmile "3\_amsafam 60 |
| 862 |
\_mathchardef \smallfrown "3\_amsafam 61 |
| 863 |
\_mathchardef \Subset "3\_amsafam 62 |
| 864 |
\_mathchardef \Supset "3\_amsafam 63 |
| 865 |
\_mathchardef \Cup "2\_amsafam 64 |
| 866 |
\_mathchardef \Cap "2\_amsafam 65 |
| 867 |
\_mathchardef \curlywedge "2\_amsafam 66 |
| 868 |
\_mathchardef \curlyvee "2\_amsafam 67 |
| 869 |
\_mathchardef \leftthreetimes "2\_amsafam 68 |
| 870 |
\_mathchardef \rightthreetimes "2\_amsafam 69 |
| 871 |
\_mathchardef \subseteqq "3\_amsafam 6A |
| 872 |
\_mathchardef \supseteqq "3\_amsafam 6B |
| 873 |
\_mathchardef \bumpeq "3\_amsafam 6C |
| 874 |
\_mathchardef \Bumpeq "3\_amsafam 6D |
| 875 |
\_mathchardef \lll "3\_amsafam 6E |
| 876 |
\_mathchardef \ggg "3\_amsafam 6F |
| 877 |
\_protected\_def \ulcorner {\_delimiter"4\_amsafam 70\_amsafam 70 } |
| 878 |
\_protected\_def \urcorner {\_delimiter"5\_amsafam 71\_amsafam 71 } |
| 879 |
\_mathchardef \circledS "0\_amsafam 73 |
| 880 |
\_mathchardef \pitchfork "3\_amsafam 74 |
| 881 |
\_mathchardef \dotplus "2\_amsafam 75 |
| 882 |
\_mathchardef \backsim "3\_amsafam 76 |
| 883 |
\_mathchardef \backsimeq "3\_amsafam 77 |
| 884 |
\_protected\_def \llcorner {\_delimiter"4\_amsafam 78\_amsafam 78 } |
| 885 |
\_protected\_def \lrcorner {\_delimiter"5\_amsafam 79\_amsafam 79 } |
| 886 |
\_mathchardef \complement "0\_amsafam 7B |
| 887 |
\_mathchardef \intercal "2\_amsafam 7C |
| 888 |
\_mathchardef \circledcirc "2\_amsafam 7D |
| 889 |
\_mathchardef \circledast "2\_amsafam 7E |
| 890 |
\_mathchardef \circleddash "2\_amsafam 7F |
| 891 |
\_mathchardef \rhd "2\_amsafam 42 |
| 892 |
\_mathchardef \lhd "2\_amsafam 43 |
| 893 |
\_mathchardef \unrhd "2\_amsafam 44 |
| 894 |
\_mathchardef \unlhd "2\_amsafam 45 |
| 895 |
|
| 896 |
\_let\restriction\upharpoonright |
| 897 |
\_let\Doteq\doteqdot |
| 898 |
\_let\doublecup\Cup |
| 899 |
\_let\doublecap\Cap |
| 900 |
\_let\llless\lll |
| 901 |
\_let\gggtr\ggg |
| 902 |
\_let\Box=\square % LaTeX symbol |
| 903 |
\_let\Box=\square % LaTeX symbol |
| 904 |
|
| 905 |
\_mathchardef \lvertneqq "3\_amsbfam 00 |
| 906 |
\_mathchardef \gvertneqq "3\_amsbfam 01 |
| 907 |
\_mathchardef \nleq "3\_amsbfam 02 |
| 908 |
\_mathchardef \ngeq "3\_amsbfam 03 |
| 909 |
\_mathchardef \nless "3\_amsbfam 04 |
| 910 |
\_mathchardef \ngtr "3\_amsbfam 05 |
| 911 |
\_mathchardef \nprec "3\_amsbfam 06 |
| 912 |
\_mathchardef \nsucc "3\_amsbfam 07 |
| 913 |
\_mathchardef \lneqq "3\_amsbfam 08 |
| 914 |
\_mathchardef \gneqq "3\_amsbfam 09 |
| 915 |
\_mathchardef \nleqslant "3\_amsbfam 0A |
| 916 |
\_mathchardef \ngeqslant "3\_amsbfam 0B |
| 917 |
\_mathchardef \lneq "3\_amsbfam 0C |
| 918 |
\_mathchardef \gneq "3\_amsbfam 0D |
| 919 |
\_mathchardef \npreceq "3\_amsbfam 0E |
| 920 |
\_mathchardef \nsucceq "3\_amsbfam 0F |
| 921 |
\_mathchardef \precnsim "3\_amsbfam 10 |
| 922 |
\_mathchardef \succnsim "3\_amsbfam 11 |
| 923 |
\_mathchardef \lnsim "3\_amsbfam 12 |
| 924 |
\_mathchardef \gnsim "3\_amsbfam 13 |
| 925 |
\_mathchardef \nleqq "3\_amsbfam 14 |
| 926 |
\_mathchardef \ngeqq "3\_amsbfam 15 |
| 927 |
\_mathchardef \precneqq "3\_amsbfam 16 |
| 928 |
\_mathchardef \succneqq "3\_amsbfam 17 |
| 929 |
\_mathchardef \precnapprox "3\_amsbfam 18 |
| 930 |
\_mathchardef \succnapprox "3\_amsbfam 19 |
| 931 |
\_mathchardef \lnapprox "3\_amsbfam 1A |
| 932 |
\_mathchardef \gnapprox "3\_amsbfam 1B |
| 933 |
\_mathchardef \nsim "3\_amsbfam 1C |
| 934 |
\_mathchardef \ncong "3\_amsbfam 1D |
| 935 |
\_mathchardef \diagup "0\_amsbfam 1E |
| 936 |
\_mathchardef \diagdown "0\_amsbfam 1F |
| 937 |
\_mathchardef \varsubsetneq "3\_amsbfam 20 |
| 938 |
\_mathchardef \varsupsetneq "3\_amsbfam 21 |
| 939 |
\_mathchardef \nsubseteqq "3\_amsbfam 22 |
| 940 |
\_mathchardef \nsupseteqq "3\_amsbfam 23 |
| 941 |
\_mathchardef \subsetneqq "3\_amsbfam 24 |
| 942 |
\_mathchardef \supsetneqq "3\_amsbfam 25 |
| 943 |
\_mathchardef \varsubsetneqq "3\_amsbfam 26 |
| 944 |
\_mathchardef \varsupsetneqq "3\_amsbfam 27 |
| 945 |
\_mathchardef \subsetneq "3\_amsbfam 28 |
| 946 |
\_mathchardef \supsetneq "3\_amsbfam 29 |
| 947 |
\_mathchardef \nsubseteq "3\_amsbfam 2A |
| 948 |
\_mathchardef \nsupseteq "3\_amsbfam 2B |
| 949 |
\_mathchardef \nparallel "3\_amsbfam 2C |
| 950 |
\_mathchardef \nmid "3\_amsbfam 2D |
| 951 |
\_mathchardef \nshortmid "3\_amsbfam 2E |
| 952 |
\_mathchardef \nshortparallel "3\_amsbfam 2F |
| 953 |
\_mathchardef \nvdash "3\_amsbfam 30 |
| 954 |
\_mathchardef \nVdash "3\_amsbfam 31 |
| 955 |
\_mathchardef \nvDash "3\_amsbfam 32 |
| 956 |
\_mathchardef \nVDash "3\_amsbfam 33 |
| 957 |
\_mathchardef \ntrianglerighteq "3\_amsbfam 34 |
| 958 |
\_mathchardef \ntrianglelefteq "3\_amsbfam 35 |
| 959 |
\_mathchardef \ntriangleleft "3\_amsbfam 36 |
| 960 |
\_mathchardef \ntriangleright "3\_amsbfam 37 |
| 961 |
\_mathchardef \nleftarrow "3\_amsbfam 38 |
| 962 |
\_mathchardef \nrightarrow "3\_amsbfam 39 |
| 963 |
\_mathchardef \nLeftarrow "3\_amsbfam 3A |
| 964 |
\_mathchardef \nRightarrow "3\_amsbfam 3B |
| 965 |
\_mathchardef \nLeftrightarrow "3\_amsbfam 3C |
| 966 |
\_mathchardef \nleftrightarrow "3\_amsbfam 3D |
| 967 |
\_mathchardef \divideontimes "2\_amsbfam 3E |
| 968 |
\_mathchardef \varnothing "0\_amsbfam 3F |
| 969 |
\_mathchardef \nexists "0\_amsbfam 40 |
| 970 |
\_mathchardef \Finv "0\_amsbfam 60 |
| 971 |
\_mathchardef \Game "0\_amsbfam 61 |
| 972 |
\_mathchardef \mho "0\_amsbfam 66 |
| 973 |
\_mathchardef \eth "0\_amsbfam 67 |
| 974 |
\_mathchardef \eqsim "3\_amsbfam 68 |
| 975 |
\_mathchardef \beth "0\_amsbfam 69 |
| 976 |
\_mathchardef \gimel "0\_amsbfam 6A |
| 977 |
\_mathchardef \daleth "0\_amsbfam 6B |
| 978 |
\_mathchardef \lessdot "2\_amsbfam 6C |
| 979 |
\_mathchardef \gtrdot "2\_amsbfam 6D |
| 980 |
\_mathchardef \ltimes "2\_amsbfam 6E |
| 981 |
\_mathchardef \rtimes "2\_amsbfam 6F |
| 982 |
\_mathchardef \shortmid "3\_amsbfam 70 |
| 983 |
\_mathchardef \shortparallel "3\_amsbfam 71 |
| 984 |
\_mathchardef \smallsetminus "2\_amsbfam 72 |
| 985 |
\_mathchardef \thicksim "3\_amsbfam 73 |
| 986 |
\_mathchardef \thickapprox "3\_amsbfam 74 |
| 987 |
\_mathchardef \approxeq "3\_amsbfam 75 |
| 988 |
\_mathchardef \precapprox "3\_amsbfam 76 |
| 989 |
\_mathchardef \succapprox "3\_amsbfam 77 |
| 990 |
\_mathchardef \curvearrowleft "3\_amsbfam 78 |
| 991 |
\_mathchardef \curvearrowright "3\_amsbfam 79 |
| 992 |
\_mathchardef \digamma "0\_amsbfam 7A |
| 993 |
\_mathchardef \varkappa "0\_amsbfam 7B |
| 994 |
\_mathchardef \Bbbk "0\_amsbfam 7C |
| 995 |
\_mathchardef \hslash "0\_amsbfam 7D |
| 996 |
\_mathchardef \hbar "0\_amsbfam 7E |
| 997 |
\_mathchardef \backepsilon "3\_amsbfam 7F |
| 998 |
|
| 999 |
\_let\circledplus\oplus |
| 1000 |
\_let\circledminus\ominus |
| 1001 |
\_let\circledtimes\otimes |
| 1002 |
\_let\circledslash\oslash |
| 1003 |
\_let\circleddot\odot |
| 1004 |
|
| 1005 |
\_doc ----------------------------- |
| 1006 |
The \^`\not` macro is re-defined to be smarter than in plain |
| 1007 |
\TeX/. The macro follows this rule: |
| 1008 |
\begtt |
| 1009 |
\not< becomes \_nless |
| 1010 |
\not> becomes \_ngtr |
| 1011 |
if \_notXXX is defined, \not\XXX becomes \_notXXX; |
| 1012 |
if \_nXXX is defined, \not\XXX becomes \_nXXX; |
| 1013 |
otherwise, \not\XXX is done in the usual way. |
| 1014 |
\endtt |
| 1015 |
\_cod ----------------------------- |
| 1016 |
|
| 1017 |
\_mathchardef \_notchar "3236 |
| 1018 |
|
| 1019 |
\_protected\_def \_not#1{% |
| 1020 |
\_ifx #1<\_nless \_else |
| 1021 |
\_ifx #1>\_ngtr \_else |
| 1022 |
\_edef\_tmpn{\_csstring#1}% |
| 1023 |
\_ifcsname _not\_tmpn\_endcsname \_csname _not\_tmpn\_endcsname |
| 1024 |
\_else \_ifcsname _n\_tmpn\_endcsname \_csname _n\_tmpn\_endcsname |
| 1025 |
\_else \_mathrel{\_mathord{\_notchar}\_mathord{#1}}% |
| 1026 |
\_fi \_fi \_fi \_fi} |
| 1027 |
\_private |
| 1028 |
\nleq \ngeq \nless \ngtr \nprec \nsucc \nleqslant \ngeqslant \npreceq |
| 1029 |
\nsucceq \nleqq \ngeqq \nsim \ncong \nsubseteqq \nsupseteqq \nsubseteq |
| 1030 |
\nsupseteq \nparallel \nmid \nshortmid \nshortparallel \nvdash \nVdash |
| 1031 |
\nvDash \nVDash \ntrianglerighteq \ntrianglelefteq \ntriangleleft |
| 1032 |
\ntriangleright \nleftarrow \nrightarrow \nLeftarrow \nRightarrow |
| 1033 |
\nLeftrightarrow \nleftrightarrow \nexists ; |
| 1034 |
\_public \not ; |
| 1035 |
|
| 1036 |
\_doc ----------------------------- |
| 1037 |
\`\mathstyles``{<math list>}` |
| 1038 |
behaves like `{<math list>}`, but you can use the following commands in the |
| 1039 |
`<math list>`: |
| 1040 |
\begitems |
| 1041 |
* \`\currstyle` which expands to `\displaystyle`, `\textstyle`, |
| 1042 |
`\scriptstyle` or `\scriptscriptstyle` depending on the current math style |
| 1043 |
when \^`\mathstyles` was opened. |
| 1044 |
* \`\dobystyle``{<D>}{<T>}{<S>}{<SS>}` is expandable macro. It expands to |
| 1045 |
`<D>`, `<T>`, `<S>` or `<SS>` depending on the current math style |
| 1046 |
when \^`\mathstyles` was opened. |
| 1047 |
* The value of the \`\stylenum` is 0, 1, 2 or 3 |
| 1048 |
depending on the current math style when \^`\mathstyles` was opened. |
| 1049 |
\enditems |
| 1050 |
Example of usage of \^`\mathstyles`: |
| 1051 |
`\def\mathframe#1{\mathstyles{\frame{$\currstyle{#1}$}}}`. |
| 1052 |
\_cod ----------------------------- |
| 1053 |
|
| 1054 |
\_newcount\_stylenum |
| 1055 |
\_def\_mathstyles#1{{\_mathchoice{\_stylenum0 #1}{\_stylenum1 #1}% |
| 1056 |
{\_stylenum2 #1}{\_stylenum3 #1}}} |
| 1057 |
\_def\_dobystyle#1#2#3#4{\_ifcase\_stylenum#1\_or#2\_or#3\_or#4\_fi} |
| 1058 |
\_def\_currstyle{\_dobystyle\_displaystyle\_textstyle\_scriptstyle\_scriptscriptstyle} |
| 1059 |
\_public \mathstyles \dobystyle \currstyle \stylenum ; |
| 1060 |
|
| 1061 |
\_doc ----------------------------- |
| 1062 |
The \`\cramped` macro |
| 1063 |
sets the cramped variant of the current style. |
| 1064 |
Note that \^`\currstyle` initializes non-cramped variants. |
| 1065 |
The example `\mathframe` above should be:\nl |
| 1066 |
`\def\mathframe#1{\mathstyles{\frame{$\currstyle\cramped #1$}}}`.\nl |
| 1067 |
Second note: `\cramped` macro reads the current math style from |
| 1068 |
the `\mathstyle` LuaTeX primitive, so it does not work in numerators of |
| 1069 |
generalized fractions but you can use it before the fraction is opened: |
| 1070 |
`$\cramped {x^2\over y^2}$`. |
| 1071 |
\_cod ----------------------------- |
| 1072 |
|
| 1073 |
\_def\_cramped{\_ifcase\_numexpr(\_mathstyle+1)/2\_relax\_or |
| 1074 |
\_crampeddisplaystyle \_or \_crampedtextstyle \_or |
| 1075 |
\_crampedscriptstyle \_or \_crampedscriptscriptstyle \_fi |
| 1076 |
} |
| 1077 |
\_public \cramped ; |
| 1078 |
|
| 1079 |
\_doc ----------------------------- |
| 1080 |
\`\setmathstyle` saves current math style |
| 1081 |
(including its cramped/normal subversion) and \`\usemathstyle` |
| 1082 |
restores the saved math style. These macros are based on the \LuaTeX/'s |
| 1083 |
`\mathstyle` primitive, i.e.\ they don't work in generalized fractions.\nl |
| 1084 |
Usage: `\def\mathclap #1{{\setmathstyle \hbox to0pt{\hss$\usemathstyle#1$\hss}}}`. |
| 1085 |
\_cod |
| 1086 |
|
| 1087 |
\_newcount\_mstylenum |
| 1088 |
\_def\_setmathstyle{\_mstylenum=\_mathstyle\_relax} |
| 1089 |
\_def\_usemathstyle{\_ifcase\_mstylenum |
| 1090 |
\_displaystyle\_or \_crampeddisplaystyle\_or \_textstyle\_or \_crampedtextstyle\_or |
| 1091 |
\_scriptstyle\_or \_crampedscriptstyle\_or \_scriptscriptstyle\_or \_crampedscriptscriptstyle |
| 1092 |
\_fi |
| 1093 |
} |
| 1094 |
\_public \setmathstyle \usemathstyle ; |
| 1095 |
|
| 1096 |
\_doc ----------------------------- |
| 1097 |
The \`\mathbox``{<text>}` macro is copied from OPmac trick 078. |
| 1098 |
It behaves like `\hbox{<text>}` but the `<text>` is scaled to a smaller |
| 1099 |
size if it is used in scriptstyle or scriptscript style.\nl |
| 1100 |
The \^`\_textmff` and \^`\_scriptmff` are redefined in order to |
| 1101 |
respect optical sizes. If we are in script style then the math mode |
| 1102 |
starts in text style, but optical size is given to script style. |
| 1103 |
The `\mathbox` in non-Unicode math respects optical sizes |
| 1104 |
using different principle. |
| 1105 |
\_cod ----------------------------- |
| 1106 |
|
| 1107 |
\_def\_mathbox#1{{\_mathstyles{\_dirhbox{% |
| 1108 |
\_ifnum\_stylenum<2 \_everymath{\_currstyle}% |
| 1109 |
\_else \_ifx \_normalmath\_normalunimath |
| 1110 |
\_ifnum\_stylenum=2 \_def\_textmff{ssty=1;}\_fi |
| 1111 |
\_ifnum\_stylenum=3 \_def\_textmff{ssty=2;}\_def\_scriptmff{ssty=2;}\_fi |
| 1112 |
\_typosize[\_ea\_ignorept\_the\_fontdimen6\_dobystyle{}{}\_scriptfont\_scriptscriptfont1/]% |
| 1113 |
\_else \_typoscale[\_dobystyle{}{}{700}{500}/]% |
| 1114 |
\_fi\_fi #1}}}% |
| 1115 |
} |
| 1116 |
\_public \mathbox ; |
| 1117 |
|
| 1118 |
\_doc |
| 1119 |
\`\dirhbox` and \`\dirvbox` are equal to `\hbox` and `\vbox`, but they set |
| 1120 |
the printing of their parameter according to the \^`\inboxdirection` register. |
| 1121 |
\_cod |
| 1122 |
|
| 1123 |
\_def\_dirhbox{\_hbox bdir\_inboxdirection} \_def\_dirvbox{\_vbox bdir\_inboxdirection} |
| 1124 |
\_public \dirhbox \dirvbox ; |
| 1125 |
|
| 1126 |
\_doc |
| 1127 |
\`\swapeqno` swaps the meaning of \^`\eqno` with \^`\leqno` |
| 1128 |
and \^`\_eqnoright` with \^`\_eqnoleft`. |
| 1129 |
You can declare it if you want to move all equation marks from right to |
| 1130 |
left or from left to right in an already prepared document. Other use case |
| 1131 |
is with r2l languages: If `\pardirection=1` then the \^`\eqno` and \^`\leqno` |
| 1132 |
are swapped and if you don't want it then use \^`\swapeqno`. |
| 1133 |
\_cod |
| 1134 |
|
| 1135 |
\_def\_swapeqno{\_let\_tmp=\_eqno \_let\_eqno=\_leqno \_let\_leqno=\_tmp |
| 1136 |
\_let\_tmp=\_eqnoright \_let\_eqnoright=\_eqnoleft \_let\_eqnoleft=\_tmp |
| 1137 |
\_public \eqno \leqno ; |
| 1138 |
} |
| 1139 |
\_let\_orieqno=\_eqno % you can do \_ifx\_eqno\_orieqno to test if they are swapped |
| 1140 |
\_public \swapeqno ; |
| 1141 |
|
| 1142 |
\_endcode %--------------------------------------------------- |
| 1143 |
|
| 1144 |
2026-03-18 \eqalignno, \leqalignno reimplemented, \swapeqno introduced. |
| 1145 |
2025-04-13 \bBig strut macro introduced, \_scalebig re-implemented |
| 1146 |
2025-04-10 \big strut size correction 0.6 -> 0.61 (due to LM Math) |
| 1147 |
2024-12-21 \skew macro: bug fixed |
| 1148 |
2024-11-19 \typosize used fo Uni-fonts in \mathbox in order to respect their sizes |
| 1149 |
2024-06-02 don't apply \mathsbon twice |
| 1150 |
2023-05-24 \matsbon: "local num" added |
| 1151 |
2023-05-22 \mathsbon: \alpha_i\beta_j -> \alpha _i\beta _j (bug fixed) |
| 1152 |
2023-04-15 \bbig introduced |
| 1153 |
2023-03-12 \setmathstyle, \usemathstyle introduced |
| 1154 |
2021-08-02 ssty fontfeatures rewritten |
| 1155 |
2021-04-25 \triangleright: typo fixed |
| 1156 |
2021-03-22 \(l)eqalignno: \hbox instead \llap, \rlap (\par error suppressed) |
| 1157 |
2021-03-19 allow text mode \{ and \} |
| 1158 |
2021-02-15 \_mathbox redefines \_textmff etc. in order to respect optical sizes |
| 1159 |
2021-02-04 \_bordermatrixwithdelims introduced. |
| 1160 |
2021-01-23 better expression for math styles in \matrix |
| 1161 |
2021-01-22 bad use of \_stylenum in \matrix + bad value (bug fix: \_stylenum->\_mtstylenum) |
| 1162 |
2020-12-17 \box0->\hbox{\box0} in \_finphant and \_finsmash, see https://tex.stackexchange.com/questions/574997/ |
| 1163 |
2020-06-14 \borermatrix, \cases corrected |
| 1164 |
2020-06-13 \adots introduced, \matrix smaller in T mode too. |
| 1165 |
2020-06-03 \notin corrected |
| 1166 |
2020-06-02 $$\par$$ error is suppressed, so we define \(l)eqalign(no), \displayines as \long |
| 1167 |
2020-05-30 \cases: group added in the second column. |
| 1168 |
"\displaylines to<size>" implemented and documented. |
| 1169 |
2020-05-11 \let\|=\Vert, bug fixed |
| 1170 |
2020-04-27 \mathstyles introduced |
| 1171 |
2020-03-14 implemented |