summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/strc-mat.mkiv
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2011-06-01 08:54:21 +0000
committerTaco Hoekwater <taco@elvenkind.com>2011-06-01 08:54:21 +0000
commitd7ccb42582f85acf30568913610ccf4d602023fb (patch)
tree7292e3545a420676878e7451b68892d360c62cb6 /Master/texmf-dist/tex/context/base/strc-mat.mkiv
parent2d62a6fe9b80def59c392268022f1f9a2d6e358f (diff)
commit context 2011.05.18
git-svn-id: svn://tug.org/texlive/trunk@22719 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/strc-mat.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/strc-mat.mkiv123
1 files changed, 69 insertions, 54 deletions
diff --git a/Master/texmf-dist/tex/context/base/strc-mat.mkiv b/Master/texmf-dist/tex/context/base/strc-mat.mkiv
index 2064db2c586..8d408936036 100644
--- a/Master/texmf-dist/tex/context/base/strc-mat.mkiv
+++ b/Master/texmf-dist/tex/context/base/strc-mat.mkiv
@@ -73,8 +73,9 @@
[\c!name=\v!formula,\s!counter=\v!formula,%
\s!hascaption=\v!yes,\s!hastitle=\v!yes,\s!hasnumber=\v!yes,%\s!haslevel=#6,%
\s!hasnumber=\v!no,%
- \c!reference=#1,\c!title=,\c!bookmark=]%
+ \c!reference=#1,\c!title=\namedformulaentry,\c!bookmark=]%
[#2]%
+ \glet\namedformulaentry\relax
\globallet#3\laststructurecounternumber
\globallet#4\laststructurecountersynchronize
\globallet#5\laststructurecounterattribute}
@@ -86,6 +87,13 @@
\newtoks\everyresetformulas
+% 0=unset, 1=forced, 2=none, 3=reference
+
+\newconstant\placeformulanumbermode
+\newconstant\formulasnumbermode
+\newconstant\subformulasnumbermode
+\newconstant\nestedformulanumbermode
+
\newconditional\insideplaceformula
\newconditional\insideplacesubformula
\newconditional\insideformulas
@@ -129,11 +137,17 @@
\def\doplacecurrentformulanumber
{\dohandlecurrentformulareferences
- %\currentformulasattribute % todo
- %\currentformulasattribute % todo
- %\currentsubformulaattribute % todo
\labeltexts\currentformula{\doconvertedstructurecounter[\v!formula][]}}
+% \def\theboxdestinationattribute#1{\iflocation\ifx#1\relax\else\ifx#1\empty\else attr \destinationattribute#1\fi\fi\fi}
+% \def\thedestinationattribute #1{\iflocation\ifx#1\relax\else\ifx#1\empty\else \attribute\destinationattribute#1\fi\fi\fi}
+
+\def\theformuladestinationattribute#1%
+ {\iflocation\ifx#1\relax\else\ifx#1\empty\else
+ \attribute\destinationattribute#1%
+ \glet#1\relax
+ \fi\fi\fi}
+
\appendtoks
\glet\currentplaceformulasynchronize \relax
\glet\currentformulassynchronize \relax
@@ -142,6 +156,8 @@
\let\currentformula\empty
\to \everyresetformulas
+% currently we do the number, some day we will do the (sub) formula
+
\def\dohandlecurrentformulareferences
{\ifnum\placeformulanumbermode=\plusthree
\storecurrentformulanumber
@@ -152,6 +168,7 @@
\currentplaceformulaattribute
\currentplaceformulasynchronize
\glet\currentplaceformulasynchronize\relax
+ \theformuladestinationattribute\currentplaceformulaattribute
\fi
\ifnum\formulasnumbermode=\plusthree
\storecurrentformulanumber
@@ -162,6 +179,7 @@
\currentformulasattribute
\currentformulassynchronize
\glet\currentformulassynchronize\relax
+ \theformuladestinationattribute\currentformulasattribute
\fi
\ifnum\subformulasnumbermode=\plusthree
\currentsubformulassynchronize
@@ -176,17 +194,21 @@
\currentnestedformulaattribute
\currentnestedformulasynchronize
\glet\currentnestedformulasynchronize\relax
+ \theformuladestinationattribute\currentnestedformulaattribute
\fi}
+% needs checking ... too many:
+
+\let\currentplaceformulaattribute\relax \let\currentplaceformulasynchronize\relax \let\currentplaceformulanumber\relax
+\let\currentformulaattribute \relax \let\currentformulasynchronize \relax \let\currentformulanumber \relax
+\let\currentsubformulaattribute \relax \let\currentsubformulasynchronize \relax \let\currentsubformulanumber \relax
+\let\currentformulasattribute \relax \let\currentformulassynchronize \relax \let\currentformulasnumber \relax
+
\let\currentformulasreference \empty \let\currentformulassuffix \empty
\let\currentformulareference \empty \let\currentformulasuffix \empty
\let\currentsubformulareference \empty \let\currentsubformulasuffix \empty
\let\currentnestedformulareference\empty \let\currentnestedformulasuffix\empty
-\let\currentformulasynchronize \relax \let\currentformulaattribute \relax
-\let\currentsubformulasynchronize\relax \let\currentsubformulaattribute\relax
-\let\currentformulassynchronize \relax \let\currentformulasattribute \relax
-
\def\dohandleformulanumbering
{\doincrementsubstructurecounter[\v!formula][1]%
\doiftext\currentplaceformulasuffix{\setsubstructurecounterown[\v!formula][2]{\currentplaceformulasuffix}}%
@@ -241,6 +263,15 @@
\definelist[\v!formula]
+\installstructurelistprocessor\v!formula % to be checked ...
+ {\dodolistelement
+ \currentlist
+ \structurelistlocation
+ \structurelistgenericnumber
+ \structurelistgenerictitle % hm, can end up in message (volkers test)
+ \structurelistpagenumber
+ \structurelistrealpagenumber}
+
\appendtoks
\global\setfalse\insideplaceformula
\global\setfalse\insideplacesubformula
@@ -425,6 +456,7 @@
\def\dodostartformula[#1][#2]% setting leftskip adaption is slow !
{\bgroup % HERE
\def\currentformula{#1}%
+ \dostarttagged\t!formula\currentformula
\the\everybeforedisplayformula
\formulaparskip\parskip
\formulastrutdp\strutdepth
@@ -439,7 +471,7 @@
\doifsomething{\formulaparameter\c!margin}% so we test first
{\dosetleftskipadaption{\formulaparameter\c!margin}%
\edef\leftdisplaymargin{\the\leftskipadaption}}% overloaded
- \long\def\dostartformula##1{\bgroup\let\dostopformula\egroup}%
+ \long\def\dostartformula##1{\bgroup\dostarttagged\t!subformula\def\dostopformula{\dostoptagged\egroup}}%
\freezedimenmacro\leftdisplayskip
\freezedimenmacro\rightdisplayskip
\freezedimenmacro\leftdisplaymargin
@@ -448,6 +480,15 @@
\forgetdisplayskips
\getvalue{\e!start\formulaparameter\c!alternative\v!formula}}
+% experiment:
+
+\appendtoks
+ \edef\currentformulagrid{\formulaparameter\c!grid}%
+ \ifx\currentformulagrid\empty \else
+ \autosetsnapvalue\currentformulagrid
+ \fi
+\to \everybeforedisplayformula
+
\def\switchtoformulabodyfont{\switchtobodyfont}
\setvalue{\v!formula}{\dosingleempty\doformula}
@@ -460,8 +501,13 @@
\endgroup}
\def\dostopformula
- {\doplaceformulanumber
+ {\dostarttagged\t!formulatag\empty
+ \doplaceformulanumber
+ \dostoptagged
+ \dostarttagged\t!formulacontent\empty
\getvalue{\e!stop\formulaparameter\c!alternative\v!formula}%
+ \dostoptagged
+ \dostoptagged
\nonoindentation
\checknextindentation[\formulaparameter\c!indentnext]%
\egroup
@@ -573,6 +619,7 @@
\def\dostartformulas[#1]#2\stopformulas % new / to be internationalized
{\bgroup
+ \dostarttagged\t!formulaset\empty
\global\settrue\insideformulas
\edef\currentformulasreference{#1}%
\handleformulasnumbering
@@ -597,6 +644,7 @@
\egroup
\stopdisplaymath
\global\setfalse\insideformulas
+ \dostoptagged
\egroup
\the\everyresetformulas
\hangafter\minusone % added for side floats
@@ -604,19 +652,13 @@
% place
-% 0=unset, 1=forced, 2=none, 3=reference
-
-\chardef\placeformulanumbermode \zerocount
-\chardef\formulanumbermode \zerocount
-\chardef\formulasnumbermode \zerocount
-\chardef\subformulasnumbermode \zerocount
-\chardef\nestedformulanumbermode\zerocount
-
\def\inhibitformulanumberflag{-}
\def\forceformulanumberflag {+}
\def\docheckformulareference#1#2%
- {\chardef#1\ifx#2\empty
+ {#1\unless\ifx\namedformulaentry\relax % new 29/8/2010
+ \plusthree
+ \else\ifx#2\empty
\zerocount
\else\ifx#2\forceformulanumberflag
\plusone
@@ -624,7 +666,7 @@
\plustwo
\else
\plusthree
- \fi\fi\fi}
+ \fi\fi\fi\fi}
\def\formulanumber{\doformulanumber} % for the moment
@@ -640,41 +682,16 @@
\dododoformulanumber}
\unexpanded\def\placeformula
- {\doglobal\settrue\insideplaceformula
+ {\global\settrue\insideplaceformula
\settrue\incrementformulanumber
- \dodoubleempty\doplaceformula}
+ \dosingleempty\doplaceformula}
\unexpanded\def\placesubformula
- {\doglobal\settrue\insideplacesubformula
+ {\global\settrue\insideplacesubformula
\setfalse\incrementformulanumber
- \dodoubleempty\doplaceformula}
-
-% \def\doplaceformula[#1][#2]% #2 = dummy, gobbles spaces
-% {\def\currentplaceformulareference{#1}%
-% \let\currentplaceformulasuffix\empty
-% \futurelet\next\redoplaceformulaone}
-%
-% \let\mathdollarsign$ % no def
-%
-% \def\redoplaceformulaone % use doifnextcharelse
-% {\ifx\next\bgroup
-% \@EA\moreplaceformula % [ref]{}
-% \else
-% \@EA\redoplaceformulatwo
-% \fi}
-%
-% \long\def\moreplaceformula#1#2% #1 dummy #1 gobbles spaces
-% {\def\currentplaceformulasuffix{#1}%
-% \futurelet\next\redoplaceformulatwo#2}
-%
-% \def\redoplaceformulatwo
-% {\ifx\next\mathdollarsign
-% \@EA\dispplaceformula % [ref]$$
-% \else
-% \@EA\dodoplaceformula % [ref]\start
-% \fi}%
+ \dosingleempty\doplaceformula}
-\def\doplaceformula[#1][#2]% #2 = dummy, gobbles spaces
+\def\doplaceformula[#1]%
{\def\currentplaceformulareference{#1}%
\let\currentplaceformulasuffix\empty
\doifnextbgroupelse\moreplaceformula\redoplaceformula} % [ref]{}
@@ -747,12 +764,10 @@
\setformulalistentry{#2}%
\next}
-\global\let\doflushformulalistentry\gobbleoneargument
+\glet\namedformulaentry\relax % this will become a key/value so that we can do bookmarks
\def\setformulalistentry#1%
- {\gdef\doflushformulalistentry##1%
- {\normalexpanded{\noexpand\writetolist[\v!formula]{##1}}{#1}%
- \global\let\doflushformulalistentry\gobbleoneargument}}
+ {\gdef\namedformulaentry{#1}}
\protect \endinput