Page Layout ⇒ Remove Headers from blank Pages
- Mohsen Avaji
- Posts: 16
- Joined: Mon Aug 27, 2012 12:06 am
Remove Headers from blank Pages
How to remove headers for pages between chapters?
Mohsen Avaji.
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
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Remove Headers from blank Pages
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
- Mohsen Avaji
- Posts: 16
- Joined: Mon Aug 27, 2012 12:06 am
Remove Headers from blank Pages
Code: Select all
\documentclass[12pt,a4paper]{book}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{fancyhdr}
\pagestyle{fancy}
\setlength{\headheight}{16.4pt}
\lhead{}
\rhead{}
\fancyhead[RE,LO]{\bfseries\thepage}
\fancyhead[CE]{ \leftmark }
\fancyhead[CO]{\rightmark}
\cfoot{}
\begin{document}
\chapter{Integral}
\begin{equation}
(f*g)(t)=\int_{0}^{t}f(t)g(x-t)\ dt
\end{equation}
\chapter{Matrix}
\begin{equation}
AX=B
\end{equation}
\chapter{Linear Algebra}
\end{document}
Mohsen Avaji.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Remove Headers from blank Pages
\cleardoublepage
command. We take its definition from the LaTeX kernel and supplement it with the command that enables the empty
page style.
Code: Select all
\documentclass[12pt,a4paper]{book}
\usepackage[T1]{fontenc}
\usepackage{geometry}
\geometry{
headheight=15pt
}
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\leftmark}
\fancyhead[LO]{\rightmark}
\pagestyle{fancy}
\usepackage{lipsum} % only for dummy text, not for use in actual document
%% Patch for blank pages between chapters
%% which disables the current page style
\makeatletter
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}\thispagestyle{empty}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\makeatother
\begin{document}
\chapter{Foo}
\lipsum[1-3] % only for dummy text, not for use in actual document
\chapter{Bar}
\lipsum[4-6] % only for dummy text, not for use in actual document
\chapter{Baz}
\lipsum[7-9] % only for dummy text, not for use in actual document
\end{document}
- Users of a class from KOMA-Script should use the built-in mechanisms as described in Section 3.13 of the user guide.
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10