[NTG-context] \hpos in math - Half solved

Hans Hagen j.hagen at xs4all.nl
Wed Dec 7 23:25:51 CET 2022


On 12/7/2022 1:42 PM, Gavin via ntg-context wrote:
> Hi List,
> 
> I solved my original problem 2, allowing me to reuse the same \hpos labels in different equations without interference. I added an equation counter and set up my custom math version of \hpos to use the count as part of the label internally. I tried to do this with a regular ConTeXt counter, but had all sorts of mysterious, wrong behavior. When I switched to using a Lua counter, everything worked immediately. So, while there is nothing brilliant about this solution, I’ll share it for anyone who might want to do something similar in the future.
attached an example by Mikael ... it should work with tonights update

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
-------------- next part --------------
 \usemodule[article-basic]

\starttext

\startboxanchoring[+]
\connectboxanchors[top]    [top]    [distance=1ex] {c1}{c2}
\connectboxanchors[bottom] [bottom] [distance=1ex] {d1}{d2}
\startformula
    \mathboxanchored[nucleus]{c1}{e}_{\alpha}
    \mathboxanchored[nucleus]{c2}{e}^{\mu}
    \mathboxanchored[nucleus]{d1}{todo}
    \mathboxanchored[nucleus]{d2}{e}_{\dot{\beta}} = \frac{1}{\sqrt{2}}
    \sigma_{\alpha,\dot{\beta}}^{\mu}
\stopformula
\stopboxanchoring

\startboxanchoring[+]
\connectboxanchors[top]    [top]    [distance=0.5ex,arrow=no] {c1}{c2}
\connectboxanchors[bottom] [bottom] [distance=0.5ex,arrow=no] {c2}{c3}
\startformula
    \mathboxanchored[nucleus]{c1}{e}_{\alpha}
    \mathboxanchored[nucleus]{c2}{e}^{\mu}
    \mathboxanchored[nucleus]{c3}{e}_{\dot{\beta}} = \frac{1}{\sqrt{2}}
    \sigma_{\alpha,\dot{\beta}}^{\mu}
\stopformula
\stopboxanchoring

\startboxanchoring[+]
\connectboxanchors[top]    [top]    [text={\smallinfofont upper limits}]{b1}{b2}
\connectboxanchors[bottom] [bottom] [text={\smallinfofont lower limits}]{a1}{a2}
\startformula
\int_{\mathboxanchored{a1}{0}}^{\mathboxanchored{b1}{1}} \frac{1}{1+x^2} \dd x
=
\int_{\mathboxanchored{a2}{0}}^{\pi\mathboxanchored{b2}{/}4} \frac{1}{1+\tan^2 t}(1+\tan^2 t)\dd t
\stopformula
\stopboxanchoring

\stoptext


More information about the ntg-context mailing list