0

I am trying to have a one sided layout for a book in memoir (that is: each page shall have the same right and left margins) but I want the header and the footer to have different margins as well: the header shall be always on the left on a smaller left margin while the page numbering, appearing in the footer, shall be on the extreme right for odd pages and extreme left for the even ones.

So far, so good, I was able to use fancyhdr (and the ifthenelse package) to mimic this behaviour. However I am not able to define a principled margins for the page numbers: what I am trying to accomplish is to have the left margin equal the right margin as if they were on a two sided layout.

Here is the code I wrote so far:

% !TEX encoding = UTF-8 Unicode
\documentclass[oneside]{memoir}
\usepackage{polyglossia}
\setmainlanguage{italian}

\setmainfont{Plantin MT Pro}
\usepackage{anyfontsize}
\usepackage{ragged2e}
\usepackage{titlesec}
\usepackage[head=10mm]{geometry}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{showframe}
\usepackage{ifthen}
\usepackage[all]{nowidow}


\let\footruleskip\undefined
\usepackage{fancyhdr}
\newcommand{\footerfont}{\fontsize{9}{10}\selectfont\setmainfont{Founders Grotesk}}
\newcommand{\headerfontii}{\fontsize{7}{8}\selectfont}
\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{\markboth{\uppercase{#1}}{}}
\renewcommand{\sectionmark}[1]{\markright{\uppercase{#1}}}

\fancyhead{}
\fancyheadoffset{16mm}
\fancyfootoffset{17mm}

\renewcommand{\headrulewidth}{0pt}
\fancyfoot{}

\fancyhead[LO]{\ifthenelse{\isodd{\value{page}}}{\colorbox{White}{\raisebox{6mm}[0cm][0cm]{\headerfontii\rightmark}}}{\colorbox{White}{\raisebox{6mm}[0cm][0cm]{\headerfontii\leftmark}}}}

\fancyfoot[L]{\ifthenelse{\isodd{\value{page}}}{}{\colorbox{White}{\raisebox{-23mm}[0cm][0cm]{\footerfont\thepage}}}}
\fancyfoot[R]{\ifthenelse{\isodd{\value{page}}}{\colorbox{White}{\raisebox{-23mm}[0cm][0cm]{\footerfont\thepage}{}}}}


\setstocksize{225mm}{160mm} %Finale
\settrimmedsize{\stockheight}{\stockwidth}{*}
\settrims{0cm}{0cm}
\setlrmarginsandblock{26mm}{42mm}{*}
\setulmarginsandblock{25mm}{42mm}{*}
%\settypeblocksize{152mm}{92mm}
%\setlrmargins{5mm}{*}{*}

%\setlrmargins{*}{*}{1}
\checkandfixthelayout
\fixpdflayout

\title{Italic. Identità Nazionale Regionale, nuovi codici visivi di rappresentazione}
\author{}
\date{} % Delete this line to display the current date

% \markboth{\thesection}{pisello}

%%% BEGIN DOCUMENT
\begin{document}
\fontsize{12}{14.4}\selectfont
\RaggedRight

\end{document}
%%% Local Variables:
%%% mode: xelatex
%%% TeX-master: t
%%% End:

And this is what it looks like: as you can see the margin on the left of the first page number is smaller than the one on the right of the number in the second page. What is a way to accomplish this? enter image description here

UPDATE: What I want is to have the red margins to have the same length (the smaller one that is on the left page) and different from the green margin, which is the text margin (this is alredy accomplished by setting the fancyheadoffset parameter)

2
  • 1
    you should not use fancyhdr with memoir, I'm not quire sure what it is you are trying to do. Your code is very confusing.
    – daleif
    Feb 25, 2015 at 14:13
  • thanks but different margins are my problem
    – rano
    Feb 25, 2015 at 14:57

1 Answer 1

1

This can be used as a starting point. We use a twoside setup that are then tricked into looking like a oneside layout

\documentclass[a4paper]{memoir}
% just to show they are vastly different
\setlrmarginsandblock{2cm}{4cm}*
\checkandfixthelayout
% trick
\setlength\evensidemargin{\oddsidemargin}
\usepackage{lipsum}

\makepagestyle{m}
\makeoddhead{m}{\leftmark}{}{}
\makeevenhead{m}{\leftmark}{}{}
\makeoddfoot{m}{}{}{\thepage}
\makeevenfoot{m}{\thepage}{}{}

\copypagestyle{n}{m}
\makeoddhead{n}{}{}{}
\makeevenhead{n}{}{}{}

\aliaspagestyle{chapter}{n}

\pagestyle{m}
\begin{document}

\chapter{Test}

\lipsum[1-15]
\end{document}
6
  • I am using fancyhdr since I need to have the header and footer margins different from the ones for the text (see picture)
    – rano
    Feb 25, 2015 at 14:57
  • 1
    All of that can be configured as well. I still do not understand what you are trying to do, that the images does not help much. What does those boxes have to do with everything?
    – daleif
    Feb 25, 2015 at 14:58
  • the boxes are a trick to make the header rise over the margin I set with memoir. can I specify the different margins with memoir only? could you please provide a sketch of it?
    – rano
    Feb 25, 2015 at 15:30
  • It is still not clear what so ever what you are attempting. So I don't know what to make a sketch of.
    – daleif
    Feb 25, 2015 at 15:36
  • You can see in the picture that the header 'PREMESSA' has a smaller left margin than the text box (the same goes for the number '4' in the footer). I am using fancyhdr to specify those margins against the ones I specified for the text box with memoir
    – rano
    Feb 25, 2015 at 15:50

You must log in to answer this question.

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