-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem with shipout
+ \pdfmanagement_add:nnn
#81
Comments
There is no "moment of the shipout". Shipout is a rather complex operation with lots of things happening there. The code that handles the
|
Not sure @u-fischer I agree. As documented, shipout/background has a very specific purpose, ie
The right place to manipulate the box to be shipped out should be the shipout hook, at least that's the intention, but perhaps that has to play with \ShipoutBox then |
@u-fischer, thanks! Note, however, that your code should actually be \DocumentMetadata{}
\documentclass[landscape]{article}
\ExplSyntaxOn
\AddToHook{shipout/background}{%
\ifodd\the\value{page}%
\pdfmanagement_add:nnn{ThisPage}{Rotate}{180}%
\fi}
\ExplSyntaxOff
\begin{document}
foo\newpage
bar\newpage
baz\newpage
urgh
\end{document} so that odd pages (including the first one) get rotated. @FrankMittelbach, the advantage of Ulrike's code is that it actually works 🙂 Using the |
@FrankMittelbach But the box is not manipulated. The code sets an attribute for the current Page object.
The code for it is in the shipout/background box (with other code related to PDF ressources that needs to be in a box) in the |
Sorry I didn't read the text, only used your code.
PDF resources needs to be for some engines inside a box, that's why there are all handled inside the shipout/background box. |
OK. Then I suggest to improve the documentation of |
I added a sentence. |
I'm aware that this is "technically" not necessary to use put commands, I'm concerned about the user perspective. Conceptually, I don't think that should happen in that hook. If that code is supposed but executed within the box it is meant for it would be more understandable (imo) if it is done as So I would suggest to make an explicit statement in the documentation of shipout/background that it can also be used for |
Yes: an extra hook, with a suitable name, sounds good in principal for such non-background actions. |
[I'm not sure whether this is a problem with
\pdfmanagement_add:nnn
, a problem with\AddToHook{shipout}
, or lacking documentation. ][LaTeX2e <2024-11-01>]
[L3 programming layer <2024-11-02>]
Consider the following example to rotate all odd pages.
I would expect that the above code rotates the first page, too – at the moment of the shipout,
\thepage
already has been set to the next page number, or so I think. However, it doesn't work, and I don't see why. My guess is that it is not suitable to use\thepage
for the test. What should be used instead?The text was updated successfully, but these errors were encountered: