1

In a book, I want to include a small text at the end about the structure of the book. I want to include a figure of a page of the book itself for reference. The referenced page will be a different one than the one referencing it. This can be done by first compiling the pdf with a placeholder, extracting the page from the pdf and then including it as a minipage. Can this be done on one go, i.e. having the engine itself render the page in the minipage environment in one compilation run?

3
  • @Teepeemm, yes of course, should have mentioned that in the first place. May 10, 2021 at 16:24
  • tex.stackexchange.com/questions/69991/… seems relevant; though most solutions there are of the type "copy output file; include page using pdfpages/includegraphics", but just more automated. May 10, 2021 at 17:13
  • I think this may be possible with the atbegshi package, i.e. somehow identify the page's numbers when they are shipped out, save the page box to a list, and then at the shipout of the final page use the saved boxes. May 22, 2021 at 14:35

1 Answer 1

3

You can grab the page box before it is shipped out, for example

enter image description here

Here I used \AddToHook{shipout/before}, other hooks will give different effects, you may also want to try the new shipout hook to be added in the next release which is available currently (2022) using latex-dev

\documentclass[a4paper]{article}

\usepackage{graphicx}

\newbox\savedpage
\AddToHook{shipout/before}{%
  \ifnum\value{page}=1
   \global\setbox\savedpage\copy\ShipoutBox
  \fi}

\begin{document}

\section{aa}
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 


\begin{figure}[htp]
  \centering
  \includegraphics{example-image}
  \caption{abc}
\end{figure}

\section{aaa}
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 

\section{bbb}

xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 

\begin{figure}[htp]
  \centering
  \includegraphics{example-image-a}
  \caption{abc}
\end{figure}

xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 


\section{aa}
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 
xxx yyy xxx yyy xxx yyy xxx yyy 

\section{hmm}

And page 1 looked like

\begin{center}
  \fbox{\scalebox{0.25}{\makebox[\paperwidth][l]{%
    \hspace{1in}\usebox\savedpage}}}
\end{center}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .