summaryrefslogtreecommitdiff
path: root/macros/luatex/optex/base/math-macros.opm
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-06-16 03:02:40 +0000
committerNorbert Preining <norbert@preining.info>2020-06-16 03:02:40 +0000
commit305bf45bf758ea76ec5be2a737bd8eb491f68921 (patch)
treea0d6ad7bdfc7a258d831c6dd746484263ff66b10 /macros/luatex/optex/base/math-macros.opm
parent539648a9305d6107a588ecdff34b5cdce48fb930 (diff)
CTAN sync 202006160302
Diffstat (limited to 'macros/luatex/optex/base/math-macros.opm')
-rw-r--r--macros/luatex/optex/base/math-macros.opm138
1 files changed, 83 insertions, 55 deletions
diff --git a/macros/luatex/optex/base/math-macros.opm b/macros/luatex/optex/base/math-macros.opm
index 71a7923906..6189dec1c7 100644
--- a/macros/luatex/optex/base/math-macros.opm
+++ b/macros/luatex/optex/base/math-macros.opm
@@ -1,6 +1,6 @@
%% This is part of OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \sin {Math macros plus mathchardefs <2020-05-11>} % preloaded in format
+\_codedecl \sin {Math macros plus mathchardefs <2020-06-13>} % preloaded in format
\_doc -----------------------------
The category code of the character `_` remains as letter (11) and the mathocode
@@ -433,13 +433,23 @@
\_protected\_def\_cdots{\_mathinner{\_cdotp\_cdotp\_cdotp}}
\_protected\_def\_vdots{\_vbox{\_baselineskip=.4em \_lineskiplimit=0pt
\_kern.6em \_hbox{.}\_hbox{.}\_hbox{.}}}
-\_protected\_def\_ddots{\_mathinner{%
+\_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` ispired 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 -----------------------------
@@ -563,6 +573,7 @@
$#1\_leftharpoondown$}}}}
\_protected\_def\_buildrel#1\over#2{\_mathrel{\_mathop{\_kern0pt #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
@@ -571,31 +582,32 @@
\_public \bmod \pmod ;
\_doc -----------------------------
- \`\matrix`, \`\pmatrix` and \`\bordermatrix`
+ \`\matrix` and \`\pmatrix`
behave as in Plain \TeX/, if it is used in the
- `\displaystyle` or `\textstyle`. On the other hand, it is printed in smaller size
- (by appropriate amount) in `\scriptstyle` and `\scriptscriptstyle`.
+ `\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\_stylenum{\_the\_numexpr\_mathstyle/2\_relax}%
\_vcenter{\_matrixbaselines\_math
- \_ialign{\_hfil$\_matrixstyle##$\_hfil&&\_quad\_hfil$\_matrixstyle##$\_hfil\_crcr
+ \_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{}%
- \_ifcase\_stylenum \_or \_or
- \_baselineskip=.7\_baselineskip
- \_def\_quad {\_hskip.7em\_relax}%
- \_let\_matrixstyle=\_scriptstyle
+ \_let\_matrixbaselines=\_relax % \matrix inside matrix does not change size again
+ \_ifcase\_stylenum \_or \_matrixscriptbaselines \_or \_matrixscriptbaselines
\_or
\_baselineskip=.5\_baselineskip
\_def\_quad {\_hskip.5em\_relax}%
\_let\_matrixstyle=\_scriptscriptstyle
\_fi
}
+\_def\_matrixscriptbaselines{\_baselineskip=.7\_baselineskip
+ \_def\_quad {\_hskip.7em\_relax}\_let\_matrixstyle=\_scriptstyle
+}
\_protected\_def\_pmatrix#1{\_left(\_matrix{#1}\_right)}
\_public \matrix \pmatrix ;
@@ -604,23 +616,24 @@
The \`\cases` and `\bordermatrix` macros are identical from plain \TeX/.
\_cod -----------------------------
-\_protected\_def\_cases#1{\_left\{\_thinsk\_vcenter{\_normalbaselines\_math
- \_ialign{$##\_hfil$&\_quad##\_hfil\_crcr#1\_crcr}}\_right.}
+\_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#1{\_begingroup \_math
- \_setbox0=\_vbox{\_def\_cr{\_crcr\_noalign{\_kern.2em\_global\_let\_cr\_endline}}%
- \_ialign{$##$\_hfil\_kern.2em\_kern\_ptrenwd&\_thinspace\_hfil$##$\_hfil
- &&\_quad\_hfil$##$\_hfil\_crcr
- \_omit\_strut\_hfil\_crcr\_noalign{\_kern-\_baselineskip}%
- #1\_crcr\_omit\_strut\_cr}}%
+ \_setbox0=\_vbox{\_bordermatrixA #1\_stopbmatrix}%
\_setbox2=\_vbox{\_unvcopy0 \_global\_setbox1=\_lastbox}%
\_setbox2=\_hbox{\_unhbox1 \_unskip\_global\_setbox1=\_lastbox}%
\_setbox2=\_hbox{$\_kern\_wd1 \_kern-\_ptrenwd\_left(\_kern-\_wd1
\_global\_setbox1=\_vbox{\_box1 \_kern.2em}%
\_vcenter{\_kern-\_ht1 \_unvbox0 \_kern-\_baselineskip}\_thinsk\_right)$}%
\_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 ;
@@ -632,44 +645,56 @@
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. You can set the
- `\baselineskip` value by the \^`\eqlines` parameter and math style
+ 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.
- For example, you need to put the system of euations as an index of sum
- operator:
- \begtt
- $$
- \sum_{\eqlines{\baselineskip=.7\baselineskip}\eqstyle{\scriptstyle}\eqalign{
- i &\in A \cr
- j &\in B \cr
- k &\in C }}
- i + j + k
- $$
- \endtt
- You can write more equation systems one next second:
- \begtt
- $$\eqalign{
- x + y + z &= 1 && a + b + c &= -1 \cr
- u + v &= 20 && f + g &= -20 \cr
- i &= j
- }$$
- \endtt
- You can use the third column for centered equations without aligning point
- (as in \^`\displaylines`, but packed to the `\vcenter` box). For example:
- \begtt \catcode`\<=13
- $$ \left( \eqspace=0pt \eqalign{&& <first equation>\cr && <second equation>} \right) $$
- \endtt
- The \^`\eqspace` is additional space used in the third column to separate
- equation systems one next second.
+
+ 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 the space \^`\eqspace`/2 at its both sides.
\_cod -----------------------------
-\_def\_eqalign#1{\_null\_thinsk\_vcenter{\_the\_eqlines\_math
+\_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 -----------------------------
- \`\openup`, \`\displaylines` and \`\eqalignno` macros are copied from
+ The \`\displaylines``{<formula>\cr<formula>\cr...<formula>}`
+ 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<dimen>{<formula>\cr<formula>\cr...<formula>}`
+ 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 to more pages, but this case
+ enables to use `\eqno` or `\leqno` or \^`\eqmark`.
+ \_cod -----------------------------
+
+\_def\_displaylines #1#{\_ifx&#1&\_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 -----------------------------
@@ -683,20 +708,17 @@
\_vskip-\_lineskiplimit \_vskip\_normallineskiplimit \_fi
\_else \_penalty\_interdisplaylinepenalty \_fi}}}
\_def\_elign{\_tabskip=\_zoskip\_everycr{}} % restore inside \_display
-\_def\_displaylines#1{\_display \_tabskip=\_zoskip
- \_halign{\_hbox to\_displaywidth{$\_elign\_hfil\_displaystyle##\_hfil$}\_crcr
- #1\_crcr}}
-\_def\_eqalignno#1{\_display \_tabskip=\_centering
+\_long\_def\_eqalignno#1{\_display \_tabskip=\_centering
\_halign to\_displaywidth{\_hfil$\_elign\_displaystyle{##}$\_tabskip=\_zoskip
&$\_elign\_displaystyle{{}##}$\_hfil\_tabskip\_centering
&\_llap{$\_elign##$}\_tabskip\_zoskip\_crcr
#1\_crcr}}
-\_def\_leqalignno#1{\_display \_tabskip=\_centering
+\_long\_def\_leqalignno#1{\_display \_tabskip=\_centering
\_halign to\_displaywidth{\_hfil$\_elign\_displaystyle{##}$\_tabskip=\_zoskip
&$\_elign\_displaystyle{{}##}$\_hfil\_tabskip=\_centering
&\_kern-\_displaywidth\_rlap{$\_elign##$}\_tabskip\_displaywidth\_crcr
#1\_crcr}}
-\_public \openup \eqalign \displaylines \eqalignno ;
+\_public \openup \eqalignno \leqalignno ;
\_doc -----------------------------
These macros are inspired from `ams-math.tex` file.
@@ -941,7 +963,7 @@
\_let\circleddot\odot
\_doc -----------------------------
- The \`\not` macro is re-defined to be smarter than in plain
+ The \^`\not` macro is re-defined to be smarter than in plain
\TeX/. The macro follows this rule:
\begtt
\not< becomes \_nless
@@ -979,7 +1001,7 @@
* \`\currstyle` which expands to `\displaystyle`, `\textstyle`,
`\scriptstyle` or `\scriptscriptstyle` depending on the current math style
when \^`\mathstyles` was opened.
- * `\dobystyle{<D>}{<T>}{<S>}{<SS>}` is expandable macro. It expands to
+ * \`\dobystyle``{<D>}{<T>}{<S>}{<SS>}` is expandable macro. It expands to
`<D>`, `<T>`, `<S>` or `<SS>` depending on the current math style
when \^`\mathstyles` was opened.
* The value of the \`\stylenum` is 0, 1, 2 or 3
@@ -1010,6 +1032,12 @@
\_endcode %---------------------------------------------------
+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<size>" implemented and documented.
2020-05-11 \let\|=\Vert, bug fixed
2020-04-27 \mathstyles introduced
2020-03-14 implemented