TransWikia.com

Put text at given a page number

TeX - LaTeX Asked on February 27, 2021

Is there any easy way to insert some text at a given page number? I could manually trace the page and write something there, but looking for a geeky solution. I am not worried about the position of the text, just accessing the page would work.

documentclass{article}
usepackage{lipsum}


begin{document}
lipsum[1-50]

%%%%%%%% Write `Some garbage text` at page 3
end{document}

One Answer

If you just want to place some text at some random location on page 3, here's an option using eso-pic:

enter image description here

documentclass{article}

usepackage{lipsum}
usepackage{eso-pic}

AddToShipoutPictureFG{% Place something in the page ForeGround...
  AtTextUpperLeft{% ...at the text block upper left corner...
    ifnumvalue{page}=3 % ...only on page 3...
      makebox[textwidth]{% ...in the horizontal centre of the text block...
        raisebox{dimexpr-.5height-.5textheight}{% ...at the vertical centre of the text block
          Huge RaNDoM TeXT
        }%
      }%
    fi
  }%
}

begin{document}

sloppylipsum[1-50]

end{document}

Correct answer by Werner on February 27, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP