math-for.mkxl /size: 2456 b    last modification: 2025-02-21 11:03
1%D \module
2%D   [       file=strc-mat,
3%D        version=2008.10.20,
4%D          title=\CONTEXT\ Structure Macros,
5%D       subtitle=Math Numbering,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14\writestatus{loading}{ConTeXt Structure Macros / Math Formulas}
15
16%D This module only provides the code for defining formulas and
17%D fetching parameters. The action takes place later.
18
19\unprotect
20
21%D \macros
22%D   {setupformulas,setupsubformulas,setupformulaframed}
23
24\installcorenamespace{formula}
25\installcorenamespace{subformula}
26\installcorenamespace{formulaframed}
27\installcorenamespace{formulaoption}
28
29\installcommandhandler       \??formula       {formula}       \??formula
30\installcommandhandler       \??subformula    {subformula}    \??subformula % maybe just setuphandler (no childs used yet)
31\installframedcommandhandler \??formulaframed {formulaframed} \??formulaframed
32
33\aliased\let\setupformulas   \setupformula
34\aliased\let\setupsubformulas\setupsubformula
35
36\appendtoks
37    \normalexpanded{\defineformulaframed[\currentformula][\currentformulaparent]}%
38\to \everydefineformula
39
40%D Old stuff:
41
42\def\strc_formulas_option#1%
43  {\ifcsname\??formulaoption#1\endcsname
44     \lastnamedcs
45   \else
46     \font_basics_switchtobodyfont{#1}% for old time sake, might go away, only pt so maybe dimension and small test
47   \fi}
48
49\def\strc_math_set_options#1%
50  {\c_strc_formulas_tight \conditionalfalse
51   \c_strc_formulas_packed\conditionalfalse
52   \c_strc_formulas_depth \conditionalfalse
53   \ifempty{#1}%
54     \edef\p_option{\formulaparameter\c!option}%
55   \orelse\ifhastok={#1}% this is new, so that we can also set the grid
56     \setupcurrentformula[#1]%
57     \edef\p_option{\formulaparameter\c!option}%
58     \edef\p_mathematics{\formulaparameter\c!mathematics}%
59     \ifempty\p_mathematics
60     \orelse\ifcsname\??mathematics\p_mathematics:\s!parent\endcsname % \doifcommandhandler\??mathematics\p_mathematics
61       \let\currentmathematics\p_mathematics
62       \expand\everyswitchmathematics
63     \fi
64   \else
65     \edef\p_option{\formulaparameter\c!option}%
66     \edef\p_option{\ifempty\p_option\else\p_option,\fi#1}%
67   \fi
68   \ifempty\p_option \else
69     \rawprocesscommacommand[\p_option]\strc_formulas_option
70   \fi}
71
72\protect \endinput
73