> xysized(\MyFigWid,\MyFigHei)
ahh, interesting. A plain metapost way as described in my other mail would be possible if i could run pdftex after the mpost run and run afterwards mpost again. How this could be done?
Currently we're making a bunch of tools that deal with graphics (a part of the example framework). It's not that hard to provide a mechanism that will write a file with data which is acceptable for metapost.
anyhow, here's a solution:
In cont-new.tex, add:
\def\showexternalfigured
{\bgroup
\immediate\openout\scratchwrite=mpfigs.mp
\def\presetfigure[##1][##2]%
{\getfiguredimensionsonly[##1]% \pagefigure[##1]%
\immediate\write\scratchwrite
{registerfigure("##1",\figurewidth,\figureheight)}}
\pushendofline
\readjobfile\@@exfile\donothing\donothing
\popendofline
\immediate\closeout\scratchwrite
\egroup}in texexec.pl, patch:
[abc] into [abcd]
now you can run (in advance!):
texexec *.png --pdf --fig=d
and get a file mpfigs.mp
copy the following code to mp-figs.mp:
pair figuredimensions[]; string figurenames[] ; numeric noffigures ;
noffigures := 0 ;
def registerfigure(expr name,width,height) = noffigures := noffigures + 1 ; figurenames[noffigures] := name ; figuredimensions[noffigures] := (width,height) ; enddef ;
vardef figuredimensions(expr name) =
save ok, i ; boolean ok ; numeric i ; i := 0 ; ok := false ;
forever :
i := i + 1 ; ok := (name = figurenames[i]) ; exitif ok ;
endfor ;
if ok : figuredimensions[i] else : origin fi
enddef ;vardef figurewidth(expr name) = xpart figuredimensions(name) enddef ;
vardef figureheight(expr name) = ypart figuredimensions(name) enddef ;
end
and now you can say:
input mp-figs.mp ; input mpfigs.mp ;
and voila:
figurewidth("yourfig")
returns the width of the graphic
so: just one run in advance is needed
[just for testing; i'll think this over before i freeze/add it to context]
Hans
Hans
-------------------------------------------------------------------------
Hans Hagen | PRAGMA ADE | [EMAIL PROTECTED]
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
information: http://www.pragma-ade.com/roadmap.pdf
documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------_______________________________________________ ntg-context mailing list [EMAIL PROTECTED] http://www.ntg.nl/mailman/listinfo/ntg-context
