7

I'm typesetting a book using the memoir document class. The overall layout comes with a background image. This image incorporates space for the page numbers in the footer which looks like a slot machine. This means that there exists an individual space for each number (up to three) with a fixed width and height.

I've already customized the \footskip and the overall size of header and footer to match the design. However, it is hard to get the numbers to fit exactly in the different "slots" of the slot machine background.

Is there a way to tell LaTeX how much space it should use for a glyph so that the page number fits the background image exactly?

4
  • Welcome to TeX.sx! No need to add thanks, simply upvote any good replies you may receive. Commented Feb 11, 2013 at 23:48
  • Thanks for the warm welcome! I've successfully implemented David Carlisle's answer and extended it for odd/even pages. I'd like to post the addition to give something back --- where would I do that? The comments do not provide sufficient space for the code.
    – Technaton
    Commented Feb 12, 2013 at 15:58
  • You can self answer. You can even unaccept my solution and accept yours if you like, I'm not too desperate for the 15 points:-) Commented Feb 12, 2013 at 16:29
  • Ok, I did that (answering my own question). Accepting my own answer would be rude, I guess, since without your answer I would never have been able to come up with the odd/even page numbers extension. Honour where honour's due. :-)
    – Technaton
    Commented Feb 12, 2013 at 18:25

2 Answers 2

6

enter image description here

You probably don't want the \fbox and can adjust the coordinates to fit...

\documentclass{article}



\def\pageslots{%
  \edef\tmp{%
  \ifnum\value{page}<10 0\fi
  \ifnum\value{page}<100 0\fi
  \arabic{page}}%
  \expandafter\xpageslots\tmp}

\def\xpageslots#1#2#3{%
\begin{picture}(200,20)
\put(10,10){\fbox{#1}}%
\put(60,10){\fbox{#2}}%
\put(110,10){\fbox{#3}}%
\end{picture}}

\begin{document}


\pageslots

\setcounter{page}{100}

\pageslots

\setcounter{page}{123}

\pageslots



\end{document}
0
0

This is an extension of David Carlisle's answer which takes odd/even page numbers into account. It uses the offset parameter of the picture environment to place the picture box:

\def\oddpageslots#1#2#3{%
    \begin{picture}(46,20)(17,-1)
        \put(0,0){\huge\textbf{#1}}%
        \put(16,0){\huge\textbf{#2}}%
        \put(31,0){\huge\textbf{#3}}%
    \end{picture}}

\def\evenpageslots#1#2#3{% \begin{picture}(46,20)(-32,-1) \put(0,0){\huge\textbf{#1}}% \put(16,0){\huge\textbf{#2}}% \put(31,0){\huge\textbf{#3}}% \end{picture}}

\def\pageslots{% \edef\tmp{% \ifnum\value{page}<10 0\fi \ifnum\value{page}<100 0\fi \arabic{page}}% \ifthenelse{\isodd{\value{page}}}% {\expandafter\oddpageslots\tmp}% {\expandafter\evenpageslots\tmp}}

You must log in to answer this question.

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