6

How can I display (draw) a picture next to the page number.

At best, the "style" of the picture would be calculated automatically, depending on the current page number, e.g., draw a circle on even page numbers and a square on odd ones.

1
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count. This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). Commented Apr 5, 2011 at 8:18

2 Answers 2

9

You can change the footer or header where the page number is displayed using e.g. the fancyhdr package which also permits to have different headers for odd and even pages.

Minimal example:

\documentclass{book}
\usepackage{fancyhdr}

\fancyfoot[CE]{\thepage\rlap{ $\circ$}}
\fancyfoot[CO]{\thepage\rlap{ $\Box$}}
\pagestyle{fancy}

\usepackage{amssymb}% for \Box symbol
\usepackage{lipsum}% for example text
\begin{document}
\lipsum[1-100]
\end{document}

However, this only works for double-sided formats. In single-sided ones fancyhdr only takes one format. You have to make the distinction by yourself:

\documentclass{article}
\usepackage{fancyhdr}

\fancyfoot[C]{\thepage\rlap{ \ifodd\value{page}$\Box$\else$\circ$\fi}}
\pagestyle{fancy}

\usepackage{amssymb}% for \Box symbol
\usepackage{lipsum}% for example text
\begin{document}
\lipsum[1-100]
\end{document}

Just substitute $\Box$ and $\circ$ with the pictures you want. I placed them inside \rlap so that the lap over to the right, i.e. the officially do not take space. This way the do not interfere with the centering of the page number.

Inside the header and footer it should be safe to use \value{page} directly. Inside normal text it doesn't hold the correct value yet, because the macro is read before the decision is made if the text fits on the current page or has to go to the next one. However AFAIK the header and footer are added after the page was assembled and \value{page} should hold the correct value.

3
\documentclass[a5paper]{scrbook}

\renewcommand\thepage{%
  \ifthispageodd{\arabic{page}\rlap{\rule[-\dp\strutbox]{50pt}{\normalbaselineskip}}}
                {\llap{\rule[-2cm]{20pt}{2cm}}\arabic{page}}}

\usepackage{lipsum}
\begin{document}
\lipsum[1-100]
\end{document}

You must log in to answer this question.

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