I have a book in my possession with page numbers that have graphics surrounding them. I was wondering if there were any way of accomplishing something like this in LaTeX. Here is an example of what I mean:

Example of page number with graphics surrounding it

My document uses the KOMA-script book class.

Thank you ahead of time for any help you can provide.

UPDATE: Using the recommendations by Salim Bou in their answer, this is the specific command that I used to get the effect desired:

\renewcommand{\pagemark}{{\color{gray}\vrule width0.1mm  height1.5ex depth2.5ex \ 
{\color{black}\arabic{page}}\color{gray}\ \vrule  width0.1mm height4ex depth0ex }}

It yields this result:

Preview of result of command shown above

Note: The slight difference between the two lines may be a result of the .pdf viewer I'm using as it's variable from page to page.

  • 1
    Renew the pagemark macro to use rules. You can use raisebox to vertically shift the rules. The height of the footer will change, leading to different output. – Johannes_B Dec 26 '16 at 7:47

Here a solution which modify \pagemark command and use \vrule to draw rules beside page number, you can modify thickness of rule by adding width<dim> to vrule like this:

\vrule width1.5pt height1.5ex depth2.5ex 

To change color of rules

{\color{your_color}\vrule width1.5pt height1.5ex depth2.5ex}

In this case you need to add xcolor package

\renewcommand{\pagemark}{{\color{gray}\vrule width1pt  height1.5ex depth2.5ex \ 
{\color{black}\arabic{page}}\ \vrule  width1pt height4ex depth0ex }}



enter image description here

  • This worked very well when I tried it, thank you. -- Though I will have to change the margins to compensate for the space that the lines took up vertically. The only question I have is this: is it possible to change the color of the lines? In my example picture and in the book I have, they're a lighter gray, so they don't draw so much attention. – J.D. Dec 26 '16 at 8:13
  • Answer updated. – Salim Bou Dec 26 '16 at 8:24
  • The width setting does not change the color, though. Is there a way to change the color, or is there only an option for changing the width? Thank you for the additional information. – J.D. Dec 26 '16 at 8:34

Try using fancyhdr along with TikZ. In the header, put


  \draw (0,0)--(0,1);
  \draw (0,0)--(0,1);

I do get a warning that the use of fancyhdr with KOMA-Script is not recommended, but the document does compile. Maybe KOMA-Script already has a way to play around with headers, in which case maybe it's possible to add the TikZ code there. Also, I used Texmaker instead of LyX (I don't have much experience with it), but hopefully it works with LyX as well.

  • Thank you for your answer Janis, but I'm wary of using something that results in a warning. I will keep those fancyhdr and TikZ in mind in the future, though -- as they may have other abilities that the other solution does not. – J.D. Dec 26 '16 at 23:46

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.