LaTeX forum ⇒ Page LayoutRemove Headers from blank Pages

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
User avatar
Mohsen Avaji
Posts: 14
Joined: Mon Aug 27, 2012 12:06 am

Remove Headers from blank Pages

Postby Mohsen Avaji » Wed Jul 03, 2013 11:18 am

Hi.

How to remove headers for pages between chapters?
Yours faithfully,
Mohsen Avaji.

Tags:

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Wed Jul 03, 2013 11:21 am

Kindly prepare a self-contained and minimal example to give an adequate problem description.


Thorsten
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

User avatar
Mohsen Avaji
Posts: 14
Joined: Mon Aug 27, 2012 12:06 am

Postby Mohsen Avaji » Wed Jul 03, 2013 4:47 pm

Following is the minimal example about removing headers for pages between chapters. Thank you for your cooperation.
  1. \documentclass[12pt,a4paper]{book}
  2. \usepackage{amsmath,amssymb,amsthm}
  3.  
  4. \usepackage{fancyhdr}
  5. \pagestyle{fancy}
  6. \setlength{\headheight}{16.4pt}
  7. \lhead{}
  8. \rhead{}
  9. \fancyhead[RE,LO]{\bfseries\thepage}
  10. \fancyhead[CE]{ \leftmark }
  11. \fancyhead[CO]{\rightmark}
  12. \cfoot{}
  13.  
  14. \begin{document}
  15. \chapter{Integral}
  16. \begin{equation}
  17. (f*g)(t)=\int_{0}^{t}f(t)g(x-t)\ dt
  18. \end{equation}
  19.  
  20. \chapter{Matrix}
  21. \begin{equation}
  22. AX=B
  23. \end{equation}
  24.  
  25. \chapter{Linear Algebra}
  26. \end{document}
Yours faithfully,
Mohsen Avaji.

User avatar
localghost
Site Moderator
Posts: 9204
Joined: Fri Feb 02, 2007 12:06 pm

Postby localghost » Wed Jul 03, 2013 5:58 pm

It needs a little modification of the \cleardoublepage command. We take its definition from the LaTeX kernel and supplement it with the command that enables the empty page style.
  1. \documentclass[12pt,a4paper]{book}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{geometry}
  4. \geometry{
  5. headheight=15pt
  6. }
  7.  
  8. \usepackage{fancyhdr}
  9. \fancyhf{}
  10. \fancyhead[LE,RO]{\thepage}
  11. \fancyhead[RE]{\leftmark}
  12. \fancyhead[LO]{\rightmark}
  13. \pagestyle{fancy}
  14.  
  15. \usepackage{lipsum} % only for dummy text, not for use in actual document
  16.  
  17. %% Patch for blank pages between chapters
  18. %% which disables the current page style
  19. \makeatletter
  20. \def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
  21. \hbox{}\thispagestyle{empty}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
  22. \makeatother
  23.  
  24. \begin{document}
  25. \chapter{Foo}
  26. \lipsum[1-3] % only for dummy text, not for use in actual document
  27.  
  28. \chapter{Bar}
  29. \lipsum[4-6] % only for dummy text, not for use in actual document
  30.  
  31. \chapter{Baz}
  32. \lipsum[7-9] % only for dummy text, not for use in actual document
  33. \end{document}


Remarks:

  • Users of a class from KOMA-Script should use the built-in mechanisms as described in Section 3.13 of the user guide.
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 2 guests