# Prevent figure captions from running into footers with full page figures

I'm trying to figure out how to prevent a figure caption from running into the footer of a page with a large caption.

\documentclass[review,authoryear,12pt]{elsarticle}

\usepackage{float}

\begin{document}

\begin{figure}[H]
\includegraphics[width = \linewidth, keepaspectratio]
{Figures_Figure_4}
\caption{(A) Cumulative density plot comparing differential expression among all genes to specified gene-list subsets.
(B) Comparison of AHC reads between genes that are down-regulated and up-regulated in \textit{miR-15/16\textsuperscript{$\Delta$/$\Delta$}} subsetted by location of miR-15/16 seed locations along each transcript.
(C) Heatmap of genes with a p value of less than or equal to 0.05 plotted along side a bar graph of AHC read depth at miR-15/16 seed matches for each gene they occur at.
(D) GSEA enrichment plot of KEGG Cell Cycle associated genes.
(E) Heatmap of KEGG Cell Cycle genes with miR-15/16 seed matches in their 3'UTRplotted along side a bar graph of AHC read depth at miR-15/16 seed matches for each gene they occur at.  (*) denotes genes with no prior evidence of miR-15/16 targeting by miRTarBase.}
\label{fig:global transcriptional changes}
\end{figure}
\end{document}

Is there a universal command or page height that can be used for this?

Notice how the caption runs into the page number at the bottom.

• Welcome to TeX SX! Normally, you won't have this problem if you don't use the [H] option. Replace it with [!htb] to let it float. – Bernard Nov 5 '17 at 19:01
• @Bernard not necessarily, if the figure is really big and the caption really long, this could happen even on a floatpage, so using a float won't help here, I guess. – Skillmon Nov 5 '17 at 19:08
• Yes, I have tried [!htb] but this still results in the same behavior, just with the figure being moved to the end of the document. Is there a good way to post the figure as a pdf or jpeg that others can use? My figure is 20cm wide by 25cm tall... – John Gagnon Nov 6 '17 at 18:44

with unknown page layout is possible to give only general advice: instead \begin{figure}[H] use \begin{figure}[htbp]. for example, in the following small document (called minimal working example: mwe)

\documentclass{article}
\usepackage{geometry}
\usepackage[demo]{graphicx}
\usepackage[font=footnotesize,labelfont=bf]{caption}

%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{figure}[htbp]
\centering
\includegraphics[height=\linewidth,
keepaspectratio]{Figures_Figure_4}
\caption{
(A) Cumulative density plot comparing differential expression among all genes to specified gene-list subsets.
(B) Comparison of AHC reads between genes that are down-regulated and up-regulated in \textit{miR-15/16\textsuperscript{$\Delta$/$\Delta$}} subsetted by location of miR-15/16 seed locations along each transcript.
(C) Heatmap of genes with a p value of less than or equal to 0.05 plotted along side a bar graph of AHC read depth at miR-15/16 seed matches for each gene they occur at.
(D) GSEA enrichment plot of KEGG Cell Cycle associated genes.
(E) Heatmap of KEGG Cell Cycle genes with miR-15/16 seed matches in their 3'UTRplotted along side a bar graph of AHC read depth at miR-15/16 seed matches for each gene they occur at.
(*) denotes genes with no prior evidence of miR-15/16 targeting by miRTarBase.}
\label{fig:global transcriptional changes}
\end{figure}
\end{document}

the images is on one page and caption not protrude to footer of page.

for further help you need first provide complete small document, which we can copy and test in our computers. in it define size size of your imege (width, height).

edit:

• don't use option [H]. it prevent float environment to flow and usually cause unexpected problem and very ugly document. use it as as desperate try of last resort to put figure on desired place
• you had to ensure, that image is not to height. for example, if caption is 1/2 text height tall, than the height of image can be only 1/2 text height. this you ensure with

\includegraphics[height=0.5\textheight, keepaspectratio]{<image file name>{
• i would reconsider if i liked to have such image in my document. it is ugly composed, unclear and has in caption information which (to my opinion of course) belong to document text
• i would rather split your image into five subimage and from them compose image, for example in two floats where i will to second float add \ContinuedFloat from caption package for correct figure numbering.

• remember, you cant put elephant into suitcase.

• Thanks, my figure is 20cm wide by 25cm tall if that helps...I'm not sure how to post the actual pdf in a way that would allow others to test it and am new to latex so I'm not sure how to create a dummy figure of those dimensions while still being able to use \includegraphics[height=\linewidth, keepaspectratio]{Figures_Figure_4} – John Gagnon Nov 6 '17 at 18:46
• @JohnGagnon, you should accommodate image size to available space. you not provide any information about your page layout. you can use my answer to design your mwe. make all necessary changes: change \documenclass{...}, definition of page layout (if it is different from mine) etc. instead real image use demo option or for example example image from package graphicx. – Zarko Nov 6 '17 at 19:06
• I have updated my question with the information you asked for. I'm not sure that demo is useful here as regardless of the length of the figure, if the caption is long enough, it still seems to run into the footer...Am I missing something? – John Gagnon Nov 6 '17 at 22:13
• yes, you missing the point: if you can't fit caption properly, than you need to reduce image size. for example with use \includegraphics[hegiht=0.5\textheight]{<image file name>} . latex is not magician and it don't know how to put elephant in suitcase :-(. – Zarko Nov 6 '17 at 22:19
• hmm...ok, I would have thought that there would be a way for latex to know the size of the figure and the size of the caption and adjust the size of the figure so that both the caption and figure fit on the page or split the caption when it runs into the footer...this doesn't seem like it would require magic – John Gagnon Nov 6 '17 at 22:37