diff options
author | Hans Hagen <pragma@wxs.nl> | 2018-03-15 16:04:31 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg42.2a@gmail.com> | 2018-03-15 16:04:31 +0100 |
commit | a4e07f30e880ab27c2918f81f136e257475b7729 (patch) | |
tree | 02db002d3001a49777a049f9a98fdc872a5e1ad1 /tex/context/base/mkiv/math-frc.mkiv | |
parent | cbc37c39432e0ebe38e0922fc6d14c2955ab3ba2 (diff) | |
download | context-a4e07f30e880ab27c2918f81f136e257475b7729.tar.gz |
2018-03-15 15:36:00
Diffstat (limited to 'tex/context/base/mkiv/math-frc.mkiv')
-rw-r--r-- | tex/context/base/mkiv/math-frc.mkiv | 106 |
1 files changed, 93 insertions, 13 deletions
diff --git a/tex/context/base/mkiv/math-frc.mkiv b/tex/context/base/mkiv/math-frc.mkiv index 16ea6e9e1..9a5ce62b0 100644 --- a/tex/context/base/mkiv/math-frc.mkiv +++ b/tex/context/base/mkiv/math-frc.mkiv @@ -26,7 +26,7 @@ %D This module is reimplemented in \MKIV\ style. -\registerctxluafile{math-frc}{1.001} +\registerctxluafile{math-frc}{} %D \macros %D {frac, xfrac, xxfrac} @@ -195,6 +195,11 @@ {\begingroup \edef\currentmathfraction{#1}% % + \edef\p_math_fraction_fences{\mathfractionparameter\c!fences}% + \ifx\p_math_fraction_fences\empty \else + \math_fenced_fenced_start\p_math_fraction_fences + \fi + % \d_math_fraction_margin\mathfractionparameter\c!margin % \edef\p_math_fractions_color{\mathfractionparameter\c!color}% @@ -212,6 +217,12 @@ \expandafter\math_frac_colored \fi} +\unexpanded\def\math_frac_wrapup + {\ifx\p_math_fraction_fences\empty \else + \math_fenced_fenced_stop\p_math_fraction_fences + \fi + \endgroup} + \unexpanded\def\math_frac_colored#1#2% {\savecolor \colo_helpers_activate\p_math_fractions_color @@ -222,11 +233,18 @@ % we use utfchar anyway so we can as well do all at the lua end +\def\math_frac_no_delim{0x2E} + \def\math_frac_command {\clf_mathfraction {\mathfractionparameter\c!rule}% - \mathfractionparameter\c!left\space - \mathfractionparameter\c!right\space + \ifx\p_math_fraction_fences\empty + \mathfractionparameter\c!left \space + \mathfractionparameter\c!right\space + \else + \math_frac_no_delim\space + \math_frac_no_delim\space + \fi \dimexpr\mathfractionparameter\c!rulethickness\relax \relax} @@ -235,6 +253,8 @@ % also makes testing easier. When left and right margins are needed we might merge the % variants again. After all, these are not real installers. +% the denominator is in cramped! + \setvalue{\??mathfractionalternative\v!inner}% {\ifcase\d_math_fraction_margin \expandafter\math_fraction_inner_normal @@ -265,7 +285,8 @@ \math_frac_command {\usemathstyleparameter\mathfractionparameter{\m_fractions_strut_bot#2}}% }% - }\endgroup} + }% + \math_frac_wrapup} \def\math_fraction_outer_normal#1#2% {\Ustack{% @@ -275,7 +296,8 @@ \math_frac_command {\m_fractions_strut_bot#2}% }% - }\endgroup} + }% + \math_frac_wrapup} \def\math_fraction_both_normal#1#2% {\Ustack{% @@ -285,7 +307,8 @@ \math_frac_command {\usemathstyleparameter\mathfractionparameter\m_fractions_strut_bot#2}% }% - }\endgroup} + }% + \math_frac_wrapup} \def\math_fraction_inner_margin#1#2% {\Ustack{% @@ -298,7 +321,8 @@ \usemathstyleparameter\mathfractionparameter{\m_fractions_strut_bot#2}% \kern\d_math_fraction_margin}% }% - }\endgroup} + }% + \math_frac_wrapup} \def\math_fraction_outer_margin#1#2% {\Ustack{% @@ -312,7 +336,8 @@ \m_fractions_strut_bot#2% \kern\d_math_fraction_margin}% }% - }\endgroup} + }% + \math_frac_wrapup} \def\math_fraction_both_margin#1#2% {\Ustack{% @@ -326,8 +351,8 @@ \usemathstyleparameter\mathfractionparameter\m_fractions_strut_bot#2% \kern\d_math_fraction_margin}% }% - }\endgroup} - + }% + \math_frac_wrapup} \definemathfraction[xfrac] [\c!alternative=\v!inner,\c!mathstyle=\s!script] \definemathfraction[xxfrac][\c!alternative=\v!inner,\c!mathstyle=\s!scriptscript] @@ -370,6 +395,47 @@ \fi \to \everymathematics +% theshold is new! + +\let\math_fraction_set_threshold_inline \relax +\let\math_fraction_set_threshold_display\relax + +\appendtoks + \math_fraction_set_threshold_inline + \math_fraction_set_threshold_display +\to \everymathematics + +\appendtoks + \ifx\currentmathfraction\empty + \edef\p_threshold{\mathfractionparameter\c!inlinethreshold}% + \ifx\p_threshold\empty + \let\math_fraction_set_threshold_inline\relax + \else\ifx\p_threshold\v!auto + \let\math_fraction_set_threshold_inline\relax + \else + \let\math_fraction_set_threshold_inline\math_fraction_set_theshold_inline + \fi\fi + \edef\p_threshold{\mathfractionparameter\c!displaythreshold}% + \ifx\p_threshold\empty + \let\math_fraction_set_threshold_display\relax + \else\ifx\p_threshold\v!auto + \let\math_fraction_set_threshold_display\relax + \else + \let\math_fraction_set_threshold_display\math_fraction_set_theshold_display + \fi\fi + \fi +\to \everysetupmathfraction + +\def\math_fraction_set_theshold_inline + {\edef\p_threshold{\mathfractionparameter\c!inlinethreshold}% + \Umathfractiondelsize\textstyle \p_threshold\dimexpr\textface\relax + \Umathfractiondelsize\scriptstyle \p_threshold\dimexpr\scriptface\relax + \Umathfractiondelsize\scriptscriptstyle\p_threshold\dimexpr\scriptscriptface\relax} + +\def\math_fraction_set_theshold_display + {\edef\p_threshold{\mathfractionparameter\c!displaythreshold}% + \Umathfractiondelsize\displaystyle \p_threshold\dimexpr\textface\relax} + %D \macros %D {dfrac, tfrac, frac, dbinom, tbinom, binom} %D @@ -451,9 +517,23 @@ % \unexpanded\def\dbinom#1#2{{\displaystyle{{#1}\normalabovewithdelims()\zeropoint{#2}}}} % \unexpanded\def\tbinom#1#2{{\textstyle {{#1}\normalabovewithdelims()\zeropoint{#2}}}} -\definemathfraction[binom] [\c!alternative=\v!outer,\c!rule=\v!no,\c!left=0x28,\c!right=0x29,\c!mathstyle=\s!auto] -\definemathfraction[dbinom][\c!alternative=\v!outer,\c!rule=\v!no,\c!left=0x28,\c!right=0x29,\c!mathstyle=\s!display] -\definemathfraction[tbinom][\c!alternative=\v!outer,\c!rule=\v!no,\c!left=0x28,\c!right=0x29,\c!mathstyle=\s!text] +\definemathfraction + [binom] + [\c!alternative=\v!outer, + \c!rule=\v!no, + \c!left=0x28, + \c!right=0x29, + \c!mathstyle=\s!auto] + +\definemathfraction + [dbinom] + [binom] + [\c!mathstyle=\s!display] + +\definemathfraction + [tbinom] + [binom] + [\c!mathstyle=\s!text] %D \macros %D {cfrac} |