LaTeX forum ⇒ Page LayoutTable overlapping with my page number!!

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
rexkykwok
Posts: 6
Joined: Wed Feb 24, 2010 7:55 pm

Table overlapping with my page number!!

Postby rexkykwok » Wed Feb 24, 2010 8:08 pm

Hi all,

I have created a table with captions which is good enough to fit into 1 single page but however just a bit too long to have the captions overlapping with the page number. I have tried to get rid of the page number on that specific page by using \thispagestyle{empty} within the table description, but unfortunately it has blanked out the page number in the previous page instead.

Any suggestions are much appreciated. Please excuse my naive question as I am relatively new to the latex world!

Regards,
Rex

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net
LaTeX Beginner's Guide LaTeX Cookbook
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Table overlapping with my page number!!

Postby gmedina » Wed Feb 24, 2010 10:00 pm

Hi,

the fancyhdr package offers the \iffloatpage command to deal with those situations. Please refer to the package documentation for further information.
1,1,2,3,5,8,13,21,34,55,89,144,233,...

rexkykwok
Posts: 6
Joined: Wed Feb 24, 2010 7:55 pm

Re: Table overlapping with my page number!!

Postby rexkykwok » Thu Feb 25, 2010 6:32 am

I have already input the following:

\iffloatpage{\thispagestyle{empty}}{\thispagestyle{plain}}

also I have defined my table position with \begin{table}[P] but still not showing me the correct outcome. Have I missed anything?

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Re: Table overlapping with my page number!!

Postby gmedina » Thu Feb 25, 2010 6:36 am

Can you please post a compilable version of a document including the complete preamble that you are using and the offending table?
1,1,2,3,5,8,13,21,34,55,89,144,233,...

rexkykwok
Posts: 6
Joined: Wed Feb 24, 2010 7:55 pm

Re: Table overlapping with my page number!!

Postby rexkykwok » Thu Feb 25, 2010 7:59 am

Here's the command I have used:

\documentclass[a4paper,12pt,oneside]{report}
\usepackage{fancyhdr}
\iffloatpage{\thispagestyle{empty}}{\thispagestyle{plain}}
\begin{document}
\begin{table}[P]
\centering
\footnotesize{
\begin{tabular*}{\textwidth}{l l c c}
.
.
.
\end{tabular*}\\
}
\end{table}
\end{document}

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Table overlapping with my page number!!

Postby gmedina » Fri Feb 26, 2010 4:12 am

You have to use something like the following (from your code I assumed that the page style for the whole document is plain; if that's not the case, you will have to do the necessary modifications):

\documentclass[a4paper,12pt,oneside]{report}
\usepackage{fancyhdr}

\fancypagestyle{plain}{%
  \fancyhf{}
  \fancyfoot[C]{\iffloatpage{}{\thepage}}
  \renewcommand{\headrulewidth}{0pt}}
\pagestyle{plain}

\begin{document}

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 

\begin{table}[p]
  \centering
  \rule{10cm}{20cm}
  \caption{text text text text text text text text text text text text text text text text text text
    text text text text text text text text text text text text text text text text text text text text
    text text text text text text text text text text text text text text text text text text text text 
    text text text text text text text text text text text text text text}
\end{table}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...

rexkykwok
Posts: 6
Joined: Wed Feb 24, 2010 7:55 pm

Re: Table overlapping with my page number!!

Postby rexkykwok » Sat Feb 27, 2010 12:33 am

It does the trick! Thanks gmedina.

rexkykwok
Posts: 6
Joined: Wed Feb 24, 2010 7:55 pm

Re: Table overlapping with my page number!!

Postby rexkykwok » Wed Sep 28, 2011 4:58 am

Firstly thanks for the help on this issue previously.

Sorry for bumping this thread again but I am facing a similar issue currently and I think it would be easiest if I reopen this thread.

Instead of having all float page to have no page number, I would like to get rid of the number on "selected" float page only. It's a request from my examiners (on my thesis) as they would like to have page number on all the pages, except those which has long table or big figures which covers the whole page.

Many thanks again for any help in advance.

User avatar
justdeath
Posts: 69
Joined: Mon Sep 05, 2011 10:27 am

Re: Table overlapping with my page number!!

Postby justdeath » Thu Sep 29, 2011 6:24 pm

Ouch: viewtopic.php?f=47&t=15166

You should read the documentation ... or search the forum.

Nikolay

nan-tze
Posts: 1
Joined: Tue Oct 18, 2011 4:18 pm

Table overlapping with my page number!!

Postby nan-tze » Tue Oct 18, 2011 4:56 pm

Nikolay,

"Ouch", the thread you link to doesn't answer rexkykwok's question- the question was how to set custom pagestyles for a float page, and the thread you linked to explains how to set custom pagestyles for a particular text page, but setting \thispagestyle before/in a float just changes the pagestyle for the page in the text, and doesn't affect the float page. Like it says in the fancyhdr documentation, "There is no \thispagestyle for float pages and any change of the page style will at least also affect the page before the float page."

Using \iffloat with fancyhdr you can set the pagestyle for all floats, but neither the documentation nor any forum post that I can find gives an explanation of how to set float-page pagestyle for a single page, or change the iffloat arguments mid-document.

If it's not obvious, I'm trying to do exactly the same thing. rexkykwok, if you found a solution from another source, could you let me know?

Here's a MWE. I'm sorry it's long but the problem comes when the float gets bumped to a later point in the text, so the MWE only works if I put lots of blah's in. I tried setting \thispagestyle within the float (which the documentation correctly states will not work) and I tried
\renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.5pt}}, but it seems to only work in the preamble, whereas I want to be able to turn it off and on again.



\documentclass{report}

\usepackage{graphicx}
\usepackage{fancyhdr}

\fancypagestyle{plain}{\fancyhead{} % get rid of headers
\renewcommand{\headrulewidth}{0pt} % and the line
}

\setlength{\headheight}{15.2pt}
\pagestyle{fancy}

\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\renewcommand{\sectionmark}[1]{\markright{#1}{}}
\renewcommand{\headrulewidth}{0.5pt}
\renewcommand{\footrulewidth}{0pt}

\fancyhf{}
 
\cfoot{\thepage}
\rhead[]{\leftmark}
\lhead[\leftmark]{}


\begin{document}

\begin{chapter}{Chapter title}

blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 

\renewcommand{\headrulewidth}{\iffloatpage{0pt}{0.5pt}}

\newpage
\begin{figure}
\begin{center}
\thispagestyle{plain}
\rule[5cm]{10cm}{20cm}
\end{center}
\end{figure}
\newpage

blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah 
\end{chapter}
\end{document}


Return to “Page Layout”

Who is online

Users browsing this forum: No registered users and 4 guests