I use memoir
class and I imitate one-sided printing with double-sided
printing thanks to the command (find in the memoir
manual)
\setlength{\evensidemargin}{\oddsidemargin}
The problem is that I have modified the header width with the command
\makerunningwidth
(see the minimal example below).
On odd-numbered pages, the header ends in the fore-edge margin but I want
it begins in the spine margin.
To understand my problem it is easier to compile this code with PDFLaTeX.
\documentclass[a5paper]{memoir}
\usepackage{xcolor, calc}
% Laying out the page
\newlength{\myuppermargin}
\setlength{\myuppermargin}{20mm}
\newlength{\mylowermargin}
\setlength{\mylowermargin}{30mm}
\newlength{\myspinemargin}
\setlength{\myspinemargin}{30mm}
\newlength{\myedgemargin}
\setlength{\myedgemargin}{15mm}
\newlength{\myheadheight}
\setlength{\myheadheight}{7mm}
\newlength{\myfootskip}
\setlength{\myfootskip}{10.5mm}
\newlength{\myheadsep}
\setlength{\myheadsep}{5mm}
\newlength{\mymarginparsep}
\setlength{\mymarginparsep}{3mm}
\newlength{\mymarginparwidth}
\setlength{\mymarginparwidth}{12mm}
\newlength{\mymarginparpush}
\setlength{\mymarginparpush}{10mm}
\setlrmarginsandblock{\myspinemargin}{\myedgemargin}{*}
\setulmarginsandblock{\myuppermargin}{\mylowermargin}{*}
\setmarginnotes{\mymarginparsep}{\mymarginparwidth}{\mymarginparpush}
\setheadfoot{\myheadheight}{\myfootskip}
\setheaderspaces{*}{\myheadsep}{*}
\checkandfixthelayout{}
% Imitate one-sided printing but the page style can be customized
\setlength{\evensidemargin}{\oddsidemargin}
% Page style
\newcommand*{\evenheadfont}{\sffamily\mdseries\itshape\normalsize\color{blue}}
\newcommand*{\pagenumfont}{\normalfont\mdseries\itshape\small}
\newcommand*{\oddheadfont}{\evenheadfont}
\setlength{\headwidth}{\textwidth + \marginparsep + \marginparwidth}
\makepagestyle{custom}
\makerunningwidth{custom}{\headwidth}
\makeheadrule{custom}{\headwidth}{\normalrulethickness}
\makeheadfootruleprefix{custom}{\color{blue}}{}
\makeheadposition{custom}{flushright}{flushleft}{}{}
\makepsmarks{custom}{%
\nouppercaseheads
\createmark{chapter}{both}{nonumber}{}{}
\createmark{section}{right}{shownumber}{}{. \space}
\createplainmark{toc}{both}{\contentsname}
\createplainmark{lof}{both}{\listfigurename}
\createplainmark{lot}{both}{\listtablename}
\createplainmark{bib}{both}{\bibname}
\createplainmark{index}{both}{\indexname}
\createplainmark{glossary}{both}{\glossaryname}%
}
\makeevenhead{custom}%
{\raisebox{-1.2pt}{\colorbox{blue}{\textcolor{white}{\pagenumfont\thepage}}}}%
{}%
{\evenheadfont\leftmark}
\makeoddhead{custom}%
{\oddheadfont\rightmark}%
{}%
{\raisebox{-1.2pt}{\colorbox{blue}{\textcolor{white}{\pagenumfont\thepage}}}}
\pagestyle{custom}
\newcommand{\sample}{Some text to experiment with page styles.}
\begin{document}
\chapter{My chapter}
\section{My section}
\newpage
\sample{} \sample{} \sample{} \sample{} \sample{} \sample{} \sample{}
\newpage
\sample{} \sample{} \sample{} \sample{} \sample{} \sample{} \sample{}
\end{document}
\headwidth
command: for odd pages, you need to offset it by the\marginpar
stuff, I think. (Didn't test the example, and I've never fiddled with all this\makehead*
stuff.) – jon May 2 '12 at 16:35\textwidth
and\myedgewidth
: the\headwidth
needs to fit comfortably in that. And it may always look kind of weird given the off-centre nature of the typeblock on the page ... but that is a matter of taste. – jon May 2 '12 at 16:39\headwidth
is (far) too wide for your odd pages. The only solution I see is to shorten it. Also, I think, then, that the outer margin for odd pages is too small. (And of course, this 'fixed' typeblock will not match up when looking 'through' the page to the other side --- but I guess you know that.) – jon May 2 '12 at 17:38\myegdemargin
) without modifying the\headwidth
? – Jouasse May 2 '12 at 18:16