ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: ntg-context@ntg.nl
Cc: Hans Hagen <j.hagen@freedom.nl>
Subject: Re: \hpos in math
Date: Tue, 6 Dec 2022 10:15:08 +0100	[thread overview]
Message-ID: <eaa0dee7-10ef-fadb-9131-b681c1a1cbe7@freedom.nl> (raw)
In-Reply-To: <4809FBC9-09D4-4055-A37C-23BE177454A7@comcast.net>

[-- Attachment #1: Type: text/plain, Size: 2796 bytes --]

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
-----------------------------------------------------------------

[-- Attachment #2: xx.tex --]
[-- Type: text/plain, Size: 1385 bytes --]

\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


[-- Attachment #3: Type: text/plain, Size: 496 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : https://contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2022-12-06  9:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-05 23:39 Gavin via ntg-context
2022-12-06  9:15 ` Hans Hagen via ntg-context [this message]
2022-12-06 13:22   ` Gavin via ntg-context
2022-12-07 12:42     ` \hpos in math - Half solved Gavin via ntg-context
2022-12-07 15:30       ` Hans Hagen via ntg-context
2022-12-07 22:25       ` Hans Hagen via ntg-context
2022-12-08  0:03         ` Gavin via ntg-context
2022-12-08  6:14           ` Mikael Sundqvist via ntg-context
2022-12-08 19:54             ` Otared Kavian via ntg-context
2022-12-08 21:47               ` Hans Hagen via ntg-context

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eaa0dee7-10ef-fadb-9131-b681c1a1cbe7@freedom.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@freedom.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).