[NTG-context] Passing info from MetaPost to TeX

Oliver Buerschaper oliver.buerschaper at mpq.mpg.de
Sat Jul 24 20:35:10 CEST 2010


>> is it possible to pass data from MetaPost back to TeX? This would be similar in spirit to, say, the MetaPost variable BodyFontSize that contains data from the TeX surrounding. Just the other way round.
> 
> maybe future mlib versions will provide something like that (writing something from mp to a lua table); currently you have to use a file or interpret the log (use show to print out values).

OK. What I have in mind is to vertically align a diagram with the math axis... something like:

---
\startuseMPgraphic{diagram}
   u := StrutHeight;
   draw origin--(2u,0)--(u,sqrt(3)*u)--cycle;
   % MathAxis at y-coordinate sqrt(3)*u/3
\stopuseMPgraphic


\starttext

\startformula
   A\useMPgraphic{diagram}
   =B
\stopformula

\stoptext
---

It would be great if the comment could be turned into a processing instruction for ConTeXt such that the triangle's center of mass ends up on the math axis of the formula.

What's the best way to achieve this?

Many thanks,
Oliver


More information about the ntg-context mailing list