summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/math-inl.mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/math-inl.mkiv')
-rw-r--r--Master/texmf-dist/tex/context/base/math-inl.mkiv339
1 files changed, 6 insertions, 333 deletions
diff --git a/Master/texmf-dist/tex/context/base/math-inl.mkiv b/Master/texmf-dist/tex/context/base/math-inl.mkiv
index 93168b885ff..89de0242b09 100644
--- a/Master/texmf-dist/tex/context/base/math-inl.mkiv
+++ b/Master/texmf-dist/tex/context/base/math-inl.mkiv
@@ -15,339 +15,12 @@
\unprotect
-%D \macros
-%D {...}
-%D
-%D New and experimental: snapping big inline math!
+% Obsolete, as we do snapping differently now.
-\newconditional\halfcrazymathlines % \settrue\halfcrazymathlines
-\newconditional\crazymathsnapping % \settrue\crazymathsnapping
-
-\appendtoks
- \doifelse\@@mtgrid\v!yes \settrue\setfalse\crazymathsnapping
- \doifelse\@@mtstep\v!halfline\settrue\setfalse\halfcrazymathlines
-\to \everysetuptextformulas
-
-\setuptextformulas
- [\c!grid=\v!yes,
- \c!step=\v!line]
-
-\newcount\crazymathhack
-
-\let\lastcrazymathline \!!zeropoint
-\let\lastcrazymathpage \!!zerocount
-\let\lastcrazymathprelines \!!zerocount
-\let\lastcrazymathpostlines\!!zerocount
-
-\def\crazymathtag{amh:\the\crazymathhack}
-\def\crazytexttag{\v!text:\lastcrazymathpage}
-
-\def\crazymathindent{\hskip\MPx\crazymathtag\hskip-\MPx\crazytexttag}
-
-\def\flushcrazymathbox
- {\nextboxht\strutheight
- \nextboxdp\strutdepth
- \hbox{\iftracegridsnapping\ruledhbox\fi{\flushnextbox}}}
-
-\def\snappedinlineformula
- {\dosingleempty\dosnappedinlineformula}
-
-%D \starttabulate[|Tl|l|]
-%D \NC - \NC half lines \NC \NR
-%D \NC + \NC full lines \NC \NR
-%D \NC = \NC force \NC \NR
-%D \NC < \NC force, minus pre \NC \NR
-%D \NC > \NC force, minus post \NC \NR
-%D \stoptabulate
-
-\def\inlinemathmargin{1pt}
-
-\settrue\autocrazymathsnapping
-
-% FROM NOW ON, CHANGES AS OPTIONS
-
-% TODO: SKYLINE (PREV LINE POS SCAN)
-
-% we can rewrite this in lua but maybe we don't need it
-% any more when we have proper snapping anyway
-
-\def\dosnappedinlineformula[#1]#2%
- {\ifvmode\dontleavehmode\fi % tricky
- \strut % prevents funny space at line break
- \begingroup % interesting: \bgroup can make \vadjust disappear
- \ifconditional\crazymathsnapping
- \ifgridsnapping
- \checktextbackgrounds % we need pos tracking, to be made less redundant
- \donetrue
- \else
- \donefalse
- \fi
- \else
- \donefalse
- \fi
- \!!doneafalse % forced or not auto
- \!!donebfalse % too heigh
- \!!donecfalse % too low
- \!!donedfalse % less before
- \!!doneefalse % less after
- \ifdone
- \setbox\nextbox\hbox{$#2$}%
- \iftracegridsnapping
- \setbox\nextbox\ruledhbox
- {\backgroundline[gray]{\showstruts\strut\flushnextbox}}%
- \fi
- \def\docommand##1%
- {\doif{##1}-{\settrue \halfcrazymathlines}%
- \doif{##1}+{\setfalse\halfcrazymathlines}%
- \doif{##1}={\!!doneatrue}%
- \doif{##1}<{\!!donedtrue}%
- \doif{##1}>{\!!doneetrue}}%
- \processcommalist[#1]\docommand
- \if!!doneb
- \if!!donec \else
- \setfalse\halfcrazymathlines
- \fi
- \else
- \if!!donec
- \setfalse\halfcrazymathlines
- \fi
- \fi
- \donefalse
- \if!!donea
- \donetrue
- \scratchdimen \nextboxht
- \advance\scratchdimen .5\lineheight
- \nextboxht\scratchdimen
- \scratchdimen \nextboxdp
- \advance\scratchdimen .5\lineheight
- \nextboxdp\scratchdimen
- \else\ifdim\nextboxht>\strutht
- \donetrue
- \else\ifdim\nextboxdp>\strutdp
- \donetrue
- \fi\fi\fi
- \ifconditional\autocrazymathsnapping \else \if!!donea \else
- % don't compensate, just snap to strut
- \donefalse
- % signal for next else, snap line to strut
- \!!doneatrue
- \fi \fi
- \fi
- \ifdone
- % analyze height
- \scratchdimen\inlinemathmargin
- \advance\scratchdimen \strutht
- \ifdim\nextboxht<\scratchdimen \else \!!donebtrue \fi
- % analyze depth
- \scratchdimen\inlinemathmargin
- \advance\scratchdimen \strutdp
- \ifdim\nextboxdp<\scratchdimen \else \!!donectrue \fi
- % analyzed or forced
- \ifdone
- \global\advance\crazymathhack\plusone
- \donefalse
- \ifnum\MPp\crazymathtag=\lastcrazymathpage\relax
- \ifdim\MPy\crazymathtag=\lastcrazymathline\relax
- \donetrue
- \fi
- \fi
- \ifnum\MPp\crazymathtag=\zerocount \donefalse \fi
- \ifdim\MPy\crazymathtag=\zeropoint \donefalse \fi
- \ifdone
- % same page and same line
- \else
- \global\let\lastcrazymathprelines \!!zerocount
- \global\let\lastcrazymathpostlines\!!zerocount
- \xdef\lastcrazymathpage{\MPp\crazymathtag}%
- \xdef\lastcrazymathline{\MPy\crazymathtag}%
- \fi
- \if!!doneb
- % \getrawnoflines\nextboxht
- \scratchdimen\nextboxht
- \advance\scratchdimen-\strutht
- \getnoflines\scratchdimen
- \if!!doned \advance\noflines\minusone \fi
- \scratchcounter\noflines
- \advance\noflines-\lastcrazymathprelines\relax
- \ifnum\noflines>\zerocount
- \xdef\lastcrazymathprelines{\the\scratchcounter}%
- \scratchdimen\noflines\lineheight
- \ifconditional\halfcrazymathlines
- \advance\scratchdimen-.5\lineheight
- \fi
- \advance\scratchdimen-\strutdepth
- \setbox\scratchbox\null
- \wd\scratchbox2\bodyfontsize
- \ht\scratchbox\scratchdimen
- \dp\scratchbox\strutdepth
- %%% top correction code (see below)
- \normalvadjust pre
- {%\allowbreak % sometimes breaks spacing
- \forgetall
- \crazymathindent
- \iftracegridsnapping
- \setbox\scratchbox\hbox{\green\ruledhbox{\box\scratchbox}}%
- \fi
- \box\scratchbox
- \endgraf
- \nobreak}%
- \else\ifnum\scratchcounter>\zerocount
- \normalvadjust pre
- {\nobreak}%
- \fi\fi
- \fi
- \if!!donec
- % \getrawnoflines\nextboxdp
- \scratchdimen\nextboxdp
- \advance\scratchdimen-\strutdp
- \getnoflines\scratchdimen
- \if!!donee \advance\noflines\minusone \fi
- \scratchcounter\noflines
- \advance\noflines-\lastcrazymathpostlines\relax
- \ifnum\noflines>\zerocount
- \donetrue
- \else\ifnum\lastcrazymathpostlines=\zerocount
- \donetrue
- \else
- \donefalse
- \fi\fi
- \else
- \donefalse
- \fi
- \ifdone
- \xdef\lastcrazymathpostlines{\the\scratchcounter}%
- \ifnum\lastcrazymathpostlines=\zerocount
- \global\let\lastcrazymathpostlines\!!plusone
- \fi
- \hbox{\setposition\crazymathtag\flushcrazymathbox}%
- \scratchdimen\noflines\lineheight
- \advance\scratchdimen-\lineheight
- \advance\scratchdimen+\strutheight
- \ifdim\scratchdimen>\zeropoint \else
- \scratchdimen\strutheight % todo : test for half lines
- \fi
- \ifconditional\halfcrazymathlines
- \advance\scratchdimen-.5\lineheight
- \fi
- \setbox\scratchbox\null
- \wd\scratchbox2\bodyfontsize
- \ht\scratchbox\scratchdimen
- \dp\scratchbox\strutdepth
- \normalvadjust
- {\forgetall
- \crazymathindent
- \iftracegridsnapping
- \setbox\scratchbox\hbox{\blue\ruledhbox{\box\scratchbox}}%
- \fi
- \box\scratchbox
- \endgraf
- % precaution: else we stick below the text bottom
- \ifconditional\halfcrazymathlines
- \allowbreak
- \else
- \vskip-\lineheight
- \vskip \lineheight
- \fi}%
- \else
- \hbox{\setposition\crazymathtag\flushcrazymathbox}%
- \fi
- \else
- \flushcrazymathbox
- \fi
- \else\if!!donea
- \flushcrazymathbox
- \else
- \mathematics{#2}%
- \fi\fi
- \endgroup}
-
-\let\tform\mathematics
-\let\gform\snappedinlineformula
-
-% test set:
-%
-% \startbuffer
-% Crazy math \gform {1+x} or \gform {\dorecurse {100} {1+} 1 =
-% 101} and even gore crazy \gform {2^{2^2}_{1_1}}
-% again\dorecurse {20} { and again} \gform {\sqrt {\frac
-% {x^{5^5}} {\frac {1} {2}}}} even gore\dorecurse {50} { and
-% gore} \tform {\dorecurse {12} {\gform {\sqrt {\frac
-% {x^{5^5}} {3}}}+\gform {\sqrt {\frac {x^{5^5}} {\frac {1}
-% {2}}}}+}x=10}\dorecurse{20} { super crazy math}: \tform
-% {\dorecurse {30} {\gform {\sqrt {\frac {x^{5^5}} {3}}}+
-% \gform {\sqrt {\frac {x^{5^5}} {\frac {1} {2}}}}+ }x = 10},
-% and we're\dorecurse {20} { done}!
-% \stopbuffer
-%
-% \setupcolors[state=start] \setuppapersize[S6][S6]
-%
-% \showgrid \tracegridsnappingtrue \showstruts
-%
-% \starttext
-% \setuplayout[grid=yes,lines=15]\getbuffer \page
-% \setuplayout[grid=yes,lines=16]\getbuffer \page
-% \setuplayout[grid=yes,lines=17]\getbuffer \page
-% \setuplayout[grid=yes,lines=18]\getbuffer \page
-% \setuplayout[grid=yes,lines=19]\getbuffer \page
-% \stoptext
-%
-% test
-%
-% \startregels
-% \gform[<]{35 \cdot p^{\frac{3}{4}} = 70}
-% \gform{12{,}4 \cdot d^3 = 200}
-% \gform{a \cdot x^b}.
-% \gform{12x^6 \cdot \negative 3x^4}
-% \gform{\frac{12x^6}{\negative 3x^4}}
-% \gform{(4x^2)^3}
-% \gform{4x \sqrt{x} \cdot 3x^2}
-% \gform{\frac{2x^4}{4x \sqrt{x}}}
-% \gform{y = a \cdot x^b}.
-% \gform{y_1 = \frac{15x^2}{x}}
-% \gform{y_2 = x \cdot \sqrt{x}}
-% \gform{y_3 = \frac{6x^3}{x^2}}
-% \gform[<]{y_4 = \left(2x^2\right)^{\frac{1}{2}}}
-% \gform{y_1 = \frac{4x^5}{x^2}}
-% \gform{y_2 = 4 \cdot \sqrt{x}}
-% \gform{y_3 = 4x^3}
-% \gform{y_4 = \frac{100x}{\sqrt{x}}}
-% \gform[<]{y_5 = 4 \cdot x^{\frac{1}{2}}}
-% \gform{y_6 = \frac{1}{2} x \cdot 4x^2}
-% \gform{y_7 = 2 \cdot x^3}
-% \gform{y_8 = 100 \cdot x^{\frac{1}{2}}}
-% \gform{4x^8 \cdot 8x^3}
-% \gform{\frac{4x^8}{8x^3}}
-% \gform{\left(\negative3x^4\right)^3}
-% \gform{x^3 \sqrt{x} \cdot 3x^2}
-% \gform{\frac{6x^3}{x^2 \sqrt{x}}}
-% \gform{\frac{6}{2x^4}}
-% \gform{\frac{1}{3x^6}}
-% \gform{\frac{12x^8}{4x^{10}}}
-% \gform{\frac{4}{\sqrt{x}}}
-% \gform{\frac{1}{2x \sqrt{x}}}
-% \gform{\frac{2{,}25}{p} = 0{,}35}
-% \gform{4{,}50 + \frac{300}{k} = 4{,}70}
-% \gform{\frac{1200}{k+12} - 42 = 6}
-% \stopregels
-
-%D \macros
-%D {enableautomath}
-%D
-%D The next one can be dangerous, but handy in controlled
-%D situations.
-
-\bgroup \catcode`\$=\active
-
-\gdef\enableautomath
- {\catcode`\$=\active
- \def$##1${\snappedinlineformula{##1}}}
-
-% \gdef\enableautomath
-% {\catcode`\$=\active
-% \def${\doifnextcharelse$\doautodmath\doautoimath}%
-% \def\doautoimath##1${\snappedinlineformula{##1}}%
-% \def\doautodmath$##1$${\startformula##1\stopformula}}
-
-\egroup
+\def\snappedinlineformula {\dosingleempty\dosnappedinlineformula}
+\def\dosnappedinlineformula[#1]#2{\mathematics{#2}}
+\let\tform \mathematics
+\let\gform \snappedinlineformula
+\let\enableautomath \relax
\protect \endinput