1

I understand that the eso-pic package can be used to add pictures to every page, or to a single page.

But what about adding pictures to most pages?

Ideal behaviour: eso-pic adds pictures to every page, but I can "switch off" the picture for some pages with a \thispagestyle{empty} (or something else similarly convenient).


MWE

\documentclass{report}

\pagenumbering{gobble} \usepackage{eso-pic,color}

% Add colour footer \AddToShipoutPictureBG{ \AtPageLowerLeft{% \color{red}% \rule{\pdfpagewidth}{2cm}% } }

\begin{document}

This is my nice title page.

I don't want a colour footer here.

\clearpage

I understand that eso-pic makes it easy to add pictures to every page, or a single page. But what about adding pictures to \emph{most} pages?

\clearpage

Doing the good good science

\clearpage

For whatever reason (full page figure, table, whatever), I don't want a footer here either.

\end{document}


Thoughts

I understand that the internal \ESO@HookIBG stores all the picture commands to be used, and that I can clear its contents with \ClearShipoutPictureBG. I figured I could remove the pictures for a single page as:

  1. capture \ESO@HookIBG contents (\let?)
  2. call \ClearShipoutPictureBG
  3. page content
  4. restore \ESO@HookIBG from the capture of 1.

But I'm unsure how to actually implement this (and how I could make it's usage more convenient by hooking it into a \thispagestyle{empty} or something similar.)

jwalton
  • 243
  • How do you decide whether a page has a picture or not? – Bernard Jan 14 '21 at 10:46
  • Currently? I don't have a hard-and-fast rule. For the document I'm working on I don't want a picture on the title page, and I have some landscape pages where I don't want a picture. – jwalton Jan 14 '21 at 10:50

1 Answers1

1

With a new (current) latex you could try something like this

\documentclass{report}

\pagenumbering{gobble} \usepackage{eso-pic} \usepackage{color}

% Add colour footer \newif\ifmyfooter \global\myfootertrue \AddToShipoutPictureBG{ \AtPageLowerLeft{% \ifmyfooter \color{red}% \rule{\pdfpagewidth}{2cm}% \fi \global\myfootertrue } }

\DeclareHookRule {shipout/background}{mylabel}{before}{eso-pic} \begin{document}

This is my nice title page.

I don't want a colour footer here.

\clearpage \AddToHookNext{shipout/background}[mylabel]{\global\myfooterfalse}

I understand that eso-pic makes it easy to add pictures to every page, or a single page. But what about adding pictures to \emph{most} pages?

\clearpage

Doing the good good science

\clearpage

For whatever reason (full page figure, table, whatever), I don't want a footer here either. \AddToHookNext{shipout/background}[mylabel]{\global\myfooterfalse}

\end{document}

Ulrike Fischer
  • 327,261