Page Layoutmultiple headers

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
Guillaume
Posts: 8
Joined: Mon Aug 29, 2011 1:27 pm

multiple headers

Post by Guillaume »

I'd like to change the headers in the back and front matter, how should I proceed?

Code: Select all

\documentclass[11pt,twoside]{book}
\input{preamble}
\begin{document}
\frontmatter
\include{title}
\include{abbreviations}
\include{prefaceandintro}
\mainmatter
\include{edition1}
\include{edition2}
\backmatter
\printindex[nominum]
\printindex[rerum]
\include{Biblio}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

multiple headers

Post by Johannes_B »

Are you using a package like scrlayer-scrpage or fancyhdr that helps you in customizing the headers and footers? What are you trying to achieve?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Guillaume
Posts: 8
Joined: Mon Aug 29, 2011 1:27 pm

multiple headers

Post by Guillaume »

fancyhdr

This is my "preamble" (which is a mess). What I get is "Table of Contents" on every single odd page :(

Code: Select all

% XeLaTeX can use any Mac OS X font. See the setromanfont command below.
% Input to XeLaTeX is full Unicode, so Unicode characters can be typed directly into the source.

% The next lines tell TeXShop to typeset with xelatex, and to open and save the source with Unicode encoding.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\usepackage{booktabs}
\usepackage{ledmac}
\linenummargin{inner}
\sidenotemargin{outer}
\usepackage{fancyhdr}
\fancyhf{} % sets both header and footer to nothing
\renewcommand{\headrulewidth}{0pt}
% your new footer definitions here
\fancyhead[CE,CO]{Text 1} 
\fancyhead[CE,CO]{Text 2}
\usepackage{adforn}
\usepackage{amsmath}
\usepackage{hanging}
\usepackage{pdfpages}
\textheight = 180.5 mm
\textwidth = 108.5 mm
\pagenumbering{arabic}
\usepackage[hang]{footmisc}
\setlength{\footnotemargin}{12pt}
\makeatletter
\renewcommand\@makefntext[1]{%
  \noindent\makebox[1em][r]{\@makefnmark}#1}
\makeatother
\usepackage{imakeidx} 
\makeindex[name=nominum, title=Index nominum, columns=2]
\makeindex[name=rerum, title=Index rerum, columns=2]
\pretolerance=100

\makeatletter
% And in the paragraphed footnotes, I'd like no colon too:
\def\parafootfmt#1#2#3{%
  \normal@pars
  \parindent=0pt \parfillskip=0pt plus 1fil
  {\bf\printlines#1|}%
  {\select@lemmafont#1|#2}~%
  #3\penalty-10 }
\makeatother
\let\Afootfmt\parafootfmt

%\newcommand{\rhet}[2]{\edtext{#1}{\Afootnote{#2}}}
\newcommand{\rhet}[2]{\edtext{ #1}{\Afootnote{] #2}}}
\newcommand{\oed}[2]{\edtext{ #1}{\Bfootnote{] #2}}}
\footparagraph{A}
\footparagraph{B}

%%%%%%%%%%%%%%%%
\raggedbottom


\newcommand*{\LeftWidth}{3.0cm}%
\newcommand*{\RightWidth}{\dimexpr\linewidth-\LeftWidth-2em\relax}%
\newcommand{\AlignedBrace}[2]{%
    \medskip\par\noindent%
    \parbox{\LeftWidth}{\raggedleft\textbf{#1}\strut~}%
    $\left\{~\parbox{\RightWidth}{\strut\textit{#2}\strut}\right.$%
}%


%\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
%\geometry{a4paper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}

\usepackage{amssymb}
%\renewcommand %These two commands are for double-spacing
%\baselinestretch{2}

% Will Robertson's fontspec.sty can be used to simplify font choices.
% To experiment, open /Applications/Font Book to examine the fonts provided on Mac OS X,
% and change "Hoefler Text" to any of these choices.

\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Brill}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}
\frenchspacing

\newfontfamily{\H}[Scale=0.9]{Lucida Grande}
\usepackage{caption}
\captionsetup{aboveskip=5pt}

\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist

\setcounter{secnumdepth}{0} % sections are level 1
Last edited by Stefan Kottwitz on Thu Jul 30, 2015 3:29 pm, edited 1 time in total.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

multiple headers

Post by Johannes_B »

This question has be crossposted to TeX.SX.

Please make your code compilable (Creating a minimal working example), there shouldn't be any included files. I bet you have a \leftmark{Table of Contents} or \fancuhead[O]{\contentsname} somewhere, but it is very very hard to tell.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Guillaume
Posts: 8
Joined: Mon Aug 29, 2011 1:27 pm

multiple headers

Post by Guillaume »

Apologies! This should help:

Code: Select all

\documentclass[11pt,twoside]{book}
\usepackage{ledmac}
\linenummargin{inner}
\sidenotemargin{outer}
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0pt}
% your new footer definitions here
\setcounter{secnumdepth}{0} % sections are level 1


\begin{document}
\backmatter
\tableofcontents
\newpage

\begin{center}
\section{PREFACE}
\end{center}
blahblahblah

\pagebreak 


\begin{center}
\section{INTRODUCTION}
\end{center}

blahblah
\mainmatter
\begin{titlepage} 
\begin{center}
\section{Hello}
\end{center}
\end{titlepage}

blahblah
\pagebreak

\begin{titlepage} 
\begin{center}
\section{Hello}
\end{center}
\end{titlepage}


\end{document}
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

multiple headers

Post by Johannes_B »

There are several issues with your code.

Your document starts with \backmatter?

You are using package ledmac which is eprecated and should be substituted with package reledmac. If ou don't want to change, the error message gives you a clue.

You are not using \chapter, which is the essential structuring command in the book class. Only chapters will update the left header (default).

You are placing \section-commands in a center environment. If you want to change the appearance of section and others, you can use package titlesec.

You have pagebreaks and \newpage everywhere, indicating that you indeed want to have chapters.

You have several titlepages in the mainmatter. A titlepage is part of the frontmatter.

Two titlepages after another will cause the page numbering to collapse, as you already noticed in two title pages in the book without restarting the pagenumbering.

Why do you have a section-command on a title page?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Guillaume
Posts: 8
Joined: Mon Aug 29, 2011 1:27 pm

Re: multiple headers

Post by Guillaume »

Many thanks for your help. I've got two editions in the book which need to be preceded by title pages. I understand I cannot use titlepage for them, what should I do instead?
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

multiple headers

Post by Johannes_B »

This thread is a mix to two TeX.SX questions.
Johannes_B wrote:The titlepage environment isn't doing a lot. Checks for one/twocolumn, sets the pagestyle to empty and sets the pagenumber. Just don't use it and you will be fine (keep \thispagestyle{empty} though). On the other hand, KOMA-classes [don't] (!sic) have that thing which is a leftover of an almost 30 years old bug.
two title pages in the book without restarting the pagenumbering

Code: Select all

\documentclass{book}
\usepackage{blindtext}
\newenvironment{guillaumeTitlepage}{\cleardoublepage\thispagestyle{empty}}{\newpage}
\begin{document}
\begin{guillaumeTitlepage}
	\Huge This is the first edition
\end{guillaumeTitlepage}
\blinddocument
\begin{guillaumeTitlepage}
	\Huge This is the second edition
\end{guillaumeTitlepage}
\blinddocument
\begin{guillaumeTitlepage}
	\Huge This is the third edition
\end{guillaumeTitlepage}
\blinddocument
\end{document}
Please read more about the customization and design of titlepages: How to customize my titlepage?. You can read more about the numbering at How to use pagenumbering in the document?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Guillaume
Posts: 8
Joined: Mon Aug 29, 2011 1:27 pm

multiple headers

Post by Guillaume »

I've switched to reledmac and it won't typeset now. What should I do? This is my new preamble:

Code: Select all

% XeLaTeX can use any Mac OS X font. See the setromanfont command below.
% Input to XeLaTeX is full Unicode, so Unicode characters can be typed directly into the source.

% The next lines tell TeXShop to typeset with xelatex, and to open and save the source with Unicode encoding.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\usepackage{booktabs}
\usepackage{imakeidx} 
\makeindex[name=nominum, title=Index nominum, columns=2]
\makeindex[name=rerum, title=Index rerum, columns=2]
\columnsep 4.5mm
\pretolerance=100
\usepackage{reledmac}
\linenummargin{inner}
\sidenotemargin{outer}
\usepackage{fancyhdr}
\fancyhf{} % sets both header and footer to nothing
\renewcommand{\headrulewidth}{0pt}
% your new footer definitions here
\fancyhead[CE]{\leftmark}
\fancyhead[CO]{\leftmark}
\pagestyle{fancy}
\usepackage{adforn}
\usepackage{amsmath}
\usepackage{hanging}
\usepackage{pdfpages}
\textheight = 180.5 mm
\textwidth = 108.5 mm
\usepackage[hang]{footmisc}
\setlength{\footnotemargin}{12pt}
\makeatletter
\renewcommand\@makefntext[1]{%
  \noindent\makebox[1em][r]{\@makefnmark}#1}
\makeatother

\usepackage{microtype}

% And in the paragraphed footnotes, I'd like no colon too:
\def\parafootfmt#1#2#3{%
  \normal@pars
  \parindent=0pt \parfillskip=0pt plus 1fil
  {\bf\printlines#1|}%
  {\select@lemmafont#1|#2}~%
  #3\penalty-10 }
\makeatother
\let\Afootfmt\parafootfmt

%\newcommand{\rhet}[2]{\edtext{#1}{\Afootnote{#2}}}
\newcommand{\rhet}[2]{\edtext{ #1}{\Afootnote{] #2}}}
\newcommand{\oed}[2]{\edtext{ #1}{\Bfootnote{] #2}}}
\footparagraph{A}
\footparagraph{B}

%%%%%%%%%%%%%%%%
\raggedbottom


\newcommand*{\LeftWidth}{3.0cm}%
\newcommand*{\RightWidth}{\dimexpr\linewidth-\LeftWidth-2em\relax}%
\newcommand{\AlignedBrace}[2]{%
    \medskip\par\noindent%
    \parbox{\LeftWidth}{\raggedleft\textbf{#1}\strut~}%
    $\left\{~\parbox{\RightWidth}{\strut\textit{#2}\strut}\right.$%
}%


%\usepackage{geometry}                % See geometry.pdf to learn the layout options. There are lots.
%\geometry{a4paper}                   % ... or a4paper or a5paper or ... 
%\geometry{landscape}                % Activate for for rotated page geometry
%\usepackage[parfill]{parskip}    % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx}

\usepackage{amssymb}
%\renewcommand %These two commands are for double-spacing
%\baselinestretch{2}

% Will Robertson's fontspec.sty can be used to simplify font choices.
% To experiment, open /Applications/Font Book to examine the fonts provided on Mac OS X,
% and change "Hoefler Text" to any of these choices.

\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text]{Brill}
\setsansfont[Scale=MatchLowercase,Mapping=tex-text]{Gill Sans}
\setmonofont[Scale=MatchLowercase]{Andale Mono}
\frenchspacing

\newfontfamily{\H}[Scale=0.9]{Lucida Grande}
\usepackage{caption}
\captionsetup{aboveskip=5pt}

\def\changemargin#1#2{\list{}{\rightmargin#2\leftmargin#1}\item[]}
\let\endchangemargin=\endlist

\setcounter{secnumdepth}{0} % sections are level 1
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

multiple headers

Post by Johannes_B »

Please don't mix so many different issues within just one forum thread. This will become a nightmare for any google user searching for a solution.


Why did you change to reledmac? I told you where you can find hints to suppress the error that is issued. On the other hand, switching to reledmac might be a good idea, but it will take you to make changes in your document.

Posting a preamble is useless, please always post minimal working examples.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply