[NTG-context] \hpos in math

Gavin gavinpublic at comcast.net
Tue Dec 6 14:22:09 CET 2022


Hi Hans,

> On Dec 6, 2022, at 2:15 AM, Hans Hagen via ntg-context <ntg-context at ntg.nl> wrote:
> On 12/6/2022 12:39 AM, Gavin via ntg-context wrote:
>> 1) Is there a mathematics version of \hpos? The contents of \hpos are set as text, even when \hpos is in mathematics, so I wrote an \mpos macro that uses \hpos but sets the contents as display-style math. This isn’t great for spacing, and it does't adapt to different math styles. \framed has a math version, \mframed, that sets the contents in the appropriate math style. If anyone know a way to accomplish that with \hpos, I’d love to know.
> 
> there actually is a subsystem that keeps math as-is-it (styles and spacing and such), see attached

I tried using \mathboxanchored, and was able to get the bottom two equations shown here. (The top equation uses \hpos, for comparison.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: mathboxanchored.pdf
Type: application/pdf
Size: 15881 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20221206/d1565293/attachment.pdf>
-------------- next part --------------

There are two problems that I didn’t know how to fix.

1) The line connects to the box including the subscript or superscript, not just to the e.
2) I cannot make multiple connections to a single object, like the e^\mu in the center. If I try to connect top and bottom, I get no connections anywhere in the entire document.

The code for the formulas is:

\startformula
  % Each \connectboxanchors works alone, but both together make trouble:
    \connectboxanchors[top][top]{X}{Y}
    %\connectboxanchors[bottom][bottom]{Y}{Z}
  \mathboxanchored{X}{e}_\alpha \mathboxanchored{Y}{e}^\mu \mathboxanchored{Z}{e}_{\dot\beta}
    = \textfrac{1}{\sqrt{2}}\sigma_{\alpha\dot\beta}^\mu
\stopformula

I added code to turn the arrow produced by \connectboxanchors into my contraction overlay, but that doesn’t affect these issues.

> in your example we need a way to anchor on just the 'e' right? or do you want it on the e + super/subscript?

Yes, we only need to anchor to e. 

Thanks!
Gavin


More information about the ntg-context mailing list