# Re: [NTG-context] getting metafun positions within (displayed) math mode

Wow. I learnt about Maxwell's Equation 48 years ago. I never understood it then
nor on the intervening time despite sometimes helping design antennas. The
picture and its annotation definitely helps creating clarity. For my twopenneth
the effort is very worthwhile.

Thanks

---
Nigel King
Mob: +44 7917 803879
Work:+44 1364 655516

> On 16 Nov 2017, at 21:10, Sanjoy Mahajan <san...@olin.edu> wrote:
>
> Dear ConTeXters,
>
> For my sins, and to make students unhappy all over the world, I am
> writing another book: _A Student's Guide to Newton's Laws of Motion_
> (for Cambridge University Press, aka CUP).  As partial compensation, I
> convinced CUP that I may typeset it in ConTeXt and deliver them PDF.
>
> Being hopefully a guide actually useful to students, it will annotate
> every symbol in important equations, a feature cribbed from the first
> book of the _Student's Guide_ series, Dan Fleisch's _A Student's Guide
> to Maxwell's Equations_.
>
> I've attached an image of what such an annotated equation looks like
> (from page 2 of Fleisch's book).  It's like a labeled part diagram (say,
> for a laptop), where each part (here, each symbol) is connected with an
> line to its explanation.
>
> I'm trying to do so with a combination of ConTeXt, MetaPost/MetaFun,
> TikZ, and whatever else might work.  But I am a bit stuck at the
> following spot.
>
> My plan is to use MetaFun to get the coordinates of each symbol in a
> (displayed) equation and then, with MetaFun, connect those symbols to
> mini-paragraphs of explanation that surround the equation.
>
> But I am stuck on how to use \hpos in math mode. I'd like to do
> something like:
>
> \startformula
> \hpos{n1}{\sum}_{\hpos{n2}{0}}^{\hpos{n3}{1}}
> \stopformula
>
> to get the locations of the nodes n1, n2, and n3 without interfering
> with the math typesetting -- e.g., the engine should still know that
> \sum is in display-math mode, so it should be large and have its sub-
> and super-scripts below and above it, rather than next to it.
>
> However, the \hpos hides its argument in an \hbox, and thus hides it
> from the math layout.  Thus, I have to do something like this minimal
> example:
>
> \starttext
> \startformula
>  \sum_0^1                      % what it should look like
>  \quad
>  \hpos{n1}{$\displaystyle\sum$}_{\hpos{n2}{$0$}}^{\hpos{n3}{$1$}}
> \stopformula
> \stoptext
>
> The hpos'ed version after the \quad looks different, even after the
> \displaystyle hack.
>
> Is there a version of \hpos for math mode?  That would be the cleanest
> solution, because who knows what else would be needed for other cases,
> even if the limits can be placed correctly.
>
> Or is there a better way to annotate equations?
>
> (TikZ seems to have the same issue, in that it cannot see into equations.)
>
> Regards,
> --
> -Sanjoy
>
> <http://savelongwharfpark.org/>
> Save Long Wharf Park in Boston Harbor!
>
> <http://streetfightingmath.com/>
> Six reasoning tools to make hard problems easy.
>
> <annotated-equation.png>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the
> Wiki!
>
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

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

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