\textext can fail in definitions in \startMPinclusions
Another test file for metafun. I know that textext doesn't work in loops. I don't understand how it's implemented enough to know why, but is the reason for its not working in loops the same as the reason it doesn't work in included definitions (related to static analysis of the code)? The following file gives an example of what I mean. It gives a page saying "unknown", but if one uses draw \textext{directly} directly (the commented-out line) then it works as expected. I see the same behavior with \sometxt{}. [All with context 2006.08.08] ==================== cut here ==================== \starttext \startMPinclusions def yy = draw \textext{via yy def} enddef; \stopMPinclusions \startMPcode % draw \textext{directly}; % would give "via yy def" as the text yy; % gives "unknown" as the text on the page \stopMPcode \stoptext ==================== cut here ==================== Oh maybe here's the problem. The log file says (1.tex is the test file): system(mpost -progname=metafun -mem=metafun 1-mpgraph)...executed. Doing that by hand to get PDF gives a figure containing "unknown": $ mpost -progname=metafun -mem=metafun 1-mpgraph $ mptopdf 1-mpgraph.1 But "texexec --mpgraphic 1.mp" produces the right figure. So why does \startMPcode run the wrong command? The following works fine: ==================== cut here ==================== \starttext \startMPinclusions def yy = draw \textext{via yy def}; enddef; \stopMPinclusions \startstaticMPfigure{a} yy; \stopstaticMPfigure \usestaticMPfigure[a] \stoptext ==================== cut here ==================== The log shows startstaticMPfigure running texexec: system(texmfstart --ifchanged=1a-a.mp texexec --mpgraphic 1a-a.mp)...executed. Oh I think I know why mpost is being called with \startMPcode: It gets fooled by the label hidden inside the def, so it thinks that there is no need to run the more complicated texexec comment. I tried two hacks^H^H^H^Htests to check this: 1. Added \forceMPTEXgraphictrue right after \starttext, and then the figure came out fine. Not sure whether this method will work if there is more than one figure (\ifforceMPTEXgraphic might get reset to false after each figure). 2. Added an explicit \textext{} in the figure: \startMPcode label(\textext{jj},(1in,1in)); yy; \stopMPcode and the yy produces the right text. Though I still don't know why the staticMPfigure doesn't need either hack. -Sanjoy
Sanjoy Mahajan wrote:
Another test file for metafun. I know that textext doesn't work in loops. I don't understand how it's implemented enough to know why, but is the reason for its not working in loops the same as the reason it doesn't work in included definitions (related to static analysis of the code)?
The following file gives an example of what I mean. It gives a page saying "unknown", but if one uses draw \textext{directly} directly (the commented-out line) then it works as expected. I see the same behavior with \sometxt{}. [All with context 2006.08.08]
==================== cut here ==================== \starttext \startMPinclusions def yy = draw \textext{via yy def} enddef; \stopMPinclusions
\startMPcode % draw \textext{directly}; % would give "via yy def" as the text yy; % gives "unknown" as the text on the page \stopMPcode \stoptext ==================== cut here ====================
Oh maybe here's the problem. The log file says (1.tex is the test file):
system(mpost -progname=metafun -mem=metafun 1-mpgraph)...executed.
Doing that by hand to get PDF gives a figure containing "unknown":
$ mpost -progname=metafun -mem=metafun 1-mpgraph $ mptopdf 1-mpgraph.1
But "texexec --mpgraphic 1.mp" produces the right figure. So why does \startMPcode run the wrong command? The following works fine:
==================== cut here ==================== \starttext \startMPinclusions def yy = draw \textext{via yy def}; enddef; \stopMPinclusions
\forceMPTEXgraphictrue inclusions are not parsed for MPTEX content
\startstaticMPfigure{a} yy; \stopstaticMPfigure
\usestaticMPfigure[a] \stoptext ==================== cut here ====================
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
participants (2)
-
Hans Hagen
-
Sanjoy Mahajan