Menu

#295 pgf 3.0.: current page node is disturbed when `\hoffset` is changed

TeX Live 2019
open
None
5
2019-02-14
2014-03-02
U_Fischer
No

With older version of pgf the green line in the following example was drawn from the lower left to the upper right of A3 page. With pgf 3.0 I have to add the \hoffset (as for the red line) manually. It this change intended or a bug?

\documentclass{scrartcl}
 \usepackage[T1]{fontenc}
 \usepackage{tikz,lipsum}

 \newenvironment{A3}
 {\clearpage
 \advance\hoffset by \pdfpagewidth
 \pdfpagewidth=2\pdfpagewidth
 \paperwidth=2\paperwidth
 }
  {\clearpage}


 \begin{document}
 \begin{A3}
 \tikz[overlay,remember picture]\draw[green,<->] (current page.south west) -- (current     page.north east);%
 \tikz[overlay,remember picture]\draw[red,<->] ([xshift=-\hoffset] current page.south west) -- ([xshift=-\hoffset]current page.north east);%
 \lipsum[1]

 \end{A3}
 \end{document}

Ulrike Fischer

Discussion

  • Christian Feuersänger

    Just for the records:

    I know that I changed something in the drivers for latex/plain tex/context regarding \hoffset.

    However,

    1. that change was post 3.0.0
    2. it appears to be unrelated (I undid the change and I can still reproduce Ulrike's problem).
     
  • U_Fischer

    U_Fischer - 2014-03-07

    I search a bit in the sources for "hoffset" and compared the files of 3.0 with the files from an older pgf version. I found out that if add this (from an older pgfsys-pdftex.def) to my document it behaves well again:

    \makeatletter
     \def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfpointorigin}
    \makeatother
    

    In pgf 3.0. the definition looks like this:

    \def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfqpoint{\hoffset}{\voffset}}
    

    Btw: The problem is not that hoffset in my example is changed in the middle of the document. This document doesn't work either:

    \documentclass{scrartcl}
     \usepackage[T1]{fontenc}
      \usepackage{tikz,lipsum}
       %\makeatletter\def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfpointorigin}\makeatother
    
       \advance\hoffset by 4cm
    
     \begin{document}
    
     \tikz[overlay,remember picture]\draw[green,<->] (current page.south west) --  (current     page.north east);%
    
     abc
    
     \end{document}
    

    Ulrike Fischer

     
  • Christian Feuersänger

    Thanks for finding the suggested fix.

    However, the modification with \hoffset and \voffset have been introduced intentionally as part of https://sourceforge.net/p/pgf/bugs/85/ . The limitation that \hoffset and \voffset might break is even listed in that ticket...

    @ Till can you take care of this bug?

     
  • Christian Feuersänger

    Assigning to Till

     
  • Christian Feuersänger

    • assigned_to: Till Tantau
     
  • Henri Menke

    Henri Menke - 2019-02-14
    • assigned_to: Till Tantau --> Henri Menke
    • Group: v1.0 (example) --> TeX Live 2019
     
  • U_Fischer

    U_Fischer - 2019-02-14

    Revisiting after some years, a side remark: the new code sets the origin at \hoffset/\voffset (relativ to the lower left corner). This implicitly assumes that the logical page is vertically centered on the physical page. So the code works only if crop is used with the option center. A better calculation for the vertical offset would be \pdfpageheight-\paperheight-\voffset:

    \documentclass{scrartcl}
    \usepackage[T1]{fontenc}
    \usepackage[a3,cross]{crop}
    \usepackage{tikz,lipsum}
    
    \makeatletter
    %\def\pgf@sys@pdf@mark@pos@pgfpageorigin{\pgfqpoint{\hoffset}{\dimexpr\pdfpageheight-\paperheight-\voffset}}
    
    \begin{document}
    
    \tikz[overlay,remember picture]\draw[green,<->] (current page.south west) 
          --  (current page.north east);%
    
    abc
    \end{document}
    

    (this wouldn't solve my problem, as I want to keep the physical origin/page nodes).

     
MongoDB Logo MongoDB