summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/math-frc.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/math-frc.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/math-frc.mkiv49
1 files changed, 46 insertions, 3 deletions
diff --git a/Master/texmf-dist/tex/context/base/math-frc.mkiv b/Master/texmf-dist/tex/context/base/math-frc.mkiv
index e11e79e8230..f4f3f2b84a1 100644
--- a/Master/texmf-dist/tex/context/base/math-frc.mkiv
+++ b/Master/texmf-dist/tex/context/base/math-frc.mkiv
@@ -102,6 +102,7 @@
\setupmathfractions
[\c!mathstyle=,
\c!alternative=\v!inner,
+ \c!margin=\zeropoint,
\c!rulethickness=.25\exheight,
\c!left=0x2E,
\c!right=0x2E,
@@ -111,9 +112,12 @@
\setuevalue{\currentmathfraction}{\math_frac{\currentmathfraction}}%
\to \everydefinemathfraction
+\newdimen\d_math_fraction_margin
+
\unexpanded\def\math_frac#1%
{\begingroup
\edef\currentmathfraction{#1}%
+ \d_math_fraction_margin\mathfractionparameter\c!margin
\edef\p_math_fractions_color{\mathfractionparameter\c!color}%
\ifx\p_math_fractions_color\empty
\expandafter\math_frac_normal
@@ -139,19 +143,58 @@
\number\dimexpr\mathfractionparameter\c!rulethickness%
)}}
-\setvalue{\??mathfractionalternative\v!inner}#1#2%
+% Having a \withmarginornot{#1}{#2} makes not much sense nor do
+% 4 tests or 4 redundant kerns (longer node lists plus possible
+% interference). A split in normal and margin also makes testing
+% easier. When left and right margins are needed we might merge
+% the variants again. After all, these are not real installers.
+
+\setvalue{\??mathfractionalternative\v!inner}%
+ {\ifcase\d_math_fraction_margin
+ \expandafter\math_fraction_inner_normal
+ \else
+ \expandafter\math_fraction_inner_margin
+ \fi}
+
+\def\math_fraction_inner_normal#1#2%
{\Ustack{%
{\usemathstyleparameter\mathfractionparameter{#1}}% we should store this one
\math_frac_command
{\usemathstyleparameter\mathfractionparameter{#2}}% and reuse it here
}\endgroup}
-\setvalue{\??mathfractionalternative\v!outer}#1#2%
+\def\math_fraction_inner_margin#1#2%
+ {\Ustack{%
+ {\kern\d_math_fraction_margin
+ \usemathstyleparameter\mathfractionparameter{#1}% we should store this one
+ \kern\d_math_fraction_margin}%
+ \math_frac_command
+ {\kern\d_math_fraction_margin
+ \usemathstyleparameter\mathfractionparameter{#2}% and reuse it here
+ \kern\d_math_fraction_margin}%
+ }\endgroup}
+
+\setvalue{\??mathfractionalternative\v!outer}%
+ {\ifcase\d_math_fraction_margin
+ \expandafter\math_fraction_outer_normal
+ \else
+ \expandafter\math_fraction_outer_margin
+ \fi}
+
+\def\math_fraction_outer_normal#1#2%
{\Ustack{%
\usemathstyleparameter\mathfractionparameter
{{#1}\math_frac_command{#2}}%
}\endgroup}
+\def\math_fraction_outer_margin#1#2%
+ {\Ustack{%
+ \usemathstyleparameter\mathfractionparameter
+ {{\kern\d_math_fraction_margin#1\kern\d_math_fraction_margin}%
+ \math_frac_command
+ {\kern\d_math_fraction_margin#2\kern\d_math_fraction_margin}}%
+ }\endgroup}
+
\definemathfraction[frac][\c!mathstyle=]
\unexpanded\def\xfrac {\begingroup\let\xfrac\xxfrac\math_frac_alternative\scriptstyle}
@@ -231,7 +274,7 @@
%D \getbuffer
\unexpanded\def\cfrac
- {\doifnextoptionalelse\math_cfrac_yes\math_cfrac_nop}
+ {\doifnextoptionalcselse\math_cfrac_yes\math_cfrac_nop}
\def\math_cfrac_nop {\math_cfrac_indeed[cc]}
\def\math_cfrac_yes[#1]{\math_cfrac_indeed[#1cc]}