I want to have an image behind the page number in my latex document, and tried to write it like


The problem is: When I first have the line with the page number, and then the image, I only get the image, and if I have the other way round, then I only get the number. How can I have the number in front of the image? Should I use a background image for that?

  • What image is it? – Alenanno Feb 5 '16 at 19:01
  • A black tent (i.e. totally black figure, vectorized) – arc_lupus Feb 5 '16 at 19:04
  • As in a black triangle? – Alenanno Feb 5 '16 at 19:11
  • @Alenanno: Yes. – arc_lupus Feb 5 '16 at 20:21

Here's one way:

My text

enter image description here

  • Is there a possibility to shift the image also such that the number is not centered, but slightly shifted in one direction? – arc_lupus Feb 5 '16 at 21:15
  • @arc_lupus, one can easily move the page number within the image, by adding the x-shift as the 2nd argument and the y-shift as the 4th argument to \stackinset, as in \stackinset{c}{8pt}{c}{6pt}{inset}{base image}. – Steven B. Segletes Feb 5 '16 at 23:17
  • @arc_lupus The 1st argument to \stackinset is the horizontal anchor position, which can be left, center, or right. The 3rd argument is the vertical anchor, either top, center, or bottom. – Steven B. Segletes Feb 5 '16 at 23:19

You can set the content in the sequence that you want them layered.

With the above in mind, we can set the image in the Left header, which will be followed by setting of the Centred header:

enter image description here







The Left header is set in a box of width \textwidth which is naturally centred. Adjustment of the positioning of the image may be needed.

If all you want is a white page number on a black background, you can just use


which sets the page number using \colorbox:

enter image description here

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.