1

I need to create a latex template which will generate PDF with two zeros in Left margin at each page (MWE is provided below), and three zeros at the last page. Problem is with the last page as it is not giving the expected output. Instructions for this should be written in the preamble only.

\documentclass[12pt]{article}
\usepackage{blindtext}
\usepackage{eso-pic, rotating, graphicx}

\AddToShipoutPicture{\put(20,410){\rotatebox{0}{0}}}
\AddToShipoutPicture{\put(20,400){\rotatebox{0}{0}}}
\AddToShipoutPicture{\put(20,390){\rotatebox{0}{0}}}

\begin{document}
 \blindtext[8]  
\end{document}
  • I get the expected result, the zeros are on all three pages (tested with pdflatex in a current texlive). – Ulrike Fischer Apr 17 at 8:06
  • I get the dash on each of the three pages, also pdflatex in texlive (17 April 2019) – Henk Metselaar Apr 17 at 9:24
1

This solution uses the lastpage and refcount packages.

\documentclass[12pt]{article}
\usepackage{blindtext}
\usepackage{eso-pic, rotating, graphicx}
\usepackage{lastpage,refcount}

\AddToShipoutPicture{\put(20,410){\rotatebox{0}{0}}}
\AddToShipoutPicture{\put(20,400){\rotatebox{0}{0}}}
\AddToShipoutPicture{\ifnum\getpagerefnumber{LastPage}=\value{page}\put(20,390){\rotatebox{0}{0}}\fi}

\begin{document}
 \blindtext[8]  
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.