Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am writing my thesis using the class memoir. I have two problems to get nice headings/footers. First, I want the page number to be in the footer, on the right or on the left but for the first page of a chapter, it stays centered. Then, for pages with an even number, I want the name of the current chapter to be inserted in the headings. I can not find how to do these things. Here is my code:

\documentclass[12pt]{memoir}

\usepackage{blindtext}
\usepackage[english]{babel}
\nouppercaseheads
\makepagestyle{these}
\makeevenhead{these}{\rightmark}{}{}
\makeoddhead{these}{}{}{\leftmark}
\makeheadrule{these}{\textwidth}{\normalrulethickness}
\makeevenfoot{these}{\thepage}{}{}
\makeoddfoot{these}{}{}{\thepage}
\makepsmarks{these}{%
\createmark{section}{left}{shownumber}{}{\ } 
\createmark{chapter}{right}{shownumber}{}{\ }
\createplainmark{toc}{both}{\contentsname}}
\pagestyle{these}

\makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\frontmatter

\title{My title} 

\maketitle

\chapter{Thanks}
\tableofcontents

\chapter{Introduction}\label{intro}
\Blindtext

\mainmatter
\part{1st Part}

\chapter{My Chapter}
\section{My Section}

\Blindtext
\end{document}
share|improve this question
    
welcome to tex.stackexchange! The example you're providing is not going to work other people's machines, as we don't have intro.tex. If you simply want to fill your document with some text for demonstration purposes, please use the blindtext package an its commands like \Blinddocument etc. –  Nils L Feb 25 '13 at 14:57
    
You really should use \frontmatter and \mainmatter instead of that whole hackery with \chapter* and \addtocontents. –  kahen Feb 25 '13 at 18:03
    
I made the changes both of you asked. –  RCoudret Feb 26 '13 at 7:44
add comment

1 Answer 1

up vote 0 down vote accepted

Surely there must be a question on this site, which already give the answer to this, but you could do something like:

\documentclass[
a4paper, % Stock and paper size.
11pt, % Type size.
% article,
% oneside, 
onecolumn, % Only one column of text on a page.
% openright, % Each chapter will start on a recto page.
% openleft, % Each chapter will start on a verso page.
openany, % A chapter may start on either a recto or verso page.
]{memoir}

\usepackage{lipsum} % Will come in handy below...

%%% HEADER AND FOOTER 
%%%--------------------------------------------------------------

\makepagestyle{standard} % Make standard pagestyle

\makeatletter                 % Define standard pagestyle
\makeevenfoot{standard}{}{}{\thepage} % Even footer
\makeoddfoot{standard}{\thepage}{}{}  % Odd Footer
\makeevenhead{standard}{}{\leftmark}{} % ...
\makeoddhead{standard}{}{\leftmark}{}  %
% \makeheadrule{standard}{\textwidth}{\normalrulethickness}
\makeatother                  %

\makeatletter % Make marks (to put chapter title etc. in the header)
\makepsmarks{standard}{
\createmark{chapter}{both}{shownumber}{\@chapapp\ }{ \quad }
\createmark{section}{right}{shownumber}{}{ \quad }
\createplainmark{toc}{both}{\contentsname}
\createplainmark{lof}{both}{\listfigurename}
\createplainmark{lot}{both}{\listtablename}
\createplainmark{bib}{both}{\bibname}
\createplainmark{index}{both}{\indexname}
\createplainmark{glossary}{both}{\glossaryname}
}
\makeatother   

\makepagestyle{chap} % Make new chapter pagestyle

\makeatletter
\makeevenfoot{chap}{}{\thepage}{} % Define new chapter pagestyle
\makeoddfoot{chap}{}{\thepage}{}  %
\makeevenhead{chap}{}{}{}   %
\makeoddhead{chap}{}{}{}    %
% \makeheadrule{chap}{\textwidth}{\normalrulethickness}
\makeatother

\nouppercaseheads
\pagestyle{standard}               % Choosing pagestyle and chapter pagestyle
\aliaspagestyle{chapter}{chap} %

%%% DOCUMENT
%%%----------------------------------------------------------------------

\begin{document}

\chapter{Introduction}
\lipsum[1-10]

\chapter{Conclusions and Outlook}
\lipsum[1-10]

\end{document}

I'm not sure that this is exactly what you desire. If not, I hope the code is clear enough for you to make the changes yourself.

share|improve this answer
    
Thanks for this answer. I can now make the changes I want. For an unknown reason, I thus have to use \createmark with both and right rather than with left and right. The command \aliaspagesstyle allows me to modify the style of the first page of each chapter. –  RCoudret Feb 26 '13 at 9:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.