summaryrefslogtreecommitdiff
path: root/macros/luatex/optex/unimath-codes.opm
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/optex/unimath-codes.opm')
-rw-r--r--macros/luatex/optex/unimath-codes.opm91
1 files changed, 71 insertions, 20 deletions
diff --git a/macros/luatex/optex/unimath-codes.opm b/macros/luatex/optex/unimath-codes.opm
index 83d59835b5..f1d0b01b0f 100644
--- a/macros/luatex/optex/unimath-codes.opm
+++ b/macros/luatex/optex/unimath-codes.opm
@@ -2,6 +2,13 @@
\_codedecl \_ncharrmA {Uni math codes <2020-03-14>} % preloaded on demand by \loadmath
+ \_doc -----------------------------
+ The control sequences for `\alpha`, `\beta` etc are redefined here.
+ The `\alpha` expands to the charcter with unicode `"03B1`, this is normal
+ character $α$. You can type in directly in your editor, if you know how
+ to do this.
+ \_cod -----------------------------
+
\_umathnumB="0391
\_greekdef \Alpha \Beta \Gamma \Delta \Epsilon \Zeta \Eta \Theta \Iota \Kappa
\Lambda \Mu \Nu \Xi \Omicron \Pi \Rho \varTheta \Sigma \Tau \Upsilon \Phi
@@ -12,6 +19,10 @@
\lambda \mu \nu \xi \omicron \pi \rho \varsigma \sigma \tau \upsilon
\varphi \chi \psi \omega \varbeta \vartheta \phi \varpi \_relax
+ \_doc -----------------------------
+ The math alphabets are declared here using the \^`\_umathrange` macro.
+ \_cod -----------------------------
+
\_chardef\_ncharrmA=`A \_chardef\_ncharrma=`a
\_chardef\_ncharbfA="1D400 \_chardef\_ncharbfa="1D41A
\_chardef\_ncharitA="1D434 \_chardef\_ncharita="1D44E
@@ -78,6 +89,14 @@
\_protected\_def\_bsansdigits {\_umathrange{0-9}\_digitbsO}
\_protected\_def\_ttdigits {\_umathrange{0-9}\_digitttO}
+ \_doc -----------------------------
+ The `\rm`, `\it`, `\cal` etc. are redefined here.\nl
+ You can redefine them if you need different behavior (for example
+ you don't want to use sans serif bold in math).
+ When you do this then you must repeat `\_public \bf ;`\nl
+ \`\_inmath` `{<cmds>}` applies `<cmds>` only in math mode.
+ \_cod -----------------------------
+
\_protected\_def\_inmath#1{\_relax \_ifmmode#1\_fi} % to keep off \loop processing in text mode
% You can redefine these macros to follow your wishes.
@@ -96,10 +115,15 @@
\_protected\_def\_mbisans {\_bisansvariables \_isansgreek \_bsansdigits}
\_protected\_def\_script {\_rmvariables \_fam4 }
-\_public
- \rm \it \bf \bi \tt \bbchar \cal \frak \misans \mbisans \script ;
+\_public \rm \it \bf \bi \tt \bbchar \cal \frak \misans \mbisans \script ;
-% Math codes:
+ \_doc -----------------------------
+ Each Unicode slot carries information about math type. This is saved in
+ the file `mathclass.txt` which is copied to `mathclass.opm` The file
+ has the following format:
+ {\vitt{mathclass.opm}\verbinput (70-85) mathclass.opm }
+ We have to read this information and convert it to the `\Umathcode`s.
+ \_cod -----------------------------
\_begingroup % \input mathclass.opm (which is a copy of MathClass.txt):
\_def\_p#1;#2{\_edef\_tmp{\_pB#2}\_ifx\_tmp\_empty \_else\_pA#1....\_end#2\_fi}
@@ -124,6 +148,13 @@
\_input mathclass.opm
\_endgroup
+ \_doc -----------------------------
+ Each math symbol has its declaration in the file `unicode-math-table.tex`
+ which is copied to `unimath-table.opm`. The file has following format:
+ {\vitt{unimath-table.opm}\verbinput (70-85) unimath-table.opm }
+ We have to read this information and convert it to the Unicode math codes.
+ \_cod -----------------------------
+
\_begingroup % \input unimath-table.opm (it is a copy of unicode-math-table.tex):
\_def\UnicodeMathSymbol #1#2#3#4{%
\_global\_Umathcharnumdef#2=\_Umathcodenum#1\_relax
@@ -134,6 +165,13 @@
\_input unimath-table.opm
\_endgroup
+ \_doc -----------------------------
+ Many special characters must be declared with care...
+ \_cod -----------------------------
+
+\_global\_Udelcode`<=1 "027E8 % these characters have different meaning
+\_global\_Udelcode`>=1 "027E9 % as normal and as delimeter
+
\_nitgreek \_nitvariables \_rmdigits % default setting
\_Umathcode `- = 2 1 "2212
@@ -179,10 +217,14 @@
\_protected\def \overrightarrow {\Umathaccent 7 1 "020D7 }
\_protected\def \overleftrightarrow {\Umathaccent 7 1 "020E1 }
-% corrections:
-
\_mathchardef\ldotp="612E
\_let\|=\Vert
+\_mathcode`\_="8000
+
+ \_doc -----------------------------
+ Aliases are declared here. They are names not menitioned in the `unimath-table.opm` file
+ but commonly used in \TeX.
+ \_cod -----------------------------
\_let \setminus=\smallsetminus
\_let \diamond=\smwhtdiamond
@@ -242,6 +284,10 @@
\_let \upphi=\mupphi
\_let \upvarpi=\mupvarpi
+ \_doc -----------------------------
+ The \^`\not` macro is redefined here.
+ \_cod -----------------------------
+
\_protected\_def\_not#1{%
\_ifcsname _not!\_csstring#1\_endcsname \_csname _not!\_csstring#1\_endcsname
\_else \_mathrel{\_mathord{\_rlap{\_kern1pt/}}\_mathord{#1}}%
@@ -262,36 +308,34 @@
\_public \not ;
-% we need no more 8bit math fonts
-
-\mathcode`\_="8000
+ \_doc -----------------------------
+ Newly declared public control sequences are used in internal macros by
+ \OpTeX/. We need to get new meanings of these control sequences in
+ private name space.
+ \_cod -----------------------------
-\_private
+\_private
\ldotp \cdotp \bullet \triangleleft \trianglerigt \mapstochar \rightarrow
\prime \lhook \rightarrow \leftarrow \rhook \triangleright \triangleleft
\Relbar \Rightarrow \relbar \rightarrow \Leftarrow \mapstochar
\longrightarrow \Longleftrightarrow \vdots \ddots ;
-
\_endcode
---------------------------------------------
+\secc A few observations
-You can combine more fonts, if you register them to another
-math families (5, 6, 7, etc.) in \normalmath macro.
+You can combine more fonts in math, if you register them to another
+math families (5, 6, 7, etc.) in the \^`\normalmath` macro.
-The default value of \normalmath shows a combination of base Unicode Math
-font with 8bit Math font at family 4. See definition of \script macro where
-\fam4 is used. Of course, we need to set \rmvariables too, because 8bit font
+The default value of \^`\normalmath` shows a combination of base Unicode Math
+font with 8bit Math font at family 4. See definition of the `\script` macro where
+`\fam4` is used. Of course, we need to set `\rmvariables` too, because 8bit font
accepts only codes less than 255.
-See http://tex.stackexchange.com/questions/308749/ for more technical details.
-
------
-
XITSmath-bold needs correction: the norm symbol ||x|| is missing here. So, you
can define:
+\begtt
\def\_boldmath{%
\loadumathfamily 1 {[xitsmath-bold]}{} % Base font
\loadmathfamily 4 rsfs % script
@@ -299,3 +343,10 @@ can define:
\def\|{\Udelimiter 0 5 "02016 }% % norm delimiter from family 5
\setmathdimens
}
+\endtt
+
+\_endinput
+
+History:
+2020-04-09 Bug fix: \Udelcode`<, \Udelcode`> added
+ \ No newline at end of file