1

I wrote a command to display figures one after another with no text or anything in between.

When two figures appear on the same page I'd like for the first figure to align to the top of the page and the 2nd figure to align to the bottom of the page.

I'm able to use @fptop to make the first float align to the top, but using @fpsep doesn't seem to do anything nor does @fpbot.

I've also tried \setlength\floatsep{36pt} with no change in results.

Here's a MWE.

\documentclass[twoside,openright,12pt]{report}
\def\usletterpaper{\usepackage[bottom=1in,hmarginratio=1:1,letterpaper]{geometry}}

%\usepackage{geometry}
\usepackage{graphicx}
\usepackage{forloop}
\usepackage{placeins}
%\usepackage{wrapfig}
%\usepackage{ragged2e}

%% Set floats to top of page
\makeatletter
\setlength{\@fptop}{0pt} % distance from top of page to top of first float
%\setlength{\@fpsep}{16pt} % separation between floats
\setlength{\@fpbot}{0pt} % distance from bottom of last float to bottom of page
\makeatother

\newcounter{lastSlideNumber}
\newcounter{slideNumber}
\newcounter{startingSlideNumber}

%%%InsertSlide for All Modules
\newcommand{\makeSlide}[1]{
\setlength\fboxsep{0pt}
\setlength\fboxrule{0.5pt}
\FloatBarrier \begin{figure}[!h]
\centering \fbox{\includegraphics[width=\textwidth]{slide#1.png}}
\caption{} \end{figure} \FloatBarrier 
}


%% Inserts slides from starting slide to last slide with no skips
\newcommand{\insertSlidesNoSkip}{
\forloop{slideNumber}{\value{startingSlideNumber}}{\value{slideNumber} < \value{lastSlideNumber}}{\makeSlide{\arabic{slideNumber}}}
}

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Chapter Blah} \label{chap:ChpBlah}

%% enter the slide number to start & end with
\setcounter{startingSlideNumber}{1}
\setcounter{lastSlideNumber}{5}

\insertSlidesNoSkip

\end{document}
  • Could you create a minimal example that replicates your current issue? We want to copy-and-paste-and-compile and see your problem. It'll just give a comfortable foundation to work from. – Werner Nov 28 '16 at 5:58
  • Change your figure options for float placement from [!h] to [tb]. – Zarko Nov 28 '16 at 19:00
  • Thanks Zarko. That does put two floats on the same page, but it also pushes the first float after the chapter heading to the next page. – PepPaddy Nov 28 '16 at 21:36
  • @PepPaddy: Look at this example. Using \FloatBarrier causes issues. Can you remove it? – Werner Nov 28 '16 at 22:08
  • @Werner: removing both \FloatBarrier results in a latex 'output loop---100 consecutive dead cycles' error in my full working tex file. – PepPaddy Nov 29 '16 at 20:23

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.