[metapost] pdftex \pdflastxpos for metapost?

Hans Hagen pragma at wxs.nl
Mon May 9 21:05:52 CEST 2005


Hartmut Henkel wrote:
> Thanks, Taco and Dan!
> 
> On Mon, 9 May 2005, Dan Luecking wrote:
> 
> 
>>You could assign the value to a temporary dimension register (in
>>pdftex) and write that out. Example:
>>
>>\dimen0=\number\pdflastxpos sp %\dimen0=1\pdflastxpos should also work.
>>\write\myfile{\the\dimen0}
> 
> 
> yes, but problem is that the \pdfsavepos happens very late, only at
> shipout (else it won't know the absolute position), so you get a
> \pdflastxpos value only after a \pdfsavepos...\vfill\eject, or when
> using \write. Taco's version works if there is only one \pdfsavepos per
> page. If there are several, it seems one needs the \write. So what i'm
> looking for is conceptually something like:
> 
> \def\foo#1\relax{% here goes the trick of scaling #1
> }
> a\pdfsavepos
> \write\mywrite{\expandafter\foo\the\pdflastxpos\relax}
> 
> where \foo would make the division/scaling (no clue, how).
> 
> Regards, Hartmut
> 
> P.S. Now it appears that metapost wasn't the appropriate list, sorry.

who cares -)

\starttext

\def\SavePos{\pdfsavepos\write16{\the\dimexpr\pdflastxpos sp/10\relax}}

test \SavePos test \SavePos

\stoptext


-----------------------------------------------------------------
                                           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
-----------------------------------------------------------------



More information about the metapost mailing list