summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/pack-box.mkxl
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/pack-box.mkxl')
-rw-r--r--tex/context/base/mkxl/pack-box.mkxl32
1 files changed, 30 insertions, 2 deletions
diff --git a/tex/context/base/mkxl/pack-box.mkxl b/tex/context/base/mkxl/pack-box.mkxl
index ecd793056..7c64b0032 100644
--- a/tex/context/base/mkxl/pack-box.mkxl
+++ b/tex/context/base/mkxl/pack-box.mkxl
@@ -1236,6 +1236,24 @@
\newcount\registeredboxanchor
+\installmacrostack\boxanchoringclass
+
+\mutable\let\boxanchoringclass\empty
+
+\newcount\c_anchor_auto_box_class
+
+\permanent\protected\def\startboxanchoring[#1]% + == auto
+ {\push_macro_boxanchoringclass
+ \iftok{#1}{+}%
+ \global\advance\c_anchor_auto_box_class\plusone
+ \edef\boxanchoringclass{\the\c_anchor_auto_box_class::}%
+ \else
+ \edef\boxanchoringclass{#1}
+ \fi}
+
+\permanent\protected\def\stopboxanchoring
+ {\pop_macro_boxanchoringclass}
+
\permanent\protected\def\registerboxanchor
{\global\advance\registeredboxanchor\minusone}
@@ -1243,6 +1261,13 @@
{\registerboxanchor
\global\expandafter\integerdef\csname\??boxanchors#1\endcsname\registeredboxanchor}
+\permanent\protected\def\doifnotanchorbox#1%
+ {\ifcsname\??boxanchors#1\endcsname
+ \expandafter\gobbleoneargument
+ \else
+ \expandafter\firstofoneargument
+ \fi}
+
\permanent\def\namedboxanchor#1%
{\normalexpanded{\ifcsname\??boxanchors#1\endcsname\lastnamedcs\orelse\ifchknum#1\or#1\else\zerocount\fi}}
@@ -1290,11 +1315,14 @@
%D The name might change:
-\permanent\protected\def\mathboxanchored#1#2{#2\Umathsource\namedboxanchor{#1}\relax}
-
\permanent\protected\def\mathrowanchored #1{\alignmentwrapsource\namedboxanchor{#1}\relax}
\permanent\protected\def\mathcellanchored#1{\alignmentcellsource\namedboxanchor{#1}\relax}
+%permanent\protected\def\mathboxanchored#1#2{#2\Umathsource\namedboxanchor{#1}\relax}
+
+\permanent\tolerant\protected\def\mathboxanchored[#1]#:#2#3%
+ {#3\Umathsource\iftok{#1}{nucleus}#1\fi\namedboxanchor{\boxanchoringclass:#2}\relax}
+
% to be used as:
%
% \scratchcounter\registeredboxanchor