Page Layoutfancyhdr | Footer & Header with Roman & Arabic Page Numbers

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
max_mad666
Posts: 12
Joined: Thu Sep 08, 2011 4:04 pm

fancyhdr | Footer & Header with Roman & Arabic Page Numbers

Post by max_mad666 »

Hello everybody,

I would like to print a twoside document in order to read it like a book. So basically about the page numbers it should look like that.
  • The page number of left pages need to be at the very left side.
  • The page number of right pages need to be at the very right side.
I use fancyhdr package and the code is :

Code: Select all

\lhead[]{}
\chead[]{}
\rhead[]{}
\lfoot[\thepage]{Title}
\cfoot[]{}
\rfoot[Titre]{\thepage}
But the fact is that my first pages are beginning with Roman numbers and then with continue with Arabic numbers.

It's good working for the Roman numbers :

Code: Select all

PageNumber & Title |||| Title & PageNumber
But when it switches to the arabic number the page are inside the paper:

Code: Select all

Title & PageNumber |||| PageNumber & Title
[/color]

But I want it like :

Code: Select all

PageNumber & Title |||| Title & PageNumber
[/color]
I may add one more Roman page to solve the issue. But this is not possible in my case. So how can i solve my issue.

Thank you so much


P.-S. I've spend lot of time doing research about it on Google but I still can't solve my problem.
Last edited by Stefan Kottwitz on Fri Jun 22, 2012 4:32 pm, edited 1 time in total.

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

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

fancyhdr | Footer & Header with Roman & Arabic Page Numbers

Post by cgnieder »

Without a Infominimal working example everythings is just guessing, since I don't want to build one of my own.

You might want to try the package scrpage2 from the koma-script bundle instead of fancyhdr. It provides \ifoot (inner foot) and \ofoot (outer foot).

Regards
site moderator & package author
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

fancyhdr | Footer & Header with Roman & Arabic Page Numbers

Post by Stefan Kottwitz »

fancyhdr is capable of working with a two-sided layout, such as by

Code: Select all

\fancyfoot[LE,RO]{\thepage}
\fancyfoot[LO,RE]{Title}
Just be aware that the after a \pagenumbering{arabic} command the next page will be numbered 1, so it would become an odd-numbered, i.e. right-hand page, even if the previous page had already an odd number.

Stefan
LaTeX.org admin
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

fancyhdr | Footer & Header with Roman & Arabic Page Numbers

Post by cgnieder »

I've been working »KOMA-Sript only« for too long, it seems... :( I might have remembered the \fancyfoot, else...
site moderator & package author
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: fancyhdr | Footer & Header with Roman & Arabic Page Numb

Post by Stefan Kottwitz »

It's always good to recommend scrpage2 as a very good alternative, even with standard classes. It could become a start to work with KOMA-Script later on.

Stefan
LaTeX.org admin
max_mad666
Posts: 12
Joined: Thu Sep 08, 2011 4:04 pm

fancyhdr | Footer & Header with Roman & Arabic Page Numbers

Post by max_mad666 »

Hello,
Thank you for your recommendation. However, I forget to tell you that I'm using XeLaTeX and I cannot use the Koma class...

@Stefan_K

I'm afraid but I've tried :

Code: Select all

\fancyhead[LE,RO]{}
\fancyhead[LO, RE]{}
\fancyfoot[LE,RO]{Title}
\fancyfoot[LO, RE]{\thepage}
\fancyfoot[CE,CO]{}
But I still have the same issue because either the pages of the roman numbers or either the arabic number will be in the center (cf. printscreen). I'm sorry but I still don't get how to solve the issue... (solving witouth Komma script I mean...)
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

fancyhdr | Footer & Header with Roman & Arabic Page Numbers

Post by Stefan Kottwitz »

The page number will be in the center by default on pages with plain page styles. However, you could use

Code: Select all

\fancypagestyle{plain}{}
to change that, see 7 Redefining plain style in the fancyhdr manual.

Stefan
LaTeX.org admin
max_mad666
Posts: 12
Joined: Thu Sep 08, 2011 4:04 pm

fancyhdr | Footer & Header with Roman & Arabic Page Numbers

Post by max_mad666 »

Hello,
I guess I don't understand the concept I've tried many different possibilities but I still can't make it work. I execute the following example with the command line :

Code: Select all

xelatex main.tex
xelatex main.tex
Here is my example.

Code: Select all

\documentclass[11pt,french, twoside]{article}
\usepackage{polyglossia} 
\usepackage{csquotes} 
\setdefaultlanguage{english} 
\setmainfont[Numbers=OldStyle,Mapping=tex-text]{Myriad Pro}
\usepackage[a4paper]{geometry} 
\geometry{verbose,tmargin=2.5cm,bmargin=2.5cm,lmargin=3.5cm,rmargin=2.5cm}
\usepackage{fancyhdr} 
\pagestyle{fancy} 
\usepackage{setspace}
\usepackage{titlesec} 
\usepackage{titletoc}
\usepackage{lipsum}

% ------------------------------------------------------------------------------
% Arabic pages after Table of Contents
% ------------------------------------------------------------------------------ 
\pagenumbering{roman}
\let\myTABLES\tableofcontents
\renewcommand\tableofcontents{%
\myTABLES
\clearpage
\pagenumbering{arabic}
}

% ------------------------------------------------------------------------------
% Custom header and footer
% ------------------------------------------------------------------------------ 
\fancyhead[LO]{}
\fancyhead[RO]{} %\rightmark
\fancyhead[LE]{}
\fancyhead[RE]{} %\rightmark
\fancyfoot[LO,RE]{Title\\ Author Name}
\fancyfoot[LE,RO]{\thepage}
\fancyfoot[CE,CO]{}
% ------------------------------------------------------------------------------
% Make@other & Make@letter
% ------------------------------------------------------------------------------ 
\makeatletter
\makeatother

% ------------------------------------------------------------------------------
% Each section = new page
% ------------------------------------------------------------------------------ 
\let\stdsection\section
\renewcommand\section{\newpage\stdsection}

% ------------------------------------------------------------------------------
% Document 
% ------------------------------------------------------------------------------ 
\begin{document}
	\section*{First page empty}
	\lipsum[2]
	\thispagestyle{empty} 
	
	\section*{Some page with roman number}
	\lipsum[1]
	
	\tableofcontents{}
	
	\section{Arabic starts here but pages numbers are on wrong side}
	\lipsum
\end{document}
Output samples are attached.

Thanks a lot
Attachments
captures.zip
Output samples.
(201.41 KiB) Downloaded 358 times
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

fancyhdr | Footer & Header with Roman & Arabic Page Numbers

Post by cgnieder »

Everything is working as it should. However, you have two odd pages following each other (iii and 1). That's why the page number is on the same side (as defined for odd pages by you). If you change

Code: Select all

\renewcommand\tableofcontents{%
  \myTABLES\clearpage\pagenumbering{arabic}}
into

Code: Select all

\renewcommand\tableofcontents{%
  \myTABLES\cleardoublepage\pagenumbering{arabic}}
Everything looks fine.

Regards
site moderator & package author
max_mad666
Posts: 12
Joined: Thu Sep 08, 2011 4:04 pm

Re: fancyhdr | Footer & Header with Roman & Arabic Page Numb

Post by max_mad666 »

Wowwwwwww nice, thank you so much for your help. :mrgreen: :mrgreen: :P
Post Reply