# [NTG-pdftex] [ pdftex-Patches-438 ] \pdfsavepos in DVI mode

Mon Oct 17 13:39:57 CEST 2005

Patches item #438, was opened at 2005-10-16 23:52
You can respond by visiting:
http://sarovar.org/tracker/?func=detail&atid=495&aid=438&group_id=106

Category: Positioning
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Heiko Oberdiek (oberdiek)
Assigned to: Nobody (None)
Summary: \pdfsavepos in DVI mode

Initial Comment:
\pdfsavepos in DVI mode

Hello,

using \pdfsavepos in a package of mine (tabularht)
I was wondering, why \pdfsavepos is not allowed to
work in DVI mode. \pdfsavepos in PDF mode is based
on cur_h and cur_v, both coming from the DVI frontend.

The only difference I found is that the PDF format
and pdfTeX's PDF mode know about page dimensions.
Thus the directions of the axes are the same for
the PDF format and the values of \pdfsavepos
(\pdflastxpos, \pdflastypos).
Origin:          lower left corner
horizontal axis: values increasing from left to right
vertical axis:   values increasing from bottom to top
unit:            sp

The DVI case doesn't know about page dimensions, thus
I suggest using cur_h=0 and cur_v=0 as origin. It is
the left upper corner of the box that is being shipped
out.
Origin:          left upper corner of the box
horizontal axis: values increasing from left to right
vertical axis:   values increasing from bottom to top
unit:            sp

Thus the absolute values differ in both modes and I
don't see that this can be avoided. However, if the
application uses a reference point then the relative
values are exactly the same.

The attachted patch enables and implements \pdfsavepos
for the DVI mode. It also contains the patch for
bug 437 (Two \immediate cancel themselves).

Yours sincerely
Heiko <oberdiek at uni-freiburg.de>

----------------------------------------------------------------------

>Comment By: Heiko Oberdiek (oberdiek)
Date: 2005-10-17 13:39

Message:
Logged In: YES
user_id=1276

Hello,

I have now extended the patch: \pdfpagewidth/height
are now used for the page dimensions. Also the
funny DVI origin offset of 1in is taken into
account. Thus the values in DVI and PDF mode are
the same. The exception is \pdf{h,v}origin. If
the value is not 1in, then the values differ in
DVI and PDF mode. However, also the DVI and PDF
output will differ in this case. Thus the different
values are then ok, I think.
If someone wants to have the same values, he just
sets \pdfpage{width,height} and let \pdf{h,v}origin
untouched.

Hartmut Henkel wrote:
> to give page dimension info for pdftex also in
> DVI mode, one could implement the standard
> \special{papersize=x,y} also in pdftex (parallel
> to \pdfpagewidth/height), so that it would be
> scanned, and also go into the DVI file. Would
> this help?

I think, not really:
* Scanning of \specials are done in PDF mode already,
but here it is not really necessary, the current
* In DVI mode, the scanning of \special's contents
must then be added to set \pdfpage{width,height}.
But who needs this actually?
* Relative positioning with \pdfsavepos works
with or without the correct page size
information.
* Absolute positioning is more difficult in use
(If you are somewhere in a box, how do you
want to apply absolute positions?)
* If someone insist on absolute positioning,
he will probably not rely on an accidentally
issued \special{papersize=...}. He will probably
make sure, that the papersize information
is set and then he can also set
\pdfpage{width,height}.

Yours sincerely
Heiko <oberdiek at uni-freiburg.de>

PS: The name of the patch file is now
"v2-pdftex.ch.diff". And I have removed
the patch of fixed bug 437.

----------------------------------------------------------------------

Comment By: Hartmut Henkel (hhenkel)
Date: 2005-10-17 00:16

Message:
Logged In: YES
user_id=929

to give page dimension info for pdftex also in DVI mode, one
could implement the standard \special{papersize=x,y} also in
pdftex (parallel to \pdfpagewidth/height), so that it would
be scanned, and also go into the DVI file. Would this help?

Regards, Hartmut

----------------------------------------------------------------------

You can respond by visiting:
http://sarovar.org/tracker/?func=detail&atid=495&aid=438&group_id=106