1

I'm trying to write a document class with a twocolumn layout such that when a document is written using that class, a certain figure, e.g. a logo, is always inserted on a specific page - say, page 10. That is, if the document has less than 10 pages, the logo won't be shown. But if it is longer, the logo will appear on the top of page 10 in the outer column.

The documents written with my class will typically not contain any other figures.

The problem is - I don't even know where to start with this. By googling, I've found a number of related questions (such as e.g. this one) but nothing to really help me. Either I don't know what terms to search for, or my problem is too much of a niche issue. Any help is greatly appreciated.

Thomas
  • 253
  • 1
  • 8
  • You can use everypage, AddToHook{shipout/background} or even afterpage then test the page number. See https://tex.stackexchange.com/questions/398739/page-specific-headers-and-footers – John Kormylo Apr 11 '21 at 22:55

1 Answers1

2

enter image description here

You can suppress floats but then allow them after the 9th page.

\documentclass[twocolumn]{article}

\setcounter{totalnumber}{0} \AddToHook{shipout/before}{% \ifnum\value{page}=9 \setcounter{totalnumber}{1}\fi }

\begin{document}

\begin{figure}[t] \centering \rule{2cm}{2cm} \end{figure} aaa \newpage aaa \newpage aaa \newpage aaa \newpage aaa \newpage aaa aaa \newpage aaa \newpage aaa \newpage aaa \newpage aaa \newpage aaa aaa \newpage aaa \newpage aaa \newpage aaa \newpage aaa \newpage aaa aaa \newpage aaa \newpage aaa \newpage aaa \newpage aaa \newpage aaa aaa \newpage aaa \newpage aaa \newpage aaa \newpage aaa \newpage aaa \end{document}

this is using the built in hooks of the current latex release, but if you have an older release, packages are availabe to provide similar page hooks (\AtBeginShipout from atbegshi for example).

David Carlisle
  • 757,742
  • Indeed, I'm stuck with an older latex version. Do you have any hints on as to which packages I might want to look into? Thanks very much! – Thomas Apr 11 '21 at 21:18
  • possibly \AtBeginShipout from atbegshi package @Thomas – David Carlisle Apr 11 '21 at 21:19
  • 1
    Since the figure is supposed to be inserted by the document class itself, would I be able to do that without suppressing totalnumber and instead have the \begin{figure}...\end{figure} definition inside the hook (after the ifnum)? As I wrote before, I don't expect other figures to appear inside the actual document, just as part of the class. – Thomas Apr 11 '21 at 21:20
  • @Thomas er yes I guess so. – David Carlisle Apr 11 '21 at 21:21
  • Great, thanks again. This is definitely helpful. – Thomas Apr 11 '21 at 21:22