Page Layoutfancyhdr different pagestyle in different chapters

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
bonobeando
Posts: 8
Joined: Sun Mar 22, 2009 12:10 am

fancyhdr different pagestyle in different chapters

Post by bonobeando »

I use fancyhdr package for my book, so that chapter titles appear left and section titles appear right, both to the top. But in Preface there is not sections at all, so that the right header is blank. How can I make a different fancyhdr style for a different chapter as Preface? Sorry, my English is so bad as my LaTeX knowledges :? .
Here my fancyhdr Layout, Thanks!

Code: Select all

\usepackage{fancyhdr}
\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{%
        \markboth{#1}{}}
\renewcommand{\sectionmark}[1]{%
        \markright{\thesection\ #1}}
\fancyhf{}
\fancyhead[LE,RO]{\small\textbf\thepage}
\fancyhead[CO]{\small\textbf\rightmark}
\fancyhead[CE]{\small\textbf\leftmark}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\addtolength{\headheight}{0pt} 
\fancypagestyle{plain}{%
   \fancyhead{} 
   \renewcommand{\headrulewidth}{0pt} 
}
\setlength{\headheight}{15pt}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

fancyhdr different pagestyle in different chapters

Post by localghost »

I suggest to use the titlesec package instead. It allows to declare various new page styles and offers a complete different interface for customization. From my point of view it is more flexible and much easier to handle than the fancyhdr package and I would recommend it for the standard classes.


Best regards
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
bonobeando
Posts: 8
Joined: Sun Mar 22, 2009 12:10 am

Re: fancyhdr different pagestyle in different chapters

Post by bonobeando »

Thank you! I don't know the package, but I will try it.
Post Reply