% This is part of the OpTeX project, see http://petr.olsak.net/optex \_codedecl \sin {Math macros plus mathchardefs <2023-05-24>} % preloaded in format \_doc ----------------------------- The category code of the character `_` remains as the letter (11) and the mathcode of it is `"8000`. It means that it is an active character in math mode. It is defined as the subscript prefix. There is a problem: The `x_n` is tokenized as `x`, `_`, `n` and it works without problems. But `\int``_a^b` is tokenized as `\int``_a`, `^`, `b`. The control sequence `\int``_a` isn't defined. We must write `\int _a^b`. The Lua code presented here solves this problem. But you cannot set your own control sequence in the form `\_` or `\_` (where is a sequence of letters) because such control sequences are inaccessible: preprocessor rewrites it. The \`\mathsbon` macro activates the rewriting rule `\_` to `\ _` and `\``_` to `\ _` at input processor level. The \`\mathsboff` deactivates it. You can ask by \`\_ifmathsb` if this feature is activated or deactivated. By default, it is activated in the `\everyjob`, see section~\ref[init]. Note, that the `\everyjob` is processed after the first line of the document is read, so the \^`\mathsbon` is activated from the second line of the document. \_cod ----------------------------- \catcode`\_ = 8 \let\sb = _ \catcode`\_ = 13 \let _ = \sb \catcode`\_ = 11 \_private \sb ; \_newifi\_ifmathsb \_mathsbfalse \_def \_mathsbon {% \_directlua{ callback.add_to_callback("process_input_buffer", function (str) local num str, num = string.gsub(str.." ", \_gsubrule) if num>0 then str = string.gsub(str, \_gsubrule) end % \phi_i\rho_j -> \phi _i\rho _j return str end, "_mathsb") }% \_global\_mathsbtrue } \_def \_mathsboff {% \_directlua{ callback.remove_from_callback("process_input_buffer", "_mathsb") }% \_global \_mathsbfalse } \_edef\_gsubrule{"(\_nbb[a-zA-Z]+)_([a-zA-Z]?[^_a-zA-Z])", "\_pcent 1 _\_pcent 2"} \_public \mathsboff \mathsbon ; \_doc ----------------------------- All mathcodes are set to equal values as in plain\TeX/. But all encoding-dependent declarations (like these) will be set to different values when a Unicode-math font is used. \_cod ----------------------------- \_mathcode`\^^@="2201 % \cdot \_mathcode`\^^A="3223 % \downarrow \_mathcode`\^^B="010B % \alpha \_mathcode`\^^C="010C % \beta \_mathcode`\^^D="225E % \land \_mathcode`\^^E="023A % \lnot \_mathcode`\^^F="3232 % \in \_mathcode`\^^G="0119 % \pi \_mathcode`\^^H="0115 % \lambda \_mathcode`\^^I="010D % \gamma \_mathcode`\^^J="010E % \delta \_mathcode`\^^K="3222 % \uparrow \_mathcode`\^^L="2206 % \pm \_mathcode`\^^M="2208 % \oplus \_mathcode`\^^N="0231 % \infty \_mathcode`\^^O="0140 % \partial \_mathcode`\^^P="321A % \subset \_mathcode`\^^Q="321B % \supset \_mathcode`\^^R="225C % \cap \_mathcode`\^^S="225B % \cup \_mathcode`\^^T="0238 % \forall \_mathcode`\^^U="0239 % \exists \_mathcode`\^^V="220A % \otimes \_mathcode`\^^W="3224 % \leftrightarrow \_mathcode`\^^X="3220 % \leftarrow \_mathcode`\^^Y="3221 % \rightarrow \_mathcode`\^^Z="8000 % \ne \_mathcode`\^^[="2205 % \diamond \_mathcode`\^^\="3214 % \le \_mathcode`\^^]="3215 % \ge \_mathcode`\^^^="3211 % \equiv \_mathcode`\^^_="225F % \lor \_mathcode`\ ="8000 % \space \_mathcode`\!="5021 \_mathcode`\'="8000 % ^\prime \_mathcode`\(="4028 \_mathcode`\)="5029 \_mathcode`\*="2203 % \ast \_mathcode`\+="202B \_mathcode`\,="613B \_mathcode`\-="2200 \_mathcode`\.="013A \_mathcode`\/="013D \_mathcode`\:="303A \_mathcode`\;="603B \_mathcode`\<="313C \_mathcode`\=="303D \_mathcode`\>="313E \_mathcode`\?="503F \_mathcode`\[="405B \_mathcode`\\="026E % \backslash \_mathcode`\]="505D \_mathcode`\_="8000 % math-active subscript \_mathcode`\{="4266 \_mathcode`\|="026A \_mathcode`\}="5267 \_mathcode`\^^?="1273 % \smallint \_delcode`\(="028300 \_delcode`\)="029301 \_delcode`\[="05B302 \_delcode`\]="05D303 \_delcode`\<="26830A \_delcode`\>="26930B \_delcode`\/="02F30E \_delcode`\|="26A30C \_delcode`\\="26E30F \_doc ----------------------------- All control sequences declared by `\mathchardef` are supposed (by default) only for public usage. It means that they are declared without `_` prefix. If such sequences are used in internal \OpTeX/ macro then their internal prefixed form is declared using `\_private` macro.\nl These encoding dependent declarations will be set to different values when Unicode-math font is loaded.\nl The declared sequences for math symbols are not hyperlinked in this documentation. \maxlines=15 \_cod ----------------------------- \_mathchardef\alpha="010B \_mathchardef\beta="010C \_mathchardef\gamma="010D \_mathchardef\delta="010E \_mathchardef\epsilon="010F \_mathchardef\zeta="0110 \_mathchardef\eta="0111 \_mathchardef\theta="0112 \_mathchardef\iota="0113 \_mathchardef\kappa="0114 \_mathchardef\lambda="0115 \_mathchardef\mu="0116 \_mathchardef\nu="0117 \_mathchardef\xi="0118 \_mathchardef\pi="0119 \_mathchardef\rho="011A \_mathchardef\sigma="011B \_mathchardef\tau="011C \_mathchardef\upsilon="011D \_mathchardef\phi="011E \_mathchardef\chi="011F \_mathchardef\psi="0120 \_mathchardef\omega="0121 \_mathchardef\varepsilon="0122 \_mathchardef\vartheta="0123 \_mathchardef\varpi="0124 \_mathchardef\varrho="0125 \_mathchardef\varsigma="0126 \_mathchardef\varphi="0127 \_mathchardef\Gamma="7000 \_mathchardef\Delta="7001 \_mathchardef\Theta="7002 \_mathchardef\Lambda="7003 \_mathchardef\Xi="7004 \_mathchardef\Pi="7005 \_mathchardef\Sigma="7006 \_mathchardef\Upsilon="7007 \_mathchardef\Phi="7008 \_mathchardef\Psi="7009 \_mathchardef\Omega="700A \_mathchardef\aleph="0240 \_mathchardef\imath="017B \_mathchardef\jmath="017C \_mathchardef\ell="0160 \_mathchardef\wp="017D \_mathchardef\Re="023C \_mathchardef\Im="023D \_mathchardef\partial="0140 \_mathchardef\infty="0231 \_mathchardef\prime="0230 \_mathchardef\emptyset="023B \_mathchardef\nabla="0272 \_protected\_def \surd{{\_mathchar"1270}} \_mathchardef\top="023E \_mathchardef\bot="023F \_mathchardef\triangle="0234 \_mathchardef\forall="0238 \_mathchardef\exists="0239 \_mathchardef\neg="023A \_let\lnot=\neg \_mathchardef\flat="015B \_mathchardef\natural="015C \_mathchardef\sharp="015D \_mathchardef\clubsuit="027C \_mathchardef\diamondsuit="027D \_mathchardef\heartsuit="027E \_mathchardef\spadesuit="027F \_mathchardef\coprod="1360 \_mathchardef\bigvee="1357 \_mathchardef\bigwedge="1356 \_mathchardef\biguplus="1355 \_mathchardef\bigcap="1354 \_mathchardef\bigcup="1353 \_mathchardef\intop="1352 \_protected\_def \int{\_intop\_nolimits} \_private \intop; \_mathchardef\prod="1351 \_mathchardef\sum="1350 \_mathchardef\bigotimes="134E \_mathchardef\bigoplus="134C \_mathchardef\bigodot="134A \_mathchardef\ointop="1348 \_protected\_def\_oint {\_ointop\_nolimits} \_private \ointop; \_mathchardef\bigsqcup="1346 \_mathchardef\smallint="1273 \_mathchardef\triangleleft="212F \_private \triangleleft; \_mathchardef\triangleright="212E \_private \triangleright; \_mathchardef\bigtriangleup="2234 \_mathchardef\bigtriangledown="2235 \_mathchardef\wedge="225E \let\land=\wedge \_mathchardef\vee="225F \let\lor=\vee \_mathchardef\cap="225C \_mathchardef\cup="225B \_mathchardef\ddagger="227A \_mathchardef\dagger="2279 \_mathchardef\sqcap="2275 \_mathchardef\sqcup="2274 \_mathchardef\uplus="225D \_mathchardef\amalg="2271 \_mathchardef\diamond="2205 \_mathchardef\bullet="220F \_private \bullet; \_mathchardef\wr="226F \_mathchardef\div="2204 \_mathchardef\odot="220C \_mathchardef\oslash="220B \_mathchardef\otimes="220A \_mathchardef\ominus="2209 \_mathchardef\oplus="2208 \_mathchardef\mp="2207 \_mathchardef\pm="2206 \_mathchardef\circ="220E \_mathchardef\bigcirc="220D \_mathchardef\setminus="226E % for set difference A\setminus B \_mathchardef\cdot="2201 \_mathchardef\ast="2203 \_mathchardef\times="2202 \_mathchardef\star="213F \_mathchardef\propto="322F \_mathchardef\sqsubseteq="3276 \_mathchardef\sqsupseteq="3277 \_mathchardef\parallel="326B \_mathchardef\mid="326A \_mathchardef\dashv="3261 \_mathchardef\vdash="3260 \_mathchardef\nearrow="3225 \_mathchardef\searrow="3226 \_mathchardef\nwarrow="322D \_mathchardef\swarrow="322E \_mathchardef\Leftrightarrow="322C \_mathchardef\Leftarrow="3228 \_mathchardef\Rightarrow="3229 \_protected\_def \neq{\_not=} \_let\ne=\neq \_mathchardef\leq="3214 \let\le=\leq \_mathchardef\geq="3215 \let\ge=\geq \_mathchardef\succ="321F \_mathchardef\prec="321E \_mathchardef\approx="3219 \_mathchardef\succeq="3217 \_mathchardef\preceq="3216 \_mathchardef\supset="321B \_mathchardef\subset="321A \_mathchardef\supseteq="3213 \_mathchardef\subseteq="3212 \_mathchardef\in="3232 \_mathchardef\ni="3233 \let\owns=\ni \_mathchardef\gg="321D \_mathchardef\ll="321C % \_mathchardef\not="3236 % defined below \_mathchardef\leftrightarrow="3224 \_mathchardef\leftarrow="3220 \_let\gets=\leftarrow \_mathchardef\rightarrow="3221 \_let\to=\rightarrow \_mathchardef\mapstochar="3237 \_protected\_def\mapsto{\_mapstochar\_rightarrow} \_private \mapstochar \rightarrow ; \_mathchardef\sim="3218 \_mathchardef\simeq="3227 \_mathchardef\perp="323F \_mathchardef\equiv="3211 \_mathchardef\asymp="3210 \_mathchardef\smile="315E \_mathchardef\frown="315F \_mathchardef\leftharpoonup="3128 \_mathchardef\leftharpoondown="3129 \_mathchardef\rightharpoonup="312A \_mathchardef\rightharpoondown="312B \_doc ----------------------------- The math functions like log, sin, cos are declared in the same way as in plain\TeX/, but they are `\protected` in \OpTeX/. \_cod ----------------------------- \_protected\_def\log {\_mathop{\_rm log}\_nolimits} \_protected\_def\lg {\_mathop{\_rm lg}\_nolimits} \_protected\_def\ln {\_mathop{\_rm ln}\_nolimits} \_protected\_def\lim {\_mathop{\_rm lim}} \_protected\_def\limsup {\_mathop{\_rm lim\_thinsk sup}} \_protected\_def\liminf {\_mathop{\_rm lim\_thinsk inf}} \_protected\_def\sin {\_mathop{\_rm sin}\_nolimits} \_protected\_def\arcsin {\_mathop{\_rm arcsin}\_nolimits} \_protected\_def\sinh {\_mathop{\_rm sinh}\_nolimits} \_protected\_def\cos {\_mathop{\_rm cos}\_nolimits} \_protected\_def\arccos {\_mathop{\_rm arccos}\_nolimits} \_protected\_def\cosh {\_mathop{\_rm cosh}\_nolimits} \_protected\_def\tan {\_mathop{\_rm tan}\_nolimits} \_protected\_def\arctan {\_mathop{\_rm arctan}\_nolimits} \_protected\_def\tanh {\_mathop{\_rm tanh}\_nolimits} \_protected\_def\cot {\_mathop{\_rm cot}\_nolimits} \_protected\_def\coth {\_mathop{\_rm coth}\_nolimits} %\_protected\_def\sec {\_mathop{\_rm sec}\_nolimits} % \sec is section \_protected\_def\secant {\_mathop{\_rm sec}\_nolimits} \_protected\_def\csc {\_mathop{\_rm csc}\_nolimits} \_protected\_def\max {\_mathop{\_rm max}} \_protected\_def\min {\_mathop{\_rm min}} \_protected\_def\sup {\_mathop{\_rm sup}} \_protected\_def\inf {\_mathop{\_rm inf}} \_protected\_def\arg {\_mathop{\_rm arg}\_nolimits} \_protected\_def\ker {\_mathop{\_rm ker}\_nolimits} \_protected\_def\dim {\_mathop{\_rm dim}\_nolimits} \_protected\_def\hom {\_mathop{\_rm hom}\_nolimits} \_protected\_def\det {\_mathop{\_rm det}} \_protected\_def\exp {\_mathop{\_rm exp}\_nolimits} \_protected\_def\Pr {\_mathop{\_rm Pr}} \_protected\_def\gcd {\_mathop{\_rm gcd}} \_protected\_def\deg {\_mathop{\_rm deg}\_nolimits} \_doc ----------------------------- These macros are defined similarly as in plain\TeX. Only internal macro names from plain\TeX/ with `@` character are re-written in a more readable form.\nl \`\sp` is an alternative for `^`. The \`\sb` alternative for `_` was defined at line 27 of the file `math-macros.opm`.\nl \`\_thinsk`, \`\_medsk`, \`\_thicksk` and \`\_thinneg` should be used instead `\,`, `\>`, `\;` and `\!` in macros because a user can re-define these single-letter sequences. \_cod ----------------------------- \_let\_sp=^ \public \sp ; % \sb=_ , defined at beginning of this file \_def\_thinsk {\_mskip\_thinmuskip} \_protected\_def\,{\_relax\_ifmmode \_thinsk \_else \_thinspace \_fi} \_protected\_def\>{\_mskip\_medmuskip} \let\_medsk = \> \_protected\_def\;{\_mskip\_thickmuskip} \let\_thicksk = \; \_protected\_def\!{\_mskip-\_thinmuskip} \let\_thinneg = \! %\_def\*{\discretionary{\thinspace\the\textfont2\char2}{}{}} % obsolete \_doc ----------------------------- Active \`\prime` character is defined here. \_cod ----------------------------- {\_catcode`\'=\active \_gdef'{^\_bgroup\_primes}} % primes dance \_def\_primes{\_prime\_isnextchar'{\_primesA}% {\_isnextchar^{\_primesB}{\_egroup}}} \_def\_primesA #1{\_primes} \_def\_primesB #1#2{#2\egroup} \_private \prime ; \_doc ----------------------------- \`\big`, \`\bbig`, \`\Big`, \`\bigg`, \`\Bigg`, \`\bigl`, \`\bigm`, \`\bigr`, \`\bbigl`, \`\bbigm`, \`\bbigr`, \`\Bigl`, \`\Bigm`, \`\Bigr`, \`\biggl`, \`\biggm`, \`\biggr`, \`\Biggl`, \`\Biggm`, \`\Biggr` are based on the \`\_scalebig` macro because we need the dependency on the various sizes of the fonts. The \`\_scalebigcoef``` returns relevant coefficient for these macros. Multiply this coefficient by two and you get the strut height+depth in em units.\nl The \^`\big`, \^`\Big`, \^`\bigg`, \^`\Bigg` macros keep the strut height+depth from plain \TeX/ and \^`\bbig` is a new macro in \OpTeX/. It generates the size 1.44\,em beween \^`\big` and \^`\Big` which is accessible in most of Unicode math fonts (but not in classical `cmex10`). \_cod ----------------------------- %{\catcode`\^^Z=\active \gdef^^Z{\not=}} % ^^Z is like \ne in math %obsolete \_def\_scalebig#1#2{{\_left#1% \_raise\_Umathaxis\_textstyle\_vbox to\_scalebigcoef{#2}\_fontdimen6\_textfont1{}% \_kern-\_nulldelimiterspace\_right.}} \_def\_scalebigcoef#1{\_ifcase #1 0\_or % \big (1.2) \bbig (1.44) \Big (1.8) \bigg (2.4) \Bigg (3.0) .6\_or .72\_or .9\_or 1.2\_or 1.5\_else 0\_fi } \_protected\_def\_big #1{\_scalebig{#1}1} \_protected\_def\_bbig#1{\_scalebig{#1}2} \_protected\_def\_Big #1{\_scalebig{#1}3} \_protected\_def\_bigg#1{\_scalebig{#1}4} \_protected\_def\_Bigg#1{\_scalebig{#1}5} \_public \big \bbig \Big \bigg \Bigg ; \_protected\_def\_bigl{\_mathopen\_big} \_protected\_def\_bigm{\_mathrel\_big} \_protected\_def\_bigr{\_mathclose\_big} \_protected\_def\_bbigl{\_mathopen\_bbig} \_protected\_def\_bbigm{\_mathrel\_bbig} \_protected\_def\_bbigr{\_mathclose\_bbig} \_protected\_def\_Bigl{\_mathopen\_Big} \_protected\_def\_Bigm{\_mathrel\_Big} \_protected\_def\_Bigr{\_mathclose\_Big} \_protected\_def\_biggl{\_mathopen\_bigg} \_protected\_def\_biggm{\_mathrel\_bigg} \_protected\_def\_biggr{\_mathclose\_bigg} \_protected\_def\_Biggl{\_mathopen\_Bigg} \_protected\_def\_Biggm{\_mathrel\_Bigg} \_protected\_def\_Biggr{\_mathclose\_Bigg} \_public \bigl \bigm \bigr \bbigl \bbigm \bbigr \Bigl \Bigm \Bigr \biggl \biggm \biggr \Biggl \Biggm \Biggr ; \_doc ----------------------------- Math relations defined by the \`\jointrel` plain \TeX/ macro: \_cod ----------------------------- \_protected\_def\_joinrel{\_mathrel{\_mkern-2.5mu}} % -3mu in plainTeX \_protected\_def\relbar{\_mathrel{\_smash-}} % \_smash, because - has the same height as + \_protected\_def\Relbar{\_mathrel=} \_mathchardef\lhook="312C \_protected\_def\hookrightarrow{\_lhook\_joinrel\_rightarrow} \_mathchardef\rhook="312D \_protected\_def\hookleftarrow{\_leftarrow\_joinrel\_rhook} \_protected\_def\bowtie{\_mathrel\_triangleright\_joinrel\_mathrel\_triangleleft} \_protected\_def\models{\_mathrel|\_joinrel=} \_protected\_def\Longrightarrow{\_Relbar\_joinrel\_Rightarrow} \_protected\_def\longrightarrow{\_relbar\_joinrel\_rightarrow} \_protected\_def\longleftarrow{\_leftarrow\_joinrel\_relbar} \_protected\_def\Longleftarrow{\_Leftarrow\_joinrel\_Relbar} \_protected\_def\longmapsto{\_mapstochar\_longrightarrow} \_protected\_def\longleftrightarrow{\_leftarrow\_joinrel\_rightarrow} \_protected\_def\Longleftrightarrow{\_Leftarrow\_joinrel\_Rightarrow} \_protected\_def\iff{\_thicksk\_Longleftrightarrow\_thicksk} \_private \lhook \rightarrow \leftarrow \rhook \triangleright \triangleleft \Relbar \Rightarrow \relbar \rightarrow \Leftarrow \mapstochar \longrightarrow \Longleftrightarrow ; \_public \joinrel ; \_doc ----------------------------- \`\ldots`, \`\cdots`, \`\vdots`, \`\ddots` from plain \TeX/ \_cod ----------------------------- \_mathchardef\_ldotp="613A % ldot as a punctuation mark \_mathchardef\_cdotp="6201 % cdot as a punctuation mark \_mathchardef\_colon="603A % colon as a punctuation mark \_public \ldotp \cdotp \colon ; \_protected\_def\_ldots{\_mathinner{\_ldotp\_ldotp\_ldotp}} \_protected\_def\_cdots{\_mathinner{\_cdotp\_cdotp\_cdotp}} \_protected\_def\_vdots{\_vbox{\_baselineskip=.4em \_lineskiplimit=\_zo \_kern.6em \_hbox{.}\_hbox{.}\_hbox{.}}} \_protected\_def\_ddots{\_mathinner{% \_mkern1mu\_raise.7em\_vbox{\_kern.7em\_hbox{.}}\_mkern2mu \_raise.4em\_hbox{.}\_mkern2mu\_raise.1em\_hbox{.}\_mkern1mu}} \_public \ldots \cdots \vdots \ddots ; \_doc ----------------------------- \`\adots` inspired by plain \TeX/ \_cod ----------------------------- \_protected\_def\_adots{\_mathinner{% \_mkern1mu\_raise.1em\_hbox{.}\_mkern2mu \_raise.4em\_hbox{.}\_mkern2mu\_raise.7em\_vbox{\_kern.7em\_hbox{.}}\_mkern1mu}} \_public \adots ; \_doc ----------------------------- Math accents (encoding dependent declarations). \_cod ----------------------------- \_protected\_def\acute{\_mathaccent"7013 } \_protected\_def\grave{\_mathaccent"7012 } \_protected\_def\ddot{\_mathaccent"707F } \_protected\_def\tilde{\_mathaccent"707E } \_protected\_def\bar{\_mathaccent"7016 } \_protected\_def\breve{\_mathaccent"7015 } \_protected\_def\check{\_mathaccent"7014 } \_protected\_def\hat{\_mathaccent"705E } \_protected\_def\vec{\_mathaccent"017E } \_protected\_def\dot{\_mathaccent"705F } \_protected\_def\widetilde{\_mathaccent"0365 } \_protected\_def\widehat{\_mathaccent"0362 } \_doc ----------------------------- \`\_math`, \`\skew`, \`\overrightarrow`, \`\overleftarrow`, \`\overbrace`, \`\underbrace` macros. The last four are redefined when Unicode math is loaded. \_cod ----------------------------- \_def\_math{\_mathsurround\_zo} \_protected\_def\_skew #1#2#3{{\_muskip0=#1mu\_divide\_muskip0=by2 \_mkern\_muskip0 #2{\_mkern-\_muskip0{#3}\_mkern\_muskip0}\_mkern-\_muskip0}{}} \_protected\_def\_overrightarrow #1{\_vbox{\_math\_ialign{##\_crcr \_rightarrowfill\_crcr\_noalign{\_kern-.1em \_nointerlineskip} $\_hfil\_displaystyle{#1}\_hfil$\_crcr}}} \_protected\_def\_overleftarrow #1{\_vbox{\_math\_ialign{##\_crcr \_leftarrowfill\_crcr\_noalign{\_kern-.1em \_nointerlineskip} $\_hfil\_displaystyle{#1}\_hfil$\_crcr}}} \_protected\_def\_overbrace #1{\_mathop{% \_vbox{\_math\_ialign{##\_crcr\_noalign{\_kern.3em} \_downbracefill\_crcr\_noalign{\_kern.3em \_nointerlineskip} $\_hfil\_displaystyle{#1}\_hfil$\_crcr}}}\_limits} \_protected\_def\_underbrace #1{\_mathop{\_vtop{\_math\_ialign{##\_crcr $\_hfil\_displaystyle{#1}\_hfil$\_crcr\_noalign{\_kern.3em \_nointerlineskip} \_upbracefill\_crcr\_noalign{\_kern.3em}}}}\_limits} \_public \overrightarrow \overleftarrow \overbrace \underbrace \skew ; \_doc ----------------------------- Macros based on `\delimiter`, `\*witdelims` and `\radical` primitives. \_cod ----------------------------- \_protected\_def\lmoustache{\_delimiter"437A340 } % top from (, bottom from ) \_protected\_def\rmoustache{\_delimiter"537B341 } % top from ), bottom from ( \_protected\_def\lgroup{\_delimiter"462833A } % extensible ( with sharper tips \_protected\_def\rgroup{\_delimiter"562933B } % extensible ) with sharper tips \_protected\_def\arrowvert{\_delimiter"26A33C } % arrow without arrowheads \_protected\_def\Arrowvert{\_delimiter"26B33D } % double arrow without arrowheads \_protected\_def\bracevert{\_delimiter"77C33E } % the vertical bar that extends braces \_protected\_def\Vert{\_delimiter"26B30D } \_let\|=\Vert \_protected\_def\vert{\_delimiter"26A30C } \_protected\_def\uparrow{\_delimiter"3222378 } \_protected\_def\downarrow{\_delimiter"3223379 } \_protected\_def\updownarrow{\_delimiter"326C33F } \_protected\_def\Uparrow{\_delimiter"322A37E } \_protected\_def\Downarrow{\_delimiter"322B37F } \_protected\_def\Updownarrow{\_delimiter"326D377 } \_protected\_def\backslash{\_delimiter"26E30F } % for double coset G\_backslash H \_protected\_def\langle{\_delimiter"426830A } \_protected\_def\rangle{\_delimiter"526930B } \_protected\_def\lbrace{\_delimiter"4266308 } \_let\_lbrace=\lbrace \_protected\_def\rbrace{\_delimiter"5267309 } \_let\_rbrace=\rbrace \_protected\_def\{{\_ifmmode \_lbrace\_else\_char`\{ \_fi} \_protected\_def\}{\_ifmmode \_rbrace\_else\_char`\} \_fi} \_protected\_def\rceil{\_delimiter"5265307 } \_protected\_def\lceil{\_delimiter"4264306 } \_protected\_def\rfloor{\_delimiter"5263305 } \_protected\_def\lfloor{\_delimiter"4262304 } \_protected\_def\choose{\_atopwithdelims()} \_protected\_def\brack{\_atopwithdelims[]} \_protected\_def\brace{\_atopwithdelims\_lbrace\_rbrace} \_protected\_def\_sqrt{\_radical"270370 } \_public \sqrt ; \_doc ----------------------------- \`\mathpalette`, \`\vphantom`, \`\hphantom`, \`\phantom`, \`\mathstrut`, and \`\smash` macros from plain \TeX. \_cod ----------------------------- \_def\_mathpalette#1#2{\_mathchoice{#1\_displaystyle{#2}}% {#1\_textstyle{#2}}{#1\_scriptstyle{#2}}{#1\_scriptscriptstyle{#2}}} \_newbox\_rootbox \_protected\_def\root#1\of{\_setbox\_rootbox \_hbox{$\_math\_scriptscriptstyle{#1}$}\_mathpalette\_rootA} \_def\_rootA#1#2{\_setbox0=\_hbox{$\_math#1\_sqrt{#2}$}\_dimen0=\_ht0 \_advance\_dimen0by-\_dp0 \_mkern5mu\_raise.6\_dimen0\_copy\_rootbox \_mkern-10mu\_box0 } \_newifi\_ifvp \_newifi\_ifhp \_protected\_def\_vphantom{\_vptrue\_hpfalse\_phant} \_protected\_def\_hphantom{\_vpfalse\_hptrue\_phant} \_protected\_def\_phantom{\_vptrue\_hptrue\_phant} \_def\_phant{\_ifmmode\_def\_next{\_mathpalette\_mathphant}% \_else\_let\_next=\_makephant\_fi\_next} \_def\_makephant#1{\_setbox0\_hbox{#1}\_finphant} \_def\_mathphant#1#2{\_setbox0=\_hbox{$\_math#1{#2}$}\_finphant} \_def\_finphant{\_setbox2=\_null \_ifvp \_ht2=\_ht0 \_dp2=\_dp0 \_fi \_ifhp \_wd2=\_wd0 \_fi \_hbox{\_box2}} \_def\_mathstrut{\_vphantom(} \_protected\_def\_smash{\_relax % \_relax, in case this comes first in \halign \_ifmmode\_def\_next{\_mathpalette\_mathsmash}\_else\_let\_next\_makesmash \_fi\_next} \_def\_makesmash#1{\_setbox0=\_hbox{#1}\_finsmash} \_def\_mathsmash#1#2{\_setbox0=\_hbox{$\_math#1{#2}$}\_finsmash} \_def\_finsmash{\_ht0=\_zo \_dp0=\_zo \_hbox{\_box0}} \_public \mathpalette \vphantom \hphantom \phantom \mathstrut \smash ; \_doc ----------------------------- \`\cong`, \`\notin`, \`\rightleftharpoons`, \`\buildrel`, \`\doteq`, \`\bmod` and \`\pmod` macros from plain \TeX/. \_cod ----------------------------- \_protected\_def\_cong{\_mathrel{\_mathpalette\_overeq\_sim}} % congruence sign \_def\_overeq#1#2{\_lower.05em\_vbox{\_lineskiplimit\_maxdimen\_lineskip=-.05em \_ialign{$\_math#1\_hfil##\_hfil$\_crcr#2\_crcr=\_crcr}}} \_protected\_def\_notin{\_mathrel{\_mathpalette\_icancel\_in}} \_def\_icancel#1#2{\_math\_ooalign{$\_hfil#1\_mkern1mu/\_hfil$\_crcr$#1#2$}} \_protected\_def\_rightleftharpoons{\_mathrel{\_mathpalette\_rlhp{}}} \_def\_rlhp#1{\_vcenter{\_math\_hbox{\_ooalign{\_raise.2em \_hbox{$#1\_rightharpoonup$}\_crcr $#1\_leftharpoondown$}}}} \_protected\_def\_buildrel#1\over#2{\_mathrel{\_mathop{\_kern\_zo #2}\_limits^{#1}}} \_protected\_def\_doteq{\_buildrel\_textstyle.\over=} \_private \in \sim ; \_public \cong \notin \rightleftharpoons \buildrel \doteq ; \_protected\_def\_bmod{\_nonscript\_mskip-\_medmuskip\_mkern5mu \_mathbin{\_rm mod}\_penalty900\_mkern5mu\_nonscript\_mskip-\_medmuskip} \_protected\_def\_pmod#1{\_allowbreak\_mkern18mu({\_rm mod}\_thinsk\_thinsk#1)} \_public \bmod \pmod ; \_doc ----------------------------- \`\matrix` and \`\pmatrix` behave as in Plain \TeX/, if it is used in the `\displaystyle`. On the other hand, it is printed in smaller size (by appropriate amount) in `\textstyle` = `\scriptstyle` and `\scriptscriptstyle`. This feature is new in \OpTeX/. \_cod ----------------------------- \_protected\_def\_matrix#1{\_null\_thinsk \_edef\_tmpa{\_the\_numexpr \_mathstyle/4\_relax}% 0 0 1 1 1 1 2 2 \_vcenter{\_matrixbaselines\_math \_ialign{\_the\_lmfil$\_matrixstyle##$\_hfil&&\_quad\_the\_lmfil$\_matrixstyle##$\_hfil\_crcr \_mathstrut\_crcr\_noalign{\_kern-\_baselineskip} #1\_crcr\_mathstrut\_crcr\_noalign{\_kern-\_baselineskip}}}\_thinsk} \_def\_matrixbaselines{\_normalbaselines \_def\_matrixstyle{}% \_let\_matrixbaselines=\_relax % \matrix inside matrix does not change size again \_ifcase\_tmpa \_or \_baselineskip=.7\_baselineskip \_def\_quad {\_hskip.7em\_relax}% \_let\_matrixstyle=\_scriptstyle \_or \_baselineskip=.5\_baselineskip \_def\_quad {\_hskip.5em\_relax}% \_let\_matrixstyle=\_scriptscriptstyle \_fi } \_protected\_def\_pmatrix#1{\_left(\_matrix{#1}\_right)} \_public \matrix \pmatrix ; \_doc ----------------------------- The \`\cases` and \`\bordermatrix` macros are almost identical as in plain \TeX/. You can simply re-define `\bordermatrix` with other delimiters using the common \`\_bordermatrixwithdelims` macro. \_cod ----------------------------- \_protected\_long\_def\_cases#1{\_left\{\_thinsk\_vcenter{\_normalbaselines\_math \_ialign{$##\_hfil$&\_quad{##\_unsskip}\_hfil\_crcr#1\_crcr}}\_right.} \_newdimen\_ptrenwd \_ptrenwd=8.75pt % width of the big left ( \_protected\_def\_bordermatrix{\_bordermatrixwithdelims()} \_def\_bordermatrixwithdelims#1#2#3{\_begingroup \_math \_setbox0=\_vbox{\_bordermatrixA #3\_stopbmatrix}% \_setbox2=\_vbox{\_unvcopy0 \_global\_setbox1=\_lastbox}% \_setbox2=\_hbox{\_unhbox1 \_unskip\_global\_setbox1=\_lastbox}% \_setbox2=\_hbox{$\_kern\_wd1 \_kern-\_ptrenwd\_left#1\_kern-\_wd1 \_global\_setbox1=\_vbox{\_box1 \_kern.2em}% \_vcenter{\_kern-\_ht1 \_unvbox0 \_kern-\_baselineskip}\_thinsk\_right#2$}% \_null\_thicksk\_vbox{\_kern\_ht1 \_box2}\_endgroup} \_def\_bordermatrixA #1\cr#2\_stopbmatrix{% \_ialign{$##$\_hfil\_kern.2em\_kern\_ptrenwd&\_thinspace\_hfil$##$\_hfil &&\_quad\_hfil$##$\_hfil\_crcr \_omit\_strut\_hfil\_crcr\_noalign{\_kern-\_baselineskip}% #1\_crcr\_noalign{\_kern.2em}#2\_crcr\_omit\_strut\_cr}} \_public \cases \bordermatrix ; \_doc ----------------------------- The \`\eqalign` macro behaves like in Plain \TeX/ by default. It creates the `\vcenter` in the math mode. The content is two column `\halign` with right-aligned left column and left-aligned right column. The table items are in `\displaystyle` and the `\baselineskip` is advanced by `\jot` (3pt in plain \TeX). It follows from the default settings of \^`\eqlines` and \^`\eqstyle` parameters. In \OpTeX/, this macro is more flexible. See section 4.4 in the \ulink[http://petr.olsak.net/ftp/olsak/optex/optex-math.pdf] {Typesetting Math with \OpTeX/}. The `\baselineskip` value is set by the \^`\eqlines` parameter and math style by the \^`\eqstyle` parameter. There are more possible columns than two (used in classical Plain TeX): `rlcrlcrlc` etc.\ where `r` and `l` columns are without spaces and `c` column (if used) has space \^`\eqspace`/2 at its both sides. \_cod ----------------------------- \_long\_def\_eqalign#1{\_null\_thinsk\_vcenter{\_the\_eqlines\_math \_ialign{&\_hfil$\_the\_eqstyle{##}$&$\_the\_eqstyle{{}##}$\_hfil &\_hskip.5\_eqspace\_hfil$\_the\_eqstyle{##}$\_hskip.5\_eqspace\_hfil \_crcr#1\_crcr}}\_thinsk} \_public \eqalign ; \_doc ----------------------------- The \`\displaylines``{\cr\cr...}` creates horizontally centered formulae. It behaves exactly as in Plain \TeX/. The `\halign` is applied directly in the outer display environment with lines of type `\hbox to\displaywidth`. This enables to break lines inside such display to more pages but it is impossible to use `\eqno` or `\leqno` or \^`\eqmark`. \OpTeX/ offers `\dislaylines to{\cr\cr...}` as an alternative case of usage `\displaylines`. See section 4.3 in the \ulink[http://petr.olsak.net/ftp/olsak/optex/optex-math.pdf] {Typesetting Math with \OpTeX/}. The centered formulas are in `\vcenter` in this case, so lines cannot be broken into more pages, but this case enables to use `\eqno` or `\leqno` or \^`\eqmark`. \_cod ----------------------------- \_def\_displaylines #1#{\_ifx&\_ea\_displaylinesD \_else \_def\_tmp to##1\_end{\_def\_tmp{\_dimexpr ##1}}\_tmp #1\_end \_ea\_displaylinesto \_fi} \_long\_def\_displaylinesD #1{\_display \_tabskip=\_zoskip \_halign{\_hbox to\_displaywidth{$\_elign\_hfil\_displaystyle##\_hfil$}\_crcr #1\_crcr}} \_long\_def\_displaylinesto #1{\_vcenter{\_openup\_jot \_math \_tabskip=\_zoskip \_halign{\_strut\_hbox to\_span\_tmp{$\_hss\_displaystyle##\_hss$}\_crcr #1\_crcr}}} \_public\displaylines ; \_doc ----------------------------- \`\openup`, \`\eqalignno` and \`\leqalignno` macros are copied from Plain \TeX/ unchanged. \_cod ----------------------------- \_def\_openup{\_afterassignment\_openupA\_dimen0=} \_def\_openupA{\_advance\_lineskip by\_dimen0 \_advance\_baselineskip by\_dimen0 \_advance\_lineskiplimit by\_dimen0 } \_newifi\_ifdtop \_def\_display{\_global\_dtoptrue\_openup\_jot\_math \_everycr{\_noalign{\_ifdtop \_global\_dtopfalse \_ifdim\_prevdepth>-1000pt \_vskip-\_lineskiplimit \_vskip\_normallineskiplimit \_fi \_else \_penalty\_interdisplaylinepenalty \_fi}}} \_def\_elign{\_tabskip=\_zoskip\_everycr{}} % restore inside \_display \_long\_def\_eqalignno#1{\_display \_tabskip=\_centering \_halign to\_displaywidth{\_hfil$\_elign\_displaystyle{##}$\_tabskip=\_zoskip &$\_elign\_displaystyle{{}##}$\_hfil\_tabskip\_centering &\_hbox to\_zo{\_hss$\_elign##$}\_tabskip\_zoskip\_crcr #1\_crcr}} \_long\_def\_leqalignno#1{\_display \_tabskip=\_centering \_halign to\_displaywidth{\_hfil$\_elign\_displaystyle{##}$\_tabskip=\_zoskip &$\_elign\_displaystyle{{}##}$\_hfil\_tabskip=\_centering &\_kern-\_displaywidth\_hbox to\_zo{$\_elign##$\_hss}\_tabskip\_displaywidth\_crcr #1\_crcr}} \_public \openup \eqalignno \leqalignno ; \_doc ----------------------------- These macros are inspired by `ams-math.tex` file. \maxlines=15 \_cod ----------------------------- \_def\_amsafam{4} \_def\_amsbfam{5} \_mathchardef \boxdot "2\_amsafam 00 \_mathchardef \boxplus "2\_amsafam 01 \_mathchardef \boxtimes "2\_amsafam 02 \_mathchardef \square "0\_amsafam 03 \_mathchardef \blacksquare "0\_amsafam 04 \_mathchardef \centerdot "2\_amsafam 05 \_mathchardef \lozenge "0\_amsafam 06 \_mathchardef \blacklozenge "0\_amsafam 07 \_mathchardef \circlearrowright "3\_amsafam 08 \_mathchardef \circlearrowleft "3\_amsafam 09 \_mathchardef \rightleftharpoons "3\_amsafam 0A \_mathchardef \leftrightharpoons "3\_amsafam 0B \_mathchardef \boxminus "2\_amsafam 0C \_mathchardef \Vdash "3\_amsafam 0D \_mathchardef \Vvdash "3\_amsafam 0E \_mathchardef \vDash "3\_amsafam 0F \_mathchardef \twoheadrightarrow "3\_amsafam 10 \_mathchardef \twoheadleftarrow "3\_amsafam 11 \_mathchardef \leftleftarrows "3\_amsafam 12 \_mathchardef \rightrightarrows "3\_amsafam 13 \_mathchardef \upuparrows "3\_amsafam 14 \_mathchardef \downdownarrows "3\_amsafam 15 \_mathchardef \upharpoonright "3\_amsafam 16 \_mathchardef \downharpoonright "3\_amsafam 17 \_mathchardef \upharpoonleft "3\_amsafam 18 \_mathchardef \downharpoonleft "3\_amsafam 19 \_mathchardef \rightarrowtail "3\_amsafam 1A \_mathchardef \leftarrowtail "3\_amsafam 1B \_mathchardef \leftrightarrows "3\_amsafam 1C \_mathchardef \rightleftarrows "3\_amsafam 1D \_mathchardef \Lsh "3\_amsafam 1E \_mathchardef \Rsh "3\_amsafam 1F \_mathchardef \rightsquigarrow "3\_amsafam 20 \_mathchardef \leftrightsquigarrow "3\_amsafam 21 \_mathchardef \looparrowleft "3\_amsafam 22 \_mathchardef \looparrowright "3\_amsafam 23 \_mathchardef \circeq "3\_amsafam 24 \_mathchardef \succsim "3\_amsafam 25 \_mathchardef \gtrsim "3\_amsafam 26 \_mathchardef \gtrapprox "3\_amsafam 27 \_mathchardef \multimap "3\_amsafam 28 \_mathchardef \therefore "3\_amsafam 29 \_mathchardef \because "3\_amsafam 2A \_mathchardef \doteqdot "3\_amsafam 2B \_mathchardef \triangleq "3\_amsafam 2C \_mathchardef \precsim "3\_amsafam 2D \_mathchardef \lesssim "3\_amsafam 2E \_mathchardef \lessapprox "3\_amsafam 2F \_mathchardef \eqslantless "3\_amsafam 30 \_mathchardef \eqslantgtr "3\_amsafam 31 \_mathchardef \curlyeqprec "3\_amsafam 32 \_mathchardef \curlyeqsucc "3\_amsafam 33 \_mathchardef \preccurlyeq "3\_amsafam 34 \_mathchardef \leqq "3\_amsafam 35 \_mathchardef \leqslant "3\_amsafam 36 \_mathchardef \lessgtr "3\_amsafam 37 \_mathchardef \backprime "0\_amsafam 38 \_mathchardef \risingdotseq "3\_amsafam 3A \_mathchardef \fallingdotseq "3\_amsafam 3B \_mathchardef \succcurlyeq "3\_amsafam 3C \_mathchardef \geqq "3\_amsafam 3D \_mathchardef \geqslant "3\_amsafam 3E \_mathchardef \gtrless "3\_amsafam 3F \_mathchardef \sqsubset "3\_amsafam 40 \_mathchardef \sqsupset "3\_amsafam 41 \_mathchardef \vartriangleright "3\_amsafam 42 \_mathchardef \vartriangleleft "3\_amsafam 43 \_mathchardef \trianglerighteq "3\_amsafam 44 \_mathchardef \trianglelefteq "3\_amsafam 45 \_mathchardef \bigstar "0\_amsafam 46 \_mathchardef \between "3\_amsafam 47 \_mathchardef \blacktriangledown "0\_amsafam 48 \_mathchardef \blacktriangleright "3\_amsafam 49 \_mathchardef \blacktriangleleft "3\_amsafam 4A \_mathchardef \vartriangle "3\_amsafam 4D \_mathchardef \blacktriangle "0\_amsafam 4E \_mathchardef \triangledown "0\_amsafam 4F \_mathchardef \eqcirc "3\_amsafam 50 \_mathchardef \lesseqgtr "3\_amsafam 51 \_mathchardef \gtreqless "3\_amsafam 52 \_mathchardef \lesseqqgtr "3\_amsafam 53 \_mathchardef \gtreqqless "3\_amsafam 54 \_mathchardef \Rrightarrow "3\_amsafam 56 \_mathchardef \Lleftarrow "3\_amsafam 57 \_mathchardef \veebar "2\_amsafam 59 \_mathchardef \barwedge "2\_amsafam 5A \_mathchardef \doublebarwedge "2\_amsafam 5B \_mathchardef \angle "0\_amsafam 5C \_mathchardef \measuredangle "0\_amsafam 5D \_mathchardef \sphericalangle "0\_amsafam 5E \_mathchardef \varpropto "3\_amsafam 5F \_mathchardef \smallsmile "3\_amsafam 60 \_mathchardef \smallfrown "3\_amsafam 61 \_mathchardef \Subset "3\_amsafam 62 \_mathchardef \Supset "3\_amsafam 63 \_mathchardef \Cup "2\_amsafam 64 \_mathchardef \Cap "2\_amsafam 65 \_mathchardef \curlywedge "2\_amsafam 66 \_mathchardef \curlyvee "2\_amsafam 67 \_mathchardef \leftthreetimes "2\_amsafam 68 \_mathchardef \rightthreetimes "2\_amsafam 69 \_mathchardef \subseteqq "3\_amsafam 6A \_mathchardef \supseteqq "3\_amsafam 6B \_mathchardef \bumpeq "3\_amsafam 6C \_mathchardef \Bumpeq "3\_amsafam 6D \_mathchardef \lll "3\_amsafam 6E \_mathchardef \ggg "3\_amsafam 6F \_protected\_def \ulcorner {\_delimiter"4\_amsafam 70\_amsafam 70 } \_protected\_def \urcorner {\_delimiter"5\_amsafam 71\_amsafam 71 } \_mathchardef \circledS "0\_amsafam 73 \_mathchardef \pitchfork "3\_amsafam 74 \_mathchardef \dotplus "2\_amsafam 75 \_mathchardef \backsim "3\_amsafam 76 \_mathchardef \backsimeq "3\_amsafam 77 \_protected\_def \llcorner {\_delimiter"4\_amsafam 78\_amsafam 78 } \_protected\_def \lrcorner {\_delimiter"5\_amsafam 79\_amsafam 79 } \_mathchardef \complement "0\_amsafam 7B \_mathchardef \intercal "2\_amsafam 7C \_mathchardef \circledcirc "2\_amsafam 7D \_mathchardef \circledast "2\_amsafam 7E \_mathchardef \circleddash "2\_amsafam 7F \_mathchardef \rhd "2\_amsafam 42 \_mathchardef \lhd "2\_amsafam 43 \_mathchardef \unrhd "2\_amsafam 44 \_mathchardef \unlhd "2\_amsafam 45 \_let\restriction\upharpoonright \_let\Doteq\doteqdot \_let\doublecup\Cup \_let\doublecap\Cap \_let\llless\lll \_let\gggtr\ggg \_let\Box=\square % LaTeX symbol \_let\Box=\square % LaTeX symbol \_mathchardef \lvertneqq "3\_amsbfam 00 \_mathchardef \gvertneqq "3\_amsbfam 01 \_mathchardef \nleq "3\_amsbfam 02 \_mathchardef \ngeq "3\_amsbfam 03 \_mathchardef \nless "3\_amsbfam 04 \_mathchardef \ngtr "3\_amsbfam 05 \_mathchardef \nprec "3\_amsbfam 06 \_mathchardef \nsucc "3\_amsbfam 07 \_mathchardef \lneqq "3\_amsbfam 08 \_mathchardef \gneqq "3\_amsbfam 09 \_mathchardef \nleqslant "3\_amsbfam 0A \_mathchardef \ngeqslant "3\_amsbfam 0B \_mathchardef \lneq "3\_amsbfam 0C \_mathchardef \gneq "3\_amsbfam 0D \_mathchardef \npreceq "3\_amsbfam 0E \_mathchardef \nsucceq "3\_amsbfam 0F \_mathchardef \precnsim "3\_amsbfam 10 \_mathchardef \succnsim "3\_amsbfam 11 \_mathchardef \lnsim "3\_amsbfam 12 \_mathchardef \gnsim "3\_amsbfam 13 \_mathchardef \nleqq "3\_amsbfam 14 \_mathchardef \ngeqq "3\_amsbfam 15 \_mathchardef \precneqq "3\_amsbfam 16 \_mathchardef \succneqq "3\_amsbfam 17 \_mathchardef \precnapprox "3\_amsbfam 18 \_mathchardef \succnapprox "3\_amsbfam 19 \_mathchardef \lnapprox "3\_amsbfam 1A \_mathchardef \gnapprox "3\_amsbfam 1B \_mathchardef \nsim "3\_amsbfam 1C \_mathchardef \ncong "3\_amsbfam 1D \_mathchardef \diagup "0\_amsbfam 1E \_mathchardef \diagdown "0\_amsbfam 1F \_mathchardef \varsubsetneq "3\_amsbfam 20 \_mathchardef \varsupsetneq "3\_amsbfam 21 \_mathchardef \nsubseteqq "3\_amsbfam 22 \_mathchardef \nsupseteqq "3\_amsbfam 23 \_mathchardef \subsetneqq "3\_amsbfam 24 \_mathchardef \supsetneqq "3\_amsbfam 25 \_mathchardef \varsubsetneqq "3\_amsbfam 26 \_mathchardef \varsupsetneqq "3\_amsbfam 27 \_mathchardef \subsetneq "3\_amsbfam 28 \_mathchardef \supsetneq "3\_amsbfam 29 \_mathchardef \nsubseteq "3\_amsbfam 2A \_mathchardef \nsupseteq "3\_amsbfam 2B \_mathchardef \nparallel "3\_amsbfam 2C \_mathchardef \nmid "3\_amsbfam 2D \_mathchardef \nshortmid "3\_amsbfam 2E \_mathchardef \nshortparallel "3\_amsbfam 2F \_mathchardef \nvdash "3\_amsbfam 30 \_mathchardef \nVdash "3\_amsbfam 31 \_mathchardef \nvDash "3\_amsbfam 32 \_mathchardef \nVDash "3\_amsbfam 33 \_mathchardef \ntrianglerighteq "3\_amsbfam 34 \_mathchardef \ntrianglelefteq "3\_amsbfam 35 \_mathchardef \ntriangleleft "3\_amsbfam 36 \_mathchardef \ntriangleright "3\_amsbfam 37 \_mathchardef \nleftarrow "3\_amsbfam 38 \_mathchardef \nrightarrow "3\_amsbfam 39 \_mathchardef \nLeftarrow "3\_amsbfam 3A \_mathchardef \nRightarrow "3\_amsbfam 3B \_mathchardef \nLeftrightarrow "3\_amsbfam 3C \_mathchardef \nleftrightarrow "3\_amsbfam 3D \_mathchardef \divideontimes "2\_amsbfam 3E \_mathchardef \varnothing "0\_amsbfam 3F \_mathchardef \nexists "0\_amsbfam 40 \_mathchardef \Finv "0\_amsbfam 60 \_mathchardef \Game "0\_amsbfam 61 \_mathchardef \mho "0\_amsbfam 66 \_mathchardef \eth "0\_amsbfam 67 \_mathchardef \eqsim "3\_amsbfam 68 \_mathchardef \beth "0\_amsbfam 69 \_mathchardef \gimel "0\_amsbfam 6A \_mathchardef \daleth "0\_amsbfam 6B \_mathchardef \lessdot "2\_amsbfam 6C \_mathchardef \gtrdot "2\_amsbfam 6D \_mathchardef \ltimes "2\_amsbfam 6E \_mathchardef \rtimes "2\_amsbfam 6F \_mathchardef \shortmid "3\_amsbfam 70 \_mathchardef \shortparallel "3\_amsbfam 71 \_mathchardef \smallsetminus "2\_amsbfam 72 \_mathchardef \thicksim "3\_amsbfam 73 \_mathchardef \thickapprox "3\_amsbfam 74 \_mathchardef \approxeq "3\_amsbfam 75 \_mathchardef \precapprox "3\_amsbfam 76 \_mathchardef \succapprox "3\_amsbfam 77 \_mathchardef \curvearrowleft "3\_amsbfam 78 \_mathchardef \curvearrowright "3\_amsbfam 79 \_mathchardef \digamma "0\_amsbfam 7A \_mathchardef \varkappa "0\_amsbfam 7B \_mathchardef \Bbbk "0\_amsbfam 7C \_mathchardef \hslash "0\_amsbfam 7D \_mathchardef \hbar "0\_amsbfam 7E \_mathchardef \backepsilon "3\_amsbfam 7F \_let\circledplus\oplus \_let\circledminus\ominus \_let\circledtimes\otimes \_let\circledslash\oslash \_let\circleddot\odot \_doc ----------------------------- The \^`\not` macro is re-defined to be smarter than in plain \TeX/. The macro follows this rule: \begtt \not< becomes \_nless \not> becomes \_ngtr if \_notXXX is defined, \not\XXX becomes \_notXXX; if \_nXXX is defined, \not\XXX becomes \_nXXX; otherwise, \not\XXX is done in the usual way. \endtt \_cod ----------------------------- \_mathchardef \_notchar "3236 \_protected\_def \_not#1{% \_ifx #1<\_nless \_else \_ifx #1>\_ngtr \_else \_edef\_tmpn{\_csstring#1}% \_ifcsname _not\_tmpn\_endcsname \_csname _not\_tmpn\_endcsname \_else \_ifcsname _n\_tmpn\_endcsname \_csname _n\_tmpn\_endcsname \_else \_mathrel{\_mathord{\_notchar}\_mathord{#1}}% \_fi \_fi \_fi \_fi} \_private \nleq \ngeq \nless \ngtr \nprec \nsucc \nleqslant \ngeqslant \npreceq \nsucceq \nleqq \ngeqq \nsim \ncong \nsubseteqq \nsupseteqq \nsubseteq \nsupseteq \nparallel \nmid \nshortmid \nshortparallel \nvdash \nVdash \nvDash \nVDash \ntrianglerighteq \ntrianglelefteq \ntriangleleft \ntriangleright \nleftarrow \nrightarrow \nLeftarrow \nRightarrow \nLeftrightarrow \nleftrightarrow \nexists ; \_public \not ; \_doc ----------------------------- \`\mathstyles``{}` behaves like `{}`, but you can use the following commands in the ``: \begitems * \`\currstyle` which expands to `\displaystyle`, `\textstyle`, `\scriptstyle` or `\scriptscriptstyle` depending on the current math style when \^`\mathstyles` was opened. * \`\dobystyle``{}{}{}{}` is expandable macro. It expands to ``, ``, `` or `` depending on the current math style when \^`\mathstyles` was opened. * The value of the \`\stylenum` is 0, 1, 2 or 3 depending on the current math style when \^`\mathstyles` was opened. \enditems Example of usage of \^`\mathstyles`: `\def\mathframe#1{\mathstyles{\frame{$\currstyle{#1}$}}}`. \_cod ----------------------------- \_newcount\_stylenum \_def\_mathstyles#1{{\_mathchoice{\_stylenum0 #1}{\_stylenum1 #1}% {\_stylenum2 #1}{\_stylenum3 #1}}} \_def\_dobystyle#1#2#3#4{\_ifcase\_stylenum#1\_or#2\_or#3\_or#4\_fi} \_def\_currstyle{\_dobystyle\_displaystyle\_textstyle\_scriptstyle\_scriptscriptstyle} \_public \mathstyles \dobystyle \currstyle \stylenum ; \_doc ----------------------------- The \`\cramped` macro sets the cramped variant of the current style. Note that \^`\currstyle` initializes non-cramped variants. The example `\mathframe` above should be:\nl `\def\mathframe#1{\mathstyles{\frame{$\currstyle\cramped #1$}}}`.\nl Second note: `\cramped` macro reads the current math style from the `\mathstyle` LuaTeX primitive, so it does not work in numerators of generalized fractions but you can use it before the fraction is opened: `$\cramped {x^2\over y^2}$`. \_cod ----------------------------- \_def\_cramped{\_ifcase\_numexpr(\_mathstyle+1)/2\_relax\_or \_crampeddisplaystyle \_or \_crampedtextstyle \_or \_crampedscriptstyle \_or \_crampedscriptscriptstyle \_fi } \_public \cramped ; \_doc ----------------------------- \`\setmathstyle` saves current math style (including its cramped/normal subversion) and \`\usemathstyle` restores the saved math style. These macros are based on the \LuaTeX/'s `\mathstyle` primitive, i.e.\ they don't work in generalized fractions.\nl Usage: `\def\mathclap #1{{\setmathstyle \hbox to0pt{\hss$\usemathstyle#1$\hss}}}`. \_cod \_newcount\_mstylenum \_def\_setmathstyle{\_mstylenum=\_mathstyle\_relax} \_def\_usemathstyle{\_ifcase\_mstylenum \_displaystyle\_or \_crampeddisplaystyle\_or \_textstyle\_or \_crampedtextstyle\_or \_scriptstyle\_or \_crampedscriptstyle\_or \_scriptscriptstyle\_or \_crampedscriptscriptstyle \_fi } \_public \setmathstyle \usemathstyle ; \_doc ----------------------------- The \`\mathbox``{}` macro is copied from OPmac trick 078. It behaves like `\hbox{}` but the `` is scaled to a smaller size if it is used in scriptstyle or scriptscript style.\nl The \^`\_textmff` and \^`\_scriptmff` are redefined in order to respect optical sizes. If we are in script style then the math mode starts in text style, but optical size is given to script style. The `\mathbox` in non-Unicode math respects optical sizes using different principle. \_cod ----------------------------- \_def\_mathbox#1{{\_mathstyles{\_hbox{% \_ifnum\_stylenum<2 \_everymath{\_currstyle}% \_else \_ifnum\_stylenum=2 \_def\_textmff{ssty=1;}\_fi \_ifnum\_stylenum=3 \_def\_textmff{ssty=2;}\_def\_scriptmff{ssty=2;}\_fi \_typoscale[\_dobystyle{}{}{700}{500}/]\_fi #1}}}% } \_public \mathbox ; \_endcode %--------------------------------------------------- 2023-05-24 \matsbon: "local num" added 2023-05-22 \mathsbon: \alpha_i\beta_j -> \alpha _i\beta _j (bug fixed) 2023-04-15 \bbig introduced 2023-03-12 \setmathstyle, \usemathstyle introduced 2021-08-02 ssty fontfeatures rewritten 2021-04-25 \triangleright: typo fixed 2021-03-22 \(l)eqalignno: \hbox instead \llap, \rlap (\par error suppressed) 2021-03-19 allow text mode \{ and \} 2021-02-15 \_mathbox redefines \_textmff etc. in order to respect optical sizes 2021-02-04 \_bordermatrixwithdelims introduced. 2021-01-23 better expession for math styles in \matrix 2021-01-22 bad use of \_stylenum in \matrix + bad value (bug fix: \_stylenum->\_mtstylenum) 2020-12-17 \box0->\hbox{\box0} in \_finphant and \_finsmash, see https://tex.stackexchange.com/questions/574997/ 2020-06-14 \borermatrix, \cases corrected 2020-06-13 \adots introduced, \matrix smaller in T mode too. 2020-06-03 \notin corrected 2020-06-02 $$\par$$ error is supressed, so we define \(l)eqalign(no), \displayines as \long 2020-05-30 \cases: group added in the second column. "\displaylines to" implemented and documented. 2020-05-11 \let\|=\Vert, bug fixed 2020-04-27 \mathstyles introduced 2020-03-14 implemented