summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/optex/math-unicode.opm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/optex/math-unicode.opm')
-rw-r--r--Master/texmf-dist/tex/luatex/optex/math-unicode.opm156
1 files changed, 127 insertions, 29 deletions
diff --git a/Master/texmf-dist/tex/luatex/optex/math-unicode.opm b/Master/texmf-dist/tex/luatex/optex/math-unicode.opm
index fe823b96f4a..a2c455f2518 100644
--- a/Master/texmf-dist/tex/luatex/optex/math-unicode.opm
+++ b/Master/texmf-dist/tex/luatex/optex/math-unicode.opm
@@ -2,6 +2,20 @@
\_codedecl \loadmath {Unicode Math fonts <2020-02-25>} % preloaded in format
+ \_doc -----------------------------
+ \`\loadmath` `{<Unicode-math font>}` loads given font. It does:
+ \begitems
+ * define \`\_unimathfont` as `<Unicode-math font>`,
+ * redefine `\normalmath` and `\boldmath` macros to their Unicode counterparts,
+ * load the `\_unimathfont` by `\normalmath`,
+ * print information about loaded font on the terminal,
+ * redefine all encoding dependent setting by `\input unimath-codes.opm`,
+ * protect new loading by setting \`\_ifmathloading` to false.
+ \enditems
+ \`\noloadmath` disallows Unicode-math loading by \`\_mathloadingfalse`.\nl
+ \`\doloadmath` allows Unicode-math loading by \`\_mathloadingtrue`.
+ \_cod -----------------------------
+
\_newifi \_ifmathloading \_mathloadingtrue
\_def\_noloadmath{\_mathloadingfalse}
@@ -17,10 +31,20 @@
\_let\_normalmath = \_normalunimath \_let\_boldmath = \_boldunimath
\_normalmath
\_wterm {MATH-FONT: "#1" -- unicode math prepared.}%
- \_setctable\_optexcatcodes \_input unimath-codes.opm \_restorectable
+ \_opinput {unimath-codes.opm}%
\_mathloadingfalse
\_fi\_fi}
+\_public \loadmath \noloadmath \doloadmath ;
+
+ \_doc -----------------------------
+ \`\loadboldmath` `{<bold-font>} \to {<normal-font>}`
+ defines \`\_unimathboldfont` as `<bold-font>` only if `\_unimathfont` is
+ defined as `<normal-font>`. It is used when `\boldmath` macro is run.
+ When no `\_unimathboldfont` is defined then the `\boldmath` macro
+ use \"fake bold" generated by `embolden` \LuaTeX/ font feature.
+ \_cod -----------------------------
+
\_def\_loadboldmath#1#2\to #3{%
\_def\_tmp{#3}\_ifx\_unimathfont\_tmp % do work only if #3 is loaded as normal Math
\_isfont"#1"\_iffalse
@@ -30,10 +54,19 @@
\_wterm {MATH-FONT: "#1" -- unicode math bold prepared.}%
\_fi\_fi}
+\_public \loadboldmath ;
+
+ \_doc -----------------------------
+ The Unicode version of the \^`\normalmath` and \^`\boldmath` macros
+ are defined here as \`\_normalunimath` and \`\_boldunimath` macros.
+ They are using \`\_setunimathdimens` in similar sense as
+ \^`\_setmathdimens`.
+ \_cod -----------------------------
+
\_def\_normalunimath{%
\_loadumathfamily 1 {\_unimathfont}{} % Base font
\_loadmathfamily 4 rsfs % script
- \_setmathdimens
+ \_setunimathdimens
}%
\_def\_boldunimath{%
\_ifx\_unimathboldfont \_undefined
@@ -42,9 +75,26 @@
\_loadumathfamily 1 {\_unimathboldfont}{} % Base real bold font
\_fi
\_loadmathfamily 4 rsfs % script
- \_setmathdimens
+ \_setunimathdimens
}%
+\_def\_setunimathdimens{% PlainTeX sets these dimens for 10pt size only:
+ \_delimitershortfall=0.5\_fontdimen6\_textfont3
+ \_nulldelimiterspace=0.12\_fontdimen6\_textfont3
+ \_scriptspace=0.05\_fontdimen6\_textfont3
+}
+ \_doc -----------------------------
+ \`\_loadumathfamily` `<number> {<font>}{<font features>}`
+ loads the given Unicode-math fonts in three sizes given by the
+ \^`\setmathsizes` macro and sets it as the math family `<number>`.
+ The `<font features>` are added to the default
+ \`\_mfontfeatures` and to the size dependent features `+ssty=0`
+ if script size is asked or `+ssty=1` if scriptscriptsize is asked.
+ If the fath family 1 is loaded then the family 2 and 3 is set by the same
+ font because \TeX/ needs to read dimension information about generating
+ math formulae from these three math families. All information needed by
+ \TeX/ is collected in single Unicode-math font.
+ \_cod -----------------------------
\_def\_umathname#1#2{"#1:\_mfontfeatures#2"}
\_def\_mfontfeatures{mode=base;script=math;}
@@ -55,11 +105,40 @@
\_ifnum#1=1 \_textfont2=\_mF \_textfont3=\_mF \_fi
\_optsize=\_sizemscript \_font\_mF=\_umathname{#2}{+ssty=0;#3} at\_optsize \_scriptfont#1=\_mF
\_ifnum#1=1 \_scriptfont2=\_mF \_scriptfont3=\_mF \_fi
- \_optsize=\_sizemsscript \_font\_mF=\_umathname{#2}{+ssty=1;#3} at\_optsize \_scriptscriptfont#1=\_mF
+ \_optsize=\_sizemsscript \_font\_mF=\_umathname{#2}{+ssty=1;#3} at\_optsize\_scriptscriptfont#1=\_mF
\_ifnum#1=1 \_scriptscriptfont2=\_mF \_scriptscriptfont3=\_mF \_fi
\_optsize=\_optsizesave \_relax
}
+ \_doc -----------------------------
+ Unicode math font includes all typical math alphabets together, user needs not to
+ load more \TeX/ math families. These math aphabets are encoded by
+ different parts of Unicode table. We need auxiliary macros for setting
+ mathcodes by selected math alphabet.
+ \nl
+ \`\_umathrange` `{<from->-<to>}\<first>` sets `\Umathcode`s
+ of the characters in the interval `<from>-<to>` to `\<first>`,
+ `\<first>+1`, `\<first>+2`
+ etc., but \`\_umathcharholes` are skipped
+ (`\_umathcharholes` are parts of the Unicode table not designed for math
+ alphabets but they causes that the math alphabets are
+ not continuously spread out in the table; I mean that the
+ designers were under the influence of drugs when they created
+ this part of the Unicode table).
+ The `<from>-<to>` clause includes normal letters like `A-Z`.
+ \nl
+ \`\_umahrangegreek` `\<first>` is the same as
+ `\_umathrange {<alpha>-<omega>}\<first>`.
+ \nl
+ \`\_umahrangeGREEK` `\<first>` is the same as
+ `\_umathrange {<Alpha>-<Omega>}\<first>`.
+ \nl
+ \`\_greekdef` `<control sequences> \_relax` defines each control sequence
+ as a normal character with codes `\_umathnumB`, `\_umathnumB+1`,
+ `\_umathnumB+2` etc. It is used for redefinig the contol sequences for
+ math Greek `\alpha`, `\beta`, `\gamma` etc.
+ \_cod -----------------------------
+
\_newcount\_umathnumA \_newcount\_umathnumB
\_def\_umathcorr#1#2{\_ea#1\_ea{\_the#2}}
@@ -95,19 +174,16 @@
\_expandafter\_greekdef \_fi
}
-\_public
- \loadmath \loadboldmath \noloadmath \doloadmath ;
-
\_endcode
---------------------------------------------
-The `\loadmath` macro loads math fonts and sets math-codes using \input
-unimath-codes.opm. If UnicodeMath font is loaded then `\_mathloadingfalse`
-is set, so new UnicodeMath font isn't loaded until `\domathload` is used.
+The \^`\loadmath` `{<Unicode-math font>}` macro loads math fonts and
+redefines all default math-codes using `\input unimath-codes.opm`.
+If Unicode-math font is loaded then \^`\_mathloadingfalse`
+is set, so new UnicodeMath font isn't loaded until \^`\doloadmath` is used.
-`\loadadboldmath{<bold-font>} \to {<normal-font>}` loads bold variant only
-if <normal-font> was sucessully loaded. For example:
+\^`\loadboldmath` `{<bold-font>} \to {<normal-font>}` loads bold variant only
+if `<normal-font>` was sucessully loaded by the `\loadmath`. For example:
\begtt
\loadmath {[xitsmath-regular]}
@@ -115,24 +191,46 @@ if <normal-font> was sucessully loaded. For example:
\endtt
You can combine more fonts, if you register them to another
-math families (5, 6, 7, etc.) in \normalmath macro.
+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 `\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.
+See \url{http://tex.stackexchange.com/questions/308749/} for more technical details.
+
+The \^`\loadmath` macro was succesfully tested on:
+
+\begtt
+\loadmath{[XITSMath-Regular]} ... XITS MATH
+\loadmath{[latinmodern-math]} ... Latin Modern Math
+\loadmath{[texgyretermes-math]} ... TeXGyre Termes Math
+\loadmath{[texgyrebonum-math]} ... TeXGyre Bonum Math
+\loadmath{[texgyrepagella-math]} ... TeXGyre Pagella Math
+\loadmath{[texgyreschola-math]} ... TeXGyre Schola Math
+\loadmath{[texgyredejavu-math]} ... TeXGyre DeJaVu Math
+\loadmath{[LibertinusMath-Regular]} ... Libertinus Math
+\loadmath{[FiraMath-Regular]} ... Fira Math
+\loadmath{[Asana-Math]} ... Asana Math
+\endtt
+
+\secc Unicode-math macros preloaded in the format
+
+\printdoc math-unicode.opm
+
+\secc Macros and codes set when \code{\\loadmatfont} is processed
+
+The file `unimath-codes.opm` is loaded when the \^`\loadmath` is used. The
+macros here redefines globally all encoding dependent settings declared in
+the section~\ref[math-macros].
+
+\printdoc unimath-codes.opm
+\printdoctail unimath-codes.opm
+
+
---------------------
+\_endinput
-\loadmath{[XITSMath-Regular]} ... XITS MATH^^J
-\loadmath{[latinmodern-math]} ... Latin Modern Math^^J
-\loadmath{[texgyretermes-math]} ... TeXGyre Termes Math^^J
-\loadmath{[texgyrebonum-math]} ... TeXGyre Bonum Math^^J
-\loadmath{[texgyrepagella-math]} ... TeXGyre Pagella Math^^J
-\loadmath{[texgyreschola-math]} ... TeXGyre Schola Math^^J
-\loadmath{[texgyredejavu-math]} ... TeXGyre DeJaVu Math^^J
-\loadmath{[LibertinusMath-Regular]} ... Libertinus Math^^J
-\loadmath{[FiraMath-Regular]} ... Fira Math^^J
-\loadmath{[Asana-Math]} ... Asana Math^^J
+2020-04-15 \_setmathdimens -> \_setuniathdimens
+2020-02-25 implemented