metafun: verbatimtex coming too late?
In this file, I intended that all labels would come out in 7pt: =========================== cut here ============================ \starttext \startMPenvironment \setupbodyfont[7pt] \stopMPenvironment \startMPinclusions def drawtext = label(btex In drawtext() macro. etex, origin); enddef; \stopMPinclusions \startstaticMPfigure{fig} drawtext; label(btex Inline in the figure. etex, (2in,0)); \stopstaticMPfigure hello, in 12pt, for comparison. \placefigure[force,none]{}{\usestaticMPfigure[fig]} \stoptext =========================== cut here ============================ However, only the label that is directly in the figure ("Inline in the figure.") comes out in 7pt. The other one, produced by the drawtext macro, comes out in 12pt. The resulting metapost file is file-fig.mp and the key portions are (with spacing adjusted a bit): def drawtext = label(btex In drawtext() macro. etex, origin); enddef; beginfig(1); verbatimtex \global \loadfontfileoncetrue \setupbodyfont [7pt] etex; drawtext; label(btex Inline in the figure. etex, (2in,0)); endfig; The verbatimtex..etex block inside the beginfig..endfig doesn't affect the btex..etex in the drawtext macro, I guess because drawtext is defined outside of the beginfig..endfig. This is all with context 2006.08.08. I tested it on the live context, but the transcript says "figure texweb-fig.pdf can not be found". A possible solution is to put the verbatimtex at the beginning of the mp file or after the input mp-grph, making it like this: verbatimtex \global \loadfontfileoncetrue \setupbodyfont [7pt] etex; def drawtext = label(btex In drawtext() macro. etex, origin); enddef; beginfig(1); drawtext; label(btex Inline in the figure. etex, (2in,0)); endfig; but does that break other assumptions? Another solution is textext instead of btex..etex, though I don't understand the differences between the two. The main one: textext expands the tex commands in its argument whereas btex..etex does not. But in regular metapost btex..etex does expand, so I'm confused a bit. For example, you can do "mpost file.mp" with file.mp being verbatimtex \def\M{{\rm M}} etex beginfig(1) label (btex mass $\M$ etex, origin); endfig; end -Sanjoy
I had wondered:
only the label that is directly in the figure ("Inline in the figure.") comes out in 7pt. The other one, produced by the drawtext macro, comes out in 12pt.
A possible solution is to put the verbatimtex at the beginning of the mp file or after the input mp-grph, making it like this:
The following lines do the above, and make all the btex..etex texts come out in the small size: \startMPextensions verbatimtex \the\everyMPTEXgraphic etex; \stopMPextensions It works okay on a few test files, but are there bad interactions? -Sanjoy `Never underestimate the evil of which men of power are capable.' --Bertrand Russell, _War Crimes in Vietnam_, chapter 1.
participants (1)
-
Sanjoy Mahajan