Graphics, Figures & TablesH placement adds awkward spaces

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

H placement adds awkward spaces

Post by daviddoria »

If I want to place a figure at the bottom of the second column using [H], if there is not enough space, the documentation says that it should be placed at the top of the next page. This is indeed what is happening, but it is also shifting the text before the figure to try to fill up the column, rather than leaving a "less than figure sized" hole at the bottom of the column. Is there a way to turn off that behavior?

Here is a demo:

Code: Select all

\documentclass[twocolumn,10pt]{article}

\usepackage{float}
\usepackage{lipsum} 
\usepackage{graphicx}

\begin{document}

Some text:
\lipsum[1-6]

\begin{figure}[H]
	\centering
	\fbox{\rule{0pt}{2in} \rule{0.9\linewidth}{0pt}}
	\caption{Test Caption}
\end{figure} 

\textbf{More text:}

\lipsum[1-5]

\end{document}
Thanks,
Dave

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

H placement adds awkward spaces

Post by localghost »

Use the \captionof command provided by the caption package instead.

Supplement:
The real cause is that the figure size is a little too big to fit on the first page. Since the used document class has \flushbottom as default setting, the remaining space is filled somehow. This results in the text spread over the page with elastic space between paragraphs. The solution is either to place the figure where else or adjust its size.


Best regards
Thorsten
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

H placement adds awkward spaces

Post by daviddoria »

Hm, 'figure' seems to work except for creating those weird spaces - what did you mean by "you cannot use it"?

If I use the following code instead of my figure environment, the same awkward spaces are inserted and, additionally, the figure is overlapping both columns rather than adhering to the \linewidth.

Code: Select all

\begin{minipage}{15cm}
	\centering
	\fbox{\rule{0pt}{2in} \rule{0.9\linewidth}{0pt}}
	\captionof{figure}[One figure]{One figure; photo courtesy ...}
	\label{medium}
\end{minipage}
Any thoughts?

Thanks,

Dave
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

H placement adds awkward spaces

Post by localghost »

I edited my last reply without seeing yours. See supplement in my modified post.
daviddoria wrote:If I use the following code instead of my figure environment, the same awkward spaces are inserted and, additionally, the figure is overlapping both columns rather than adhering to the \linewidth.
You shouldn't use a minipage environment with that width.
daviddoria
Posts: 60
Joined: Tue Sep 30, 2008 9:24 pm

H placement adds awkward spaces

Post by daviddoria »

I imagine this is a typical problem? In technical papers one often wants the image/plot to be near the text that discusses it. Is it appropriate to put the image above/before the text that discusses it? What I usually like to do is:

Code: Select all

We do something blah blah. The results are shown in Figure 1.

--------
|      |
|      |
--------
Figure 1: The Results.
If this situation occurs near the end of a page/column, latex moves it to the next page, which is seemingly the correct typesetting thing to do. However, it often makes it difficult to read. So I usually try to completely finalize the text and then shuffle things around until the images land in the right places. Is this is a common workflow? Or is this pretty goofy?

Thanks,

Dave
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

H placement adds awkward spaces

Post by localghost »

daviddoria wrote:[...] In technical papers one often wants the image/plot to be near the text that discusses it. Is it appropriate to put the image above/before the text that discusses it? [...]
In my opinion it is not so important whether the figure precedes or follows the referring text. I always pay attention to the figure placed as closed as possible.
daviddoria wrote:[...] So I usually try to completely finalize the text and then shuffle things around until the images land in the right places. Is this is a common workflow? Or is this pretty goofy? [...]
The final method to handle this is up to you. I personally want to avoid shifting things subsequently and try to write a completely rounded document from the beginning. I do not always succeed, but in most cases.
Post Reply