Page LayoutUnwanted ruler on blank page

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
eg0u30a2
Posts: 2
Joined: Tue Dec 28, 2021 2:01 pm

Unwanted ruler on blank page

Post by eg0u30a2 »

For some reason, I'm getting a rule in the header of a single blank page at the end of my thesis (before the appendices).

I'm using \usepackage{fancyhdr}

Does any have any idea why this might be?

Code: Select all

\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries\chaptername\ \thechapter.\ #1}{}} % Chapter text font settings
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection\hspace{5pt}#1}{}} % Section text font settings
\fancyhead[LO]{\rightmark} % Print the nearest section name on the left side of odd pages
\fancyhead[R]{\leftmark} % Print the current chapter name on the right side of even pages
\renewcommand{\headrulewidth}{0.5pt} % Width of the rule under the header
\addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly
\renewcommand{\footrulewidth}{0pt} % Removes the rule in the footer
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}} % Style for when a plain pagestyle is specified
%\fancyhf{}\fancyfootoffset[F]{3cm}
%\fancyfoot[L]{\thepage}
Thanks
Last edited by Stefan Kottwitz on Wed Dec 29, 2021 12:23 pm, edited 1 time in total.
Reason: code marked

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

Unwanted ruler on blank page

Post by Stefan Kottwitz »

Hi,

welcome to the forum!

First a quick thought - it's much better to post a small compilable example that shows the issue, so we can help fixing it. Just seeing some settings is just theoretical. A problem example could look like this:

Code: Select all

\documentclass{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries\chaptername\ \thechapter.\ #1}{}} % Chapter text font settings
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection\hspace{5pt}#1}{}} % Section text font settings
\fancyhead[LO]{\rightmark} % Print the nearest section name on the left side of odd pages
\fancyhead[R]{\leftmark} % Print the current chapter name on the right side of even pages
\renewcommand{\headrulewidth}{0.5pt} % Width of the rule under the header
\addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly
\renewcommand{\footrulewidth}{0pt} % Removes the rule in the footer
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}} % Style for when a plain pagestyle is specified
%\fancyhf{}\fancyfootoffset[F]{3cm}
%\fancyfoot[L]{\thepage}
\begin{document}
\chapter{Test}
text
\appendix
\chapter{Appendix}
\end{document}
If I click "Run LaTeX here", I can see the issue.

That's of course done by \renewcommand{\headrulewidth}{0.5pt}. Set it to 0pt, and it goes away. That (non-)empty page is in standard page style not plain. That's always the case when a chapter ends on a right-hand side, and an empty page is inserted so the next chapter (appendices here) start on a right-hand side.

You could manually insert a totally empty page for example by inserting

Code: Select all

\clearpage
\thispagestyle{empty}
before the appendices. But it's a general thing of pages before chapters.

Stefan
LaTeX.org admin
eg0u30a2
Posts: 2
Joined: Tue Dec 28, 2021 2:01 pm

Unwanted ruler on blank page

Post by eg0u30a2 »

Thank you so much
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Unwanted ruler on blank page

Post by Ijon Tichy »

Stefan Kottwitz wrote: You could manually insert a totally empty page for example by inserting

Code: Select all

\clearpage
\thispagestyle{empty}
before the appendices. But it's a general thing of pages before chapters.
Alternatively this could be done automatically for all the empty left pages before a new chapter using

Code: Select all

\usepackage[cleardoublepage=empty]{scrextend}
Package scrextend provides some of the functionality/improvements of the KOMA-Script classes for the standard classes.

Code: Select all

\documentclass{book}
\usepackage[cleardoublepage=empty]{scrextend}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{\sffamily\normalsize\bfseries\chaptername\ \thechapter.\ #1}{}} % Chapter text font settings
\renewcommand{\sectionmark}[1]{\markright{\sffamily\normalsize\thesection\hspace{5pt}#1}{}} % Section text font settings
\fancyhead[LO]{\rightmark} % Print the nearest section name on the left side of odd pages
\fancyhead[R]{\leftmark} % Print the current chapter name on the right side of even pages
\renewcommand{\headrulewidth}{0.5pt} % Width of the rule under the header
\addtolength{\headheight}{2.5pt} % Increase the spacing around the header slightly
\renewcommand{\footrulewidth}{0pt} % Removes the rule in the footer
\fancypagestyle{plain}{\fancyhead{}\renewcommand{\headrulewidth}{0pt}} % Style for when a plain pagestyle is specified
%\fancyhf{}\fancyfootoffset[F]{3cm}
%\fancyfoot[L]{\thepage}
\begin{document}
\chapter{Test}
text
\appendix
\chapter{Appendix}
\end{document}
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply