latex2e icon indicating copy to clipboard operation
latex2e copied to clipboard

Suggestion for a new shipout hook with really complete \ShipoutBox

Open rolfn opened this issue 1 year ago • 2 comments

Brief outline of the enhancement

Within the shipout/before hook, the box \ShipoutBox contains neither foreground nor background material. What can I do to manipulate the really complete page? I think it's missing a shipout/completebox or shipout/justbefore hook, where the \ShipoutBox is in the completely finished state.

rolfn avatar Sep 15 '22 11:09 rolfn

Could you give a use case of what you want to do at this point? I'm not saying that it is unreasonable to have a hook there but it has some implications and I would therefore like to better understand what kind of workflow you have in mind.

FrankMittelbach avatar Sep 20 '22 22:09 FrankMittelbach

The following example shows the problem. The circles are not mirrored. A more complex case is my package blowup which can resize all pages of a document. There I use the package atbegshi, which does not use shipout/foreground or shipout/background. The effort for a user (packet writer) would be greatly simplified with a completely-filled-box-hook. Also, the shipout hooks would be more consistent with it because they would be complete.

\listfiles
\documentclass[a4paper,oneside]{article}
\usepackage{blindtext,xcolor,pict2e,graphicx}
\usepackage[left=30mm,right=30mm]{geometry}
\setlength\parindent{0pt}

\AddToHook{shipout/background}{%
  \put(0,0){\color{red!30}\circle*{2\paperwidth}}%
}

\AddToHook{shipout/before}{%
  \setbox\ShipoutBox=\vbox{\moveright1in\box\ShipoutBox}%
  \setbox\ShipoutBox=\hbox to\paperwidth{\box\ShipoutBox\hss}%  
  \setbox\ShipoutBox=\hbox{\reflectbox{\box\ShipoutBox}}%
  \setbox\ShipoutBox=\vbox{\moveleft1in\box\ShipoutBox}%
}

\begin{document} \Large
  \blindtext \par \vfill \blindtext
  \newpage
  \blindtext \par \vfill \blindtext
\end{document}

rolfn avatar Sep 21 '22 06:09 rolfn

added hook shipout to be called just in front of executing the \shipout primitive

FrankMittelbach avatar Nov 09 '22 18:11 FrankMittelbach