LaTeX with fancyhdr and fancy page style by default removes the headers and footers in pages with only floats (without text). ¿How can I keep the headers and footers in float pages? ¿Maybe any command with \iffloatpage?
Thanks
Page Layout ⇒ Headers and Footers on Float Pages
Headers and Footers on Float Pages
Last edited by Txuko on Sun Apr 24, 2011 11:37 am, edited 1 time in total.
NEW: TikZ book now 40% off at Amazon.com for a short time.
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Headers and Footers on Float Pages
I don't think so.Txuko wrote:LaTeX with fancyhdr and fancy page style by default removes the headers and footers in pages with only floats (without text). […]
Code: Select all
\documentclass[11pt,a4paper,twoside,english]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[headheight=14pt]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{fancyhdr}
\usepackage{blindtext}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\nouppercase\rightmark}
\fancyhead[LO]{\nouppercase\leftmark}
\pagestyle{fancy}
\begin{document}
\chapter{Foo}
\section{Foo}
\Blindtext
\begin{table}[!p]
\caption{Dummy table}\label{tab:dummy}
\centering
\rule{12.8cm}{7.2cm}
\end{table}
\chapter{Bar}
\section{Bar}
\Blindtext
\end{document}
Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Headers and Footers on Float Pages
Sorry. Then another command is causing that behaviour. It's this script. The script was made to remove the headers in empty pages, but it removes the headers in float pages too. ¿How can I avoid to remove the headers and footers in float pages?
Thanks and sorry again.
Code: Select all
\makeatletter
\def\clearpage{%
\ifvmode
\ifnum \@dbltopnum =\m@ne
\ifdim \pagetotal <\topskip
\hbox{}
\fi
\fi
\fi
\newpage
\thispagestyle{empty}
\write\m@ne{}
\vbox{}
\penalty -\@Mi
}
\makeatother
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Headers and Footers on Float Pages
With \clearpage you redefined the wrong command. It requires to redefine the \cleardoublepage command. This redefinition is derived from a suggestion in Section 15 of the fancyhdr manual.
And next time please provide spontaneously a minimal example.
Code: Select all
\documentclass[11pt,a4paper,english]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[headheight=14pt]{geometry}
\usepackage[font=small,labelfont=bf,tableposition=top]{caption}
\usepackage{fancyhdr}
\usepackage{blindtext}
\fancyhf{}
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\nouppercase\rightmark}
\fancyhead[LO]{\nouppercase\leftmark}
\pagestyle{fancy}
\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}
\section{Foo}
\Blindtext
\begin{table}[!p]
\caption{Dummy table}\label{tab:dummy}
\centering
\rule{12.8cm}{7.2cm}
\end{table}
\chapter{Bar}
\section{Bar}
\Blindtext
\end{document}
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Headers and Footers on Float Pages
Thanks. That was the solution.