Page LayoutWeird space when inserting figure

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
matteot
Posts: 2
Joined: Thu Sep 30, 2010 5:01 pm

Weird space when inserting figure

Post by matteot »

Hi all,
I'm building e LaTeX document on OSX (MacTex 2010) and I have a weird problem of space insertion when placing a large figure. Basically, wherever I insert a figure that latex needs to place somewhere else on the compiled text, I get a wide space between the two paragraphs preceding and ending the figure.

Here's a working example (hope got it right- it compiles for me):

Code: Select all

\documentclass[english,11pt,twoside,openright]{book}
\usepackage[T1]{fontenc}
\usepackage[latin9]{inputenc}
\usepackage{graphicx}
\usepackage[english,italian]{babel}
\usepackage{lipsum}
\begin{document}

\chapter{General introduction}

\section{Life at low temperatures}
\lipsum[1-3]
\begin{center}
\begin{figure}
\includegraphics[width=0.8\textwidth]{image}\caption{\lipsum[1]}
\end{figure}
\end{center}
\lipsum[4-6]

\end{document}
here's the result:

http://dl.dropbox.com/u/6835227/prova.pdf

thank you for helping

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Weird space when inserting figure

Post by gmedina »

Hi,

replace

Code: Select all

\begin{center}
\begin{figure}
\includegraphics[width=0.8\textwidth]{image}\caption{\lipsum[1]}
\end{figure}
\end{center}
with

Code: Select all

\begin{figure}[!ht]
  \centering
  \includegraphics[width=0.8\textwidth]{image}
  \caption{\lipsum[1]}
\end{figure}
Delete the [!ht] part if you want you figure to float freely.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
matteot
Posts: 2
Joined: Thu Sep 30, 2010 5:01 pm

Re: Weird space when inserting figure

Post by matteot »

Thank you very much! I would never have figured it out. Can you explain me what's wrong with the center environment?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Weird space when inserting figure

Post by localghost »

matteot wrote:[…] Can you explain me what's wrong with the center environment?
TeX Frequently Asked Questions — Extra vertical space in floats


Best regards and welcome to the board
Thorsten
Post Reply