Skip to content

problem with shipout + \pdfmanagement_add:nnn #81

@lemzwerg

Description

@lemzwerg

[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.

\RequirePackage{pdfmanagement-testphase}
\DocumentMetadata{}
\documentclass[landscape]{article}

\ExplSyntaxOn
\AddToHook{shipout}{%
  \ifodd\thepage
  \else
    \pdfmanagement_add:nnn{ThisPage}{Rotate}{180}%
  \fi}
\ExplSyntaxOff

\begin{document}
foo\newpage
bar\newpage
baz\newpage
urgh
\end{document}

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions