5

I'm trying to get a colored background for my page numbers, and it works okay - except when I want it to show on pdf pages (which is where it's most important). This also happens on the last page of text.

This is what it should look like:

page number in box

This is what it looks like on the pdf pages:

page number in box

MWE:

\documentclass[book,openeven,showtrims]{memoir}
% http://latex-my.blogspot.dk/2009/10/setting-page-size-and-margins.html
%% The stock paper size
\setstocksize{236mm}{161mm}

%% The 'real' page size
\settrimmedsize{230mm}{155mm}{*}

%% The stock paper will be trimmed 3mm from the
%% top edge and 3mm from the left edge
\settrims{3mm}{3mm}

%% Spine and trim page margins from main typeblock
\setlrmarginsandblock{20mm}{15mm}{*}

%% Top and bottom page margins from main typeblock
\setulmarginsandblock{20mm}{20mm}{*}

%% Header occupies height of a single line;
%% Bottom edge of footer is 7mm from bottom edge
%% of typeblock
\setheadfoot{\baselineskip}{7mm}

%% Bottom edge of header is 7mm from top edge of
%% typeblock
\setlength\headsep{7mm}
%\renewcommand\trimmarkscolor{\color{red}}
\trimLmarks
\checkandfixthelayout

\usepackage[xcdraw]{xcolor}
\usepackage[utf8]{inputenc}
\usepackage[danish]{babel}
\usepackage{graphicx}
\usepackage{bookman} % font
\usepackage{lipsum}
\usepackage{pdfpages}

\makepagestyle{mm}
\setlength{\fboxrule}{6pt}%
\makeevenfoot{mm}{\fcolorbox{black}{blue}{\hspace{.5em}\thepage}}{}{}
\makeoddfoot{mm}{}{}{\fcolorbox{black}{blue}{\hspace{.5em}\thepage}}
\pagestyle{mm}


\begin{document}
\chapter{Test}
\lipsum[1-20]
\includepdf[noautoscale,pagecommand={},pages=-]{mwepdf}
\end{document}

You can get the dummy pdf here: http://kristian.anapnea.net/mwepdf.pdf

I hope someone know what's up here as it makes very little sense to me!

6

Try

\makeevenfoot{mm}{\setlength{\fboxrule}{6pt}\setlength\fboxsep{2pt}\fcolorbox{black}{blue}{\hspace{.5em}\thepage}}{}{}
\makeoddfoot{mm}{}{}{\setlength{\fboxrule}{6pt}\setlength\fboxsep{2pt}\fcolorbox{black}{blue}{\hspace{.5em}\thepage}}

pdfpages locally sets \fboxsep and \fboxrule to zero. And those settings are then used by the headers. Adding suitable values for this into the headers saves the day. It does not afect the rest as the headers are groups.

| improve this answer | |

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.