1

I am looking to put a figure at the bottom of my document in a way that the caption is aligned with the bottom margin (i.e. no space between text and margin). Here's a MWE:

\documentclass[12pt]{report}
\usepackage[top=1.0in,hmargin=1.25in,height=9.0in,letterpaper,showframe]{geometry}
\usepackage[document]{ragged2e}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage[labelfont=bf,justification=RaggedRight,singlelinecheck=off,%
           labelsep=period]{caption}
\usepackage{duckuments}
\usepackage{blindtext}

\begin{document}
\RaggedRight    
\doublespace
\chapter{Title of chapter}
\blindtext  
\begin{figure}[b]
    \centering
    \includegraphics[height=3cm]{example-image-duck}
    \caption{This is a caption that is very long for the figure and it should be aligned with the bottom margin}
\end{figure}
\blindtext
\blindtext
\begin{figure}[t]
    \centering
    \includegraphics[height=3cm]{example-image-duck}
    \caption{This is the caption.}
\end{figure}    
\end{document}

The first figure is set at the bottom, but the caption doesn't align with the margin (there is a space between the text and the margin). The one aligned at the top, however, does align to the margin, so I didn't want to mess with the padding the figure environment has.

Edit:

Here's a screenshot, I drew the redline (on an editor) to indicate the spacing I am talking about.

CaptionSpacing

  • 1
    Please add an screenshot of your result to your question and mark there your issue. Then we can compare with the result on our computer ... – Mensch Feb 15 '19 at 21:38
  • You did specify double spacing. Seriously, setspace does horrible things to documents in order to emulate a typewriter. Admittedly removing setspace does not perfectly align the baseline of the caption with the bottom of the page, due to space added both by \caption and figure. – John Kormylo Feb 16 '19 at 3:48
2

You can use \flushbottom to get always the last line of a page aligned with the bottom of typing area.

Please see the code:

\documentclass[12pt]{report}

\usepackage[top=1.0in,hmargin=1.25in,height=9.0in,letterpaper,showframe]{geometry}
\usepackage[document]{ragged2e}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage[%
  labelfont=bf,
  justification=RaggedRight,
  singlelinecheck=off,%
  labelsep=period
]{caption}

\usepackage{duckuments}
\usepackage{blindtext}


\begin{document}
\flushbottom % <========================================================
\RaggedRight
\doublespace
\chapter{Title of chapter}
\blindtext
\begin{figure}[b]
  \centering
  \includegraphics[height=3cm]{example-image-duck}
  \caption{This is a caption that is very long for the figure and it should be aligned with the bottom margin}
\end{figure}
\blindtext
\blindtext
\begin{figure}[t]
    \centering
    \includegraphics[height=3cm]{example-image-duck}
    \caption{This is the caption.}
\end{figure}
\end{document}

and the result:

resulting pdf

  • That works. Would this affect the whole document? Or is there a way to turn it off/on on certain chapters/sections? Not sure I'll need that, but just in case. – ralk912 Feb 15 '19 at 22:13
0

It seems that when the text is stretched to fit the page, the bottom float is pulled up. So by letting \textfloatsep expand instead, one can prevent that from happening. All that is left is to remove the space below the baseline of the caption.

\documentclass[12pt]{report}
\usepackage[top=1.0in,hmargin=1.25in,height=9.0in,letterpaper,showframe]{geometry}
\usepackage[document]{ragged2e}
\usepackage{setspace}
\usepackage{graphicx}
\usepackage[labelfont=bf,justification=RaggedRight,singlelinecheck=off,%
           labelsep=period]{caption}
\usepackage{duckuments}
\usepackage{blindtext}

\addtolength{\textfloatsep}{0pt plus 0.01fil}

\begin{document}
\RaggedRight    
\doublespace
\chapter{Title of chapter}
\blindtext  
\begin{figure}[b]
    \hrule
    \centering
    \includegraphics[height=3cm]{example-image-duck}
    \caption{This is a caption that is very long for the figure and it should be aligned with the bottom margin}
    \vskip-\dp\strutbox%\hrule
\end{figure}
\blindtext
\blindtext
\begin{figure}[t]
    \centering
    \includegraphics[height=3cm]{example-image-duck}
    \caption{This is the caption.}
\end{figure}    
\end{document}

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.