Re: [NTG-pdftex] Possible bug in pdfetexk (re \hoffset)?
On Fri, Jan 27, 2006 at 06:17:16PM +0000, Philip TAYLOR wrote:
Dear all -- The following preamble produces a correctly centered letter using TeX, but PdfTeX appears to offset everything by about 1,5 em (see commented-out \advance at-end). A sample document follows.
Philip Taylor -------- % letter-macros
\def \from {\leftskip = 0 pt plus 1 fill \parskip = 0 ex \obeylines} \def \to {\rightskip = 0 pt plus 1 fill \parskip = 0 ex \obeylines} \def \body {} \def \blockquote {\vskip \parskip \leftskip = 3 em \rightskip = 0 ex plus 1 fill \parskip = 0 ex \obeylines} \def \signature {\vskip 3\parskip}
% pdfTeX also knows \pdfhorigin and \pdfvorigin % In my teTeX installation the values are set during generating % the format files in pdftexconfig.tex: % \pdfhorigin=1 true in % \pdfvorigin=1 true in % \showthe\pdfhorigin = 72.26999pt
\magnification \magstep 1
% Now the values of \pdfhorigin, pdfvorigin need to be % reassigned, see below
\parindent = 0 em \parskip = 3 ex
\hsize = 210 true mm \vsize = 297 true mm
\input ifpdf.sty % it sets \ifpdf for detecting pdfTeX in pdf mode
\begingroup \hoffset= 1 true in \voffset = 1 true in \globaldefs = 1
\ifpdf \pdfhorigin = 1 true in \pdfvorigin = 1 true in % now the value is 60.22462pt (same as \hoffset = 1 true in).
\pdfpagewidth = \hsize \pdfpageheight = \vsize
\fi
\advance \hsize by -2\hoffset \advance \vsize by -2\voffset \endgroup
Yours sincerely
Heiko
Phil, please READ http://www.pdftex.org/README <quote> WHAT TO DO IF YOU BELIEVE YOU HAVE FOUND A BUG IN pdfTeX ======================================================== Please read http://www.chiark.greenend.org.uk/~sgtatham/bugs.html and follow the guidelines there. Then go to the sarovar site of pdfTeX (http://sarovar.org/projects/pdftex/) and submit your bug report there. Here you can also report feature requests or patches. </quote> To report possible bugs in pdfTeX you DON'T cry wolf everywhere. On 2006-01-27 20:09:34 +0100, Heiko Oberdiek wrote:
On Fri, Jan 27, 2006 at 06:17:16PM +0000, Philip TAYLOR wrote:
Dear all -- The following preamble produces a correctly centered letter using TeX, but PdfTeX appears to offset everything by about 1,5 em (see commented-out \advance at-end). A sample document follows.
% pdfTeX also knows \pdfhorigin and \pdfvorigin % In my teTeX installation the values are set during generating % the format files in pdftexconfig.tex:
From the pdftex manual (also available from http://www.pdftex.org) <quote> - \pdfhorigin (dimension) This parameter can be used to set the horizontal offset the output box from the top left corner of the page. A value of 1 inch corresponds to the normal TeX offset. This parameter is read when pdfTeX starts shipping out a page to the pdf output. For standard purposes, this parameter should always be kept at 1 true inch. If you want to shift text on the page, use TeX's own \hoffset primitive. To avoid surprises, after global magnification has been changed by the \mag primitive, the \pdfhorigin parameter should still be 1 true inch, e. g. by typing \pdfhorigin=1 true in after issuing the \mag command. Or, you can preadjust the \pdfhorigin value before typing \mag, so that its value after the \mag command ends up at 1 true inch again. - \pdfvorigin (dimension) This parameter is the vertical companion of \pdfhorigin, and the notes above regarding \mag and true dimensions apply. Also keep in mind that the TeX coordinate system starts in the top left corner (downward), while pdf coordinates start at the bottom left corner (upward). </quote> Best Martin -- http://www.tm.oneiros.de
On Fri, Jan 27, 2006 at 08:09:34PM +0100, Heiko Oberdiek wrote:
On Fri, Jan 27, 2006 at 06:17:16PM +0000, Philip TAYLOR wrote:
Dear all -- The following preamble produces a correctly centered letter using TeX, but PdfTeX appears to offset everything by about 1,5 em (see commented-out \advance at-end). A sample document follows.
% pdfTeX also knows \pdfhorigin and \pdfvorigin % In my teTeX installation the values are set during generating % the format files in pdftexconfig.tex: % \pdfhorigin=1 true in % \pdfvorigin=1 true in % \showthe\pdfhorigin = 72.26999pt
\magnification \magstep 1
% Now the values of \pdfhorigin, pdfvorigin need to be % reassigned, see below
\pdfhorigin = 1 true in \pdfvorigin = 1 true in
See also the discussion in the newsgroup comp.text.tex
(pdftex broken in tetex-3: offsets incorrect).
Here I posted some code that can be put into the plain format
for pdfTeX in PDF mode that adds the \pdf{h,v}origin fixing
into the macros of \magnification:
\expandafter\def\expandafter\m@g\expandafter{%
\m@g
\pdfhorigin 1 true in%
\pdfvorigin 1 true in%
% Also correction of \pdfpagewidth and \pdfpageheight
% is a good idea.
}%
With converting of \pdfpage{width,height} to truept:
\expandafter\def\expandafter\m@g\expandafter{%
\m@g
\pdfhorigin 1truein%
\pdfvorigin 1truein%
\mag@fix\pdfpagewidth
\mag@fix\pdfpageheight
}
\def\mag@fix#1{%
#1=\expandafter\convert@truept\the#1\relax
}
\begingroup
\catcode`P=12
\catcode`T=12
\lowercase{%
\endgroup
\def\convert@truept#1PT{%
#1truept%
}%
}
Yours sincerely
Heiko
participants (2)
-
Heiko Oberdiek
-
Martin Schröder