I have to embed a huge figure in a page where at the bottom there should be some text. However, the figure simply occupy a new page — how to prevent this?
[Tex/LaTex] How to prevent a large figure occupying entire page
floatsgraphics
Related Solutions
May be that what the OP is looking for is simply a version of, say, the center
environment which prohibits page breaks above and below itself; this is easy to accomplish. For example, the following MWE defines an environment named centernopagebreaks
that locally redefines the appropriate parameters and then invokes the center
environment.
Note: While testing this example, I’ve noticed that the \captionof
command inserts a legal breakpoint between the figure and its caption. I’ve made up for this by wrapping everything up in a minipage
environment, but isn’t this a bug?
\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage{caption}
\usepackage{mwe}
\makeatletter
\newenvironment*{centernopagebreaks}{%
\@beginparpenalty \@M
\@endparpenalty \@M
\@itempenalty \@M
\center
}{\endcenter}
\makeatother
\begin{document}
\lipsum[2]
\begin{centernopagebreaks}
\begin{minipage}[b]{\textwidth}
\centering
\includegraphics{image}
\par\special{comment: Why no penalty below write and rule?}
\captionof{figure}{An image}
\label{fig;img}
\end{minipage}
\end{centernopagebreaks}
\lipsum[1]
% % If you can read the logging info provided by (core) TeX,
% % uncomment the following lines to check the penalties.
% \showboxbreadth = 1000
% \showboxdepth = 5
% \showlists
\end{document}
I don’t think that it is meaningful to show the output; rather, you should uncomment the diagnostic commands and check that the penalties reported in the transcript file are correct.
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 preventfloat
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
fromcaption
package for correct figure numbering.remember, you cant put elephant into suitcase.
Best Answer
This is one of the possibilities suggested as use by the
afterpage
package:The use of the
H
float specifier (supported by thefloat
package) is crucial here and suppresses the floating. Of course, using\captionof
(from thecapt-of
package) is also a possibility.The default for very large floats is to sit on a page of its own, the above circumvents that. The default is controlled by macros like
\topfraction
and\bottomfraction
. See thelayouts
package documentation for more on this.