0

I have placed the following code in the preamble to make sure that images are placed on the top.

\makeatletter
\setlength{\@fptop}{0pt} 
\setlength{\@fpbot}{0pt plus 1fil}
\makeatother

However this messes up my figures which use the sidewaysfigure environment. They are all now cropped and only part of the image is visible.

I therefore want the preamble above to apply to most figures but a select few to use the default settings. How do I reset \setlength{\@fptop}{0pt} locally for a given float?

EDIT 20/02/19 MWE:

\documentclass[a4paper,openany]{book}

\usepackage{graphicx} % for figures 
\usepackage{subfig} %for subfigures

\makeatletter
\setlength{\@fptop}{0pt} 
\setlength{\@fpbot}{0pt plus 1fil}
\makeatother

\usepackage[counterclockwise]{rotating}

\begin{document}

\begin{figure}[t!]
\centering
\includegraphics[width=0.99\textwidth]{image0.pdf}
\caption{...}
\label{fig:img0}
\end{figure}

\begin{sidewaysfigure}
\centering
\includegraphics[width=1\textwidth]{image1.pdf}
\caption[...]{...}
\label{fig:img1}
\end{sidewaysfigure}

\end{document}
  • 2
    Please share the Minimum Working Example (MWE) to show what has been done so far. – subham soni Feb 20 at 3:15
  • Rotating uses \newskip\rotFPtop \rotFPtop=\@fptop. Do you redefine \@fptop before of after loading rotating? Alternatively, just reset \rotFPtop. – John Kormylo Feb 20 at 4:43
  • \@fptop does not apply to a particular float it applies to a particular float page so will be affect any float that finally is positioned on that page. It has no affect on floats that are positioned by h, t or b. So you can not really talk of applying it to a specific float. However you can with care change it locally within the document to cause different float pages to have different layout. – David Carlisle Feb 20 at 8:30
  • @subhamsoni I've added the MWE. The problem I was having is that some figures left a lot of white space, or did not appear on the pages I wanted. In one instance, latex added lots of text, and then added two or three figures, one to each page in the center, on pages after all the text. To fix this, I added the specifiers, [t!] to some figures and used the \setlength{\@fptop}{0pt} syntax to remove the whitespace. But this has had the undesired affect where the figures in the sideways environment are cropped/ shifted and not in the middle of the page. – slew123 Feb 20 at 18:06
  • What if you remove \makeatletter \setlength{\@fptop}{0pt} \setlength{\@fpbot}{0pt plus 1fil} \makeatother ? – Hafid Boukhoulda Feb 20 at 20:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.