I'm producing a latex document through sphinx latex templates. This means I cannot (unless with hacking) edit the latex contents after \begin{document}. I am able to set the background, and even able to differentiate it based on the page numbering with this command

        }, scale=0.5, opacity=1, angle=0}

My problem is that \ifnum\value{page}=1 is evaluated as true multiple times, first on the front page, than on other pages that apparently reset the page counter (specifically, in the ToC page and in the very first chapter.

I believe that this is caused by the fact that the first page has no page number, the ToC has roman numbering and the first chapter resets the counting to arabic. This causes the value of the counter page to be reset and restart from 1, which is the condition to set the frontpage background.

I don't mind if all pages have same numbering and title page has the page written. I just need the frontpage bg to not appear elsewhere

1 Answer 1


With the help of an extra boolean \iffirstpage,



    scale=0.5, opacity=1, angle=0

a \newpage % background image is example-image-a
b \newpage % example-image-b

c \newpage % example-image-b
d          % example-image-b

You must log in to answer this question.

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