[NTG-context] MetaPost graphics within formulas

Oliver Buerschaper oliver.buerschaper at mpq.mpg.de
Sat Jul 26 10:47:24 CEST 2008

> The bounding box of the graphic is set on the base line. So you have  
> to
> add some artificial depth to the graphic.
> \starttext
> \startreusableMPgraphic{tetrahedral}
>         begingroup
> 	u := 10pt;
> 	draw (0,0)--(2u,0)--(u,sqrt(3)*u)--cycle;
>         draw boundingbox currentpicture withpen pensquare scaled .1;
>         endgroup;
> \stopreusableMPgraphic
> \def\Tetrahedral{\lower5pt\hbox{\reuseMPgraphic{tetrahedral}}}% needs
> some fiddling :)
> \startformula
> \Phi(\Tetrahedral)=F_{kln}^{ijm}\,v_iv_jv_kv_l\,
> \delta_{j^*nk^*}\,\delta_{l^*n^*i^*}\,\Phi(\emptyset)
> \stopformula
> \stoptext

That's exactly what I was looking for … thanks very much!

Out of curiosity just a few questions … why do you use grouping in the  
MetaPost code and why do you draw the bounding box explicitly? When I  
was experimenting with your suggestion a bit I tried leaving out those  
two commands at some point and surprisingly things still looked fine …  
And what's the difference between \startreusableMPgraphic and  
\startuseMPgraphic? Does caching play a role?

Thanks again,

More information about the ntg-context mailing list