summaryrefslogtreecommitdiff
path: root/tex/context/base/math-frc.mkiv
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-04-10 01:40:27 +0300
committerMarius <mariausol@gmail.com>2013-04-10 01:40:27 +0300
commit38df07a834229e1c5065454e54aa42694ff1c839 (patch)
tree20ba02282b9dc360ba02ed4e8dda0228fce08cb8 /tex/context/base/math-frc.mkiv
parentd6b7fa7047e6dc01919d582263c6d80a2ef4a174 (diff)
downloadcontext-38df07a834229e1c5065454e54aa42694ff1c839.tar.gz
stable 2013.04.10 00:41
Diffstat (limited to 'tex/context/base/math-frc.mkiv')
-rw-r--r--tex/context/base/math-frc.mkiv56
1 files changed, 29 insertions, 27 deletions
diff --git a/tex/context/base/math-frc.mkiv b/tex/context/base/math-frc.mkiv
index ea3a737aa..9770d4ae1 100644
--- a/tex/context/base/math-frc.mkiv
+++ b/tex/context/base/math-frc.mkiv
@@ -89,16 +89,16 @@
\installcorenamespace{mathfractions}
\installcorenamespace{mathfractionstyle}
-\installcorenamespace{mathfractionalign}
\installcorenamespace{mathfractionalternative}
\installcommandhandler \??mathfractions {mathfraction} \??mathfractions
\let\setupmathfractions\setupmathfraction
+% color only applies to rule, use regular color for rest
+
\setupmathfractions
- [\c!mathstyle=\v!auto,
- \c!align=\v!normal,
+ [\c!mathstyle=,
\c!alternative=\v!inner,
\c!command=\normalover] % beware a <arg 1><command><arg 2> variant
@@ -106,36 +106,38 @@
\setuevalue{\currentmathfraction}{\math_frac{\currentmathfraction}}%
\to \everydefinemathfraction
-\letvalue{\??mathfractionalign\v!normal}\mathstylehbox
-\letvalue{\??mathfractionalign\v!lohi }\mathstylevcenteredhbox
-
-\def\math_frac_align
- {\expandnamespaceparameter\??mathfractionalign\mathfractionparameter\c!align\v!normal}
-
\unexpanded\def\math_frac#1%
{\begingroup
\edef\currentmathfraction{#1}%
- \expandnamespaceparameter\??mathfractionstyle\mathfractionparameter\c!mathstyle\s!math}
-
-\setvalue{\??mathfractionalternative\v!inner}#1#2#3%
- {\math_frac_align{\Ustack{{#1{#2}}\mathfractionparameter\c!command{#1{#3}}}}%
- \endgroup}
-
-\setvalue{\??mathfractionalternative\v!outer}#1#2#3%
- {\math_frac_align{\Ustack{{#1{{#2}\mathfractionparameter\c!command{#3}}}}}%
- \endgroup}
-
-\def\math_frac_alternative
+ \edef\p_math_fractions_color{\mathfractionparameter\c!color}%
+ \ifx\p_math_fractions_color\empty
+ \expandafter\math_frac_normal
+ \else
+ \expandafter\math_frac_colored
+ \fi}
+
+\unexpanded\def\math_frac_colored#1#2%
+ {\savecolor
+ \colo_helpers_activate\p_math_fractions_color
+ \math_frac_normal{\restorecolor#1}{\restorecolor#2}}
+
+\unexpanded\def\math_frac_normal
{\expandnamespaceparameter\??mathfractionalternative\mathfractionparameter\c!alternative\v!inner}
-\setvalue{\??mathfractionstyle\v!auto }{\math_frac_alternative\firstofoneargument} % was: 0
-\setvalue{\??mathfractionstyle\s!display }{\math_frac_alternative\displaystyle} % was: 1
-\setvalue{\??mathfractionstyle\s!text }{\math_frac_alternative\textstyle} % was: 2
-\setvalue{\??mathfractionstyle\s!script }{\math_frac_alternative\scriptstyle} % was: 3
-\setvalue{\??mathfractionstyle\s!scriptscript}{\math_frac_alternative\scriptscriptstyle} % was: 4
-\setvalue{\??mathfractionstyle\s!math }{\math_frac_alternative\mathstyle} % was: else
+\setvalue{\??mathfractionalternative\v!inner}#1#2%
+ {\Ustack{%
+ {\usemathstyleparameter\mathfractionparameter{#1}}% we should store this one
+ \mathfractionparameter\c!command
+ {\usemathstyleparameter\mathfractionparameter{#2}}% and reuse it here
+ }\endgroup}
+
+\setvalue{\??mathfractionalternative\v!outer}#1#2%
+ {\Ustack{%
+ \usemathstyleparameter\mathfractionparameter
+ {{#1}\mathfractionparameter\c!command{#2}}%
+ }\endgroup}
-\definemathfraction[frac][\c!mathstyle=\v!auto]
+\definemathfraction[frac][\c!mathstyle=]
\unexpanded\def\xfrac {\begingroup\let\xfrac\xxfrac\math_frac_alternative\scriptstyle}
\unexpanded\def\xxfrac{\begingroup \math_frac_alternative\scriptscriptstyle}