File: FAQ-ouparmd.html

package info (click to toggle)
tetex-base 3.0.dfsg.3-5
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 239,540 kB
  • ctags: 10,610
  • sloc: xml: 103,461; perl: 9,398; ruby: 2,850; python: 1,551; php: 1,067; sh: 981; lisp: 494; makefile: 371; awk: 88
file content (74 lines) | stat: -rw-r--r-- 2,018 bytes parent folder | download | duplicates (2)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<head>
<title>UK TeX FAQ -- question label ouparmd</title>
</head><body>
<h3>Not in outer par mode</h3>
<p>The error:
<blockquote>
<pre>
! LaTeX Error: Not in outer par mode.
</pre>
</blockquote>
comes when some "main" document feature is shut up somewhere it
doesn't like.
<p>The commonest occurrence is when the user wants a figure somewhere
inside a table:
<blockquote>
<pre>
\begin{tabular}{|l|}
  \hline
  \begin{figure}
  \includegraphics{foo}
  \end{figure}
  \hline
\end{tabular}
</pre>
</blockquote>
a construction that was supposed to put a frame around the diagram,
but doesn't work, any more than:
<blockquote>
<pre>
\framebox{\begin{figure}
  \includegraphics{foo}
  \end{figure}%
}
</pre>
</blockquote>
The problem is, that the <code>tabular</code> environment, and the
<code>\</code><code>framebox</code> command restrain the <code>figure</code> environment
from its natural m&eacute;tier, which is to float around the document.
<p>The solution is simply not to use the <code>figure</code> environment
here:
<blockquote>
<pre>
\begin{tabular}{|l|}
  \hline
  \includegraphics{foo}
  \hline
\end{tabular}
</pre>
</blockquote>
What was the float for? - as written in the first two examples, it
serves no useful purpose; but perhaps you actually wanted a diagram
and its caption framed, in a float.
<p>It's simple to achieve this - just reverse the order of the
environments (or of the <code>figure</code> environment and the
command):
<blockquote>
<pre>
\begin{figure}
  \begin{tabular}{|l|}
    \hline
    \includegraphics{foo}
    \caption{A foo}
    \hline
  \end{tabular}
\end{figure}
</pre>
</blockquote>
The same goes for <code>table</code> environments (or any other sort
of float you've defined for yourself) inside tabulars or box commands;
you <em>must</em> get the float environment out from inside, one way or
another.
<p>
<p><p><p><p>This question on the Web: <a href="http://www.tex.ac.uk/cgi-bin/texfaq2html?label=ouparmd">http://www.tex.ac.uk/cgi-bin/texfaq2html?label=ouparmd</a>
</body>