[NTG-context] \hpos in math

Hans Hagen j.hagen at freedom.nl
Tue Dec 6 10:15:08 CET 2022


On 12/6/2022 12:39 AM, Gavin via ntg-context wrote:
> Hello List,
> 
> I am working on a project which combines graphics with formulas, like this:
> 
> My code for creating this formula is attached. It works well, but I have a couple of questions that could make it work better.
> 
> 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

> 2) Is there a way to limit the scope of the \hpos labels to a single formula. This could turn into a book length project, with several formulas per page and several connections per formula. If every \hpos in the entire book needs a unique identifier, I could go mad. Under no circumstances will I connect one formula to another, so I’d like to be able to use something like \hpos{A}{…}…\hpos{B}{…} in each formula. Any suggestions?

one problem is (and i'm working on that) that one could want multiple 
anchors on a math atom as well as pu tit on the nuclues only

> I’ve got to say, LMTX is an absolutely amazing tool for this project, which includes complicated networks of connections above and below many formulas. The integration of TeX, MetaPost, and Lua makes this project tremendous fun.

that's the idea

> P.S. For the curious, I’m using a method for doing General Relativity based on spinors rather than tensors, following the methods of Penrose and Rindler in their 1985 books “Spinors and Space-time.” In the typesetting example above, the e_\alpha and e_{\dot\beta} are basis spinors (one left-handed, one right-handed). The e^\mu is the Infeld-van der Waerden symbol relating the spin basis to the coordinate basis. The connections are spinor index contractions. The formula above relates the components of the Infeld-van der Waerden symbol to the Pauli sigma matrices. This relationship only works in flat space, so this is an easy example! [Penrose and Rindler, vol 1 p. 125]

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

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]

\setupbodyfont[dejavu]

\starttext

\setupboxanchorcontent
  [top,left]
  [rulecolor=darkyellow]

\setupboxanchorcontent
  [bottom,right]
  [rulecolor=darkblue]

\input tufte

$
    \connectboxanchors[top][top]{one}{two}
    x + \frac[source=\namedboxanchor{one}]{1+x}{2-x} =
    z + \frac[source=\namedboxanchor{two}]{1+x^2}{2-x^3}
$

\input ward


\connectboxanchors[top][top]{one}{two}

So how about
$
    x + \frac[source=\namedboxanchor{one}]{1+x}{2-x}
$
and
$
    z + \frac[source=\namedboxanchor{two}]{1+x^2}{2-x^3}
$
then. Of course we need to handle page crossing then.

\connectboxanchors[top][top]        {one}{two}
\connectboxanchors[top][top][dash=1]{three}{four}

And can we do
$
%     \showboxes
    x + \frac{1 \mathboxanchored{one}{+} x \mathboxanchored{three}{-} z}{2-x}
$
and
$
%     \showboxes
    z + \frac{1 \mathboxanchored{two}{+} x^2 \mathboxanchored{four}{-} z}{2-x^3}
$
to be more granular?

\blank[2*big]

\connectboxanchors[top]   [top]   [text={\small\small\strut\bf watch}]{one}  {two}
\connectboxanchors[bottom][bottom][text={\small\small\strut\bf out}]  {three}{four}

And can we do
$
%     \showboxes
    x + \frac{1 \mathboxanchored{one}{+} x - z}{2 \mathboxanchored{three}{-} x}
$
and
$
%     \showboxes
    z + \frac{1 \mathboxanchored{two}{+} x^2 - z}{2 \mathboxanchored{four}{-} x^3}
$
to be more granular?

\stoptext



More information about the ntg-context mailing list