Page Layout ⇒ Different Layout for Pages starting Parts vs. Chapters
-
- Posts: 4
- Joined: Fri Apr 29, 2011 7:23 pm
Different Layout for Pages starting Parts vs. Chapters
From what I understand, both \part and \chapter set the page style to "plain" within the command, so that I can redefine what "plain" is (e.g. "\fancypagestyle{plain}{\fancyhf{} \fancyhead[R]{\thepage} \fancyfoot{}}") before to change all of those types of pages, but that would still keep the page styles on the beginning pages of parts vs. chapters the same.
The only way I can think of to have the two page styles be different would be to set the layout for "plain" inside whatever file is called to create a new part of chapter, but I don't even know what those files are called or where they'd be - or exactly what code to add/subtract from them even if I did.
So I was wondering two things... a) does anyone know how to make two different page styles for pages starting parts vs. chapters without editing other files (or can anyone confirm that that's not possible) and then b) if it's not possible, could someone walk me through what changes I'd need to make to what files to make those page layouts appear differently?
Any help would be much appreciated - thanks!
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
Different Layout for Pages starting Parts vs. Chapters
1. Create different page styles for parts, chapters and normal text
2. Use titlesec package to (re)define the look of parts and chapters, including corresponding page styles for both of them.
An example:
Code: Select all
\documentclass{report}
\usepackage{lipsum}% Just to generate some dummy text
\usepackage{fancyhdr}
\fancypagestyle{parts}{% Page style for Parts
\fancyhf{}
\fancyhead[R]{This is for parts – \thepage}
\fancyfoot{}
}
\fancypagestyle{chapters}{% Page style for Chapters
\fancyhf{}
\fancyhead[R]{This is for chapters – \thepage}
\fancyfoot{}
}
\fancyhf{}% Here you define page styles for normal text, "fancy" page style
\fancyhead[R]{Normal pages – \thepage}
\pagestyle{fancy}
\usepackage{titlesec}
\titleformat{\part}
[block]
{\Huge\bfseries\filcenter}% Text formatting
{\huge Part~\thepart\filcenter}% Settings the number
{0pt}% Space between the number and the title
{\\[20pt]\thispagestyle{parts}}% A command or text after the title
\titleformat{\chapter}
[block]
{\Huge\bfseries}
{\huge Chapter~\thechapter}
{0pt}
{\\[20pt]\thispagestyle{chapters}}
\begin{document}
\part{A part}
\chapter{A chapter}
\lipsum[1-12]
\section{A section}
\lipsum[1-12]
\end{document}
Different Layout for Pages starting Parts vs. Chapters
Code: Select all
\addtocontents{toc}{\protect\thispagestyle{desiredTOCpagestyle}}