summaryrefslogtreecommitdiff
path: root/Master/texmf-doc/doc/english/FAQ-en/html/FAQ-figurehere.html
blob: e5b38703e2e45ee360cb37f3b9916c023cca20b6 (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 figurehere</title>
</head><body>
<h3>Figure (or table) <em>exactly</em> where I want it</h3>
<p/>This is of course a contradiction: <code>figure</code> and
<code>table</code> are <em>designed</em> to float, and will always have
the potential to appear away from where you asked for them.  Therefore
you have to find a means of getting the caption and other effects
without allowing the figure or table to float.
<p/>The most straightforward way is to use the <i>float</i> package; it
gives you a <code>[H]</code> float placement option that prevents
floating:
<blockquote>
<pre>
\begin{figure}[H]
  \centering
  \includegraphics{foo}
  \caption{caption text}
  \label{fig:nonfloat}
\end{figure}
</pre>
</blockquote><p>
As the example shows, these <code>[H]</code> figures (and correspondingly,
tables) offer all you need to cross-reference as well as typeset.
<p/>However, you don&rsquo;t actually <em>have</em> to use <i>float</i> since
it is, in fact, doing rather little for you.  You can place your
figure as you please, with a sequence like
<blockquote>
<pre>
\begin{center}
  \includegraphics{foo}
  \captionof{figure}{caption text}
  \label{fig:nonfloat}
\end{center}
</pre>
</blockquote><p>
which relies on the <code>\</code><code>captionof</code> command to place a caption in
ordinary running text.  That command may be had from the extremely
simple-minded package <i>capt-of</i> or from the highly
sophisticated <i>caption</i> package.
<p/>Using either method, you have to deal with the possibility of the
figure or table being too large for the page.  (Floating objects will
float away in this circumstance; &ldquo;doing it by hand&rdquo;, like this, you
take upon yourself the responsibility for avoiding 
&lsquo;<i>Overfull <code>\</code><code>vbox</code></i>&rsquo; errors.
<p/>A further problem is the possibility that such &ldquo;fixed floats&rdquo; will
overtake &ldquo;real floats&rdquo;, so that the numbers of figures will be out
of order: figure 6 could be on page 12, while figure 5 had floated to
page 13.  It&rsquo;s best, therefore, either to stay with floating figures
throughout a document, or to use fixed figures throughout.
<dl>
<dt><tt><i>capt-of.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/misc/capt-of.sty">macros/latex/contrib/misc/capt-of.sty</a>
<dt><tt><i>caption.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/caption.zip">macros/latex/contrib/caption</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/caption.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/caption/">browse</a>)
<dt><tt><i>float.sty</i></tt><dd><a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/float.zip">macros/latex/contrib/float</a> (<a href="ftp://cam.ctan.org/tex-archive/macros/latex/contrib/float.tar.gz">gzipped tar</a>, <a href="http://www.tex.ac.uk/tex-archive/macros/latex/contrib/float/">browse</a>)
</dl>
<p/><p/><p/><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=figurehere">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=figurehere</a>
</body>