summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/FAQ-en/html/FAQ-vertspacefloat.html
blob: eb56d0f6f60fef6b024165c0d4e0187f600ccd2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<head>
<title>UK TeX FAQ -- question label vertspacefloat</title>
</head><body>
<h3>Extra vertical space in floats</h3>
<p/>A common complaint is that extra vertical space has crept into
<code>figure</code> or <code>table</code> floating environments.
More common still are users who post code that introduces this extra
space, and <em>haven&#8217;t noticed the problem</em>!
<p/>The trouble arises from the fact that the <code>center</code>
environment (and its siblings <code>flushleft</code> and
<code>flushright</code>) are actually based on LaTeX&#8217;s
list-handling code; and lists always separate themselves from the
material around them.  Meanwhile, there are parameters provided to
adjust the spacing between floating environments and their
surroundings; so if we have:
<blockquote>
<pre>
\begin{figure}
 \begin{center}
   \includegraphics{...}
   \caption{...}
 \end{center}
\end{figure}
</pre>
</blockquote><p>
or worse still:
<blockquote>
<pre>
\begin{figure}
 \begin{center}
   \includegraphics{...}
 \end{center}
 \caption{...}
\end{figure}
</pre>
</blockquote><p>
unwarranted vertical space is going to appear.
<p/>The solution is to let the float and the objects in it position
themselves, and to use &#8220;generic&#8221; layout commands rather than their
list-based encapsulations.
<blockquote>
<pre>
\begin{figure}
  \centering
  \includegraphics{...}
  \caption{...}
\end{figure}
</pre>
</blockquote><p>
(which even involves less typing).
<p/>This alternative code will work with any LaTeX package.  It will
not work with obsolete (pre-LaTeX2e) packages such as
<i>psfig</i> or <i>epsf</i> &#8212; see 
<a href="FAQ-impgraph.html">graphics inclusion</a> for discussion of the
genesis of <code>\</code><code>includegraphics</code>.
<p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=vertspacefloat">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=vertspacefloat</a>
</body>