<< . .

. 19
( : 23)



. . >>




Figure XI.1: This is an inserted EPS graphic




causes “Caption Text” to appear in the caption, but “List Text” to appear in the
list of ¬gures. This is useful when using long, descriptive captions.
• The ¬gure environment can only be used in outer paragraph mode, preventing it
from being used inside any box (such as parbox or minipage).
• Figure environments inside the paragraphs are not processed until the end of the
paragraph. For example:

. . . . . . . . . text text text text text text
\begin{figure}
.........
\end{figure}
. . . . . . . . . text text text text text text

Figure placement
XI.1.2.

The figure environment has an optional argument which allows users to specify possible
¬gure locations. The optional argument can contain any combination of the letters: h, t,
b, p.


h Place the ¬gure in the text where the ¬gure command is located. This option cannot
be executed if there is not enough room remaining on the page.
t Place the ¬gure at the top of the page.
b Place the ¬gure at the bottom of a page.
p Place the ¬gure on a page containing only ¬‚oats.

If no optional arguments are given, the placement options default to [tbp].
When we input a ¬‚oat, LTEX will read that ¬‚oat and hold it until it can be placed
A

at a better location. Unprocessed ¬‚oats are those which are read by LTEX but have not
A

yet been placed on the page. Though the ¬‚oat-placing is done by LTEX, sometimes the
A

user has to invoke commands to process unprocessed ¬‚oats. Following commands will
do that job:
figure ENVIRONMENT 127
THE
XI.1.


This command places unprocessed ¬‚oats and starts a new page.
\clearpage
This command causes all unprocessed ¬‚oats to be processed. This is
\FloatBarrier
provided by the placeins package. It does not start a new page, unlike
\clearpage.

Since it is often desirable to keep ¬‚oats in the section in which they were issued, the
section option

\usepackage[section]{placeins}

rede¬nes the \section command, inserting a \FloatBarrier command before each sec-
tion. Note that this option is very strict. This option does not allow a ¬‚oat from the
previous section to appear at the bottom of the page, since that is after the start of a new
section.
The below option
\usepackage[below]{placeins}

is a less-restrictive version of the section option. It allows ¬‚oats to be placed after the
beginning of a new section, provided that some of the previous section appears on the
page.

The afterpage package provides the \afterpage command which
\afterpage/\clearpage
executes a command at the next naturally-ocurring page break.

Therefore, using \afterpage{\clearpage} causes all unprocessed ¬‚oats to be cleared
at the next page break. \afterpage{\clearpage} is especially useful when producing
small ¬‚oatpage ¬gures.

Customizing ¬‚oat placement
XI.1.3.

The following style parameters are used by LTEX to prevent awkward-looking pages
A

which contain too many ¬‚oats or badly-placed ¬‚oats.

Float placement counters
The maximum number of ¬‚oats allowed at the top of a text page (the
\topnumber
default is 2).
The maximum number of ¬‚oats allowed at the bottom of a text page
\bottomnumber
(the default is 1).
The maximum number of ¬‚oats allowed on any one text page (the de-
\totalnumber
fault is 3).

These counters prevent LTEX from placing too many ¬‚oats on a text page. These
A

counters do not affect ¬‚oat pages. Specifying a ! in the ¬‚oat placement options causes
LTEX to ignore these parameters. The values of these counters are set with the \setcounter
A

command. For example,
\setcounter{totalnumber}{2}

prevents more than two ¬‚oats from being placed on any text page.

Figure fractions
The commands given below control what fraction of a page can be covered by ¬‚oats
(where “fraction” refers to the height of the ¬‚oats divided by \textheight). The ¬rst
128 FLOATS
XI.


three commands pertain only to text pages, while the last command pertains only to ¬‚oat
pages. Specifying a ! in the ¬‚oat placement options causes LTEX to ignore the ¬rst three
A

parameters, but \floatpagefraction is always used. The value of these fractions are set
by \renewcommand. For example,
\renewcommand{\textfraction}{0.3}



The minimum fraction of a text page which must be occupied by
\textfraction
text. The default is 0.2, which prevents ¬‚oats from covering more
than 80% of a text page.
The maximum fraction of a text page which can be occupied by
\topfraction
¬‚oats at the top of the page. The default is 0.7, which prevents any
¬‚oat whose height is greater than 70% of \textheight from being
placed at the top of a page.
The maximum fraction of a text page which can be occupied by
\bottomfraction
¬‚oats at the bottom of the page. The default is 0.3, which prevents
any ¬‚oat whose height is greater than 40% of \textheight from
being placed at the bottom of a text page.
The minimum fraction of a ¬‚oat page that must be occupied by
\floatpagefraction
¬‚oats. Thus the fraction of blank space on a ¬‚oat page cannot be
more than 1-\floatpagefraction. The default is 0.5.

Using graphics in LTEX
A
XI.1.4.

This section shows how graphics can be handled in LTEX documents. While LTEX can
A A

import virtually any graphics format, Encapsulated PostScript (EPS) is the easiest graphics
format to import into LTEX. The ˜eps™ ¬les are inserted into the ¬le using command
A

\includegraphics¬le.eps

The \includegraphics command

\includegraphics[options]{¬lename}

The following options are available in \includegraphics command:
The width of the graphics (in any of the accepted TEX units).
width
The height of the graphics (in any of the accepted TEX units).
height
The totalheight of the graphics (in any of the accepted TEX units).
totalheight
Scale factor for the graphic. Specifying scale = 2 makes the graphic twice
scale
as large as its natural size.
Speci¬es the angle of rotation, in degrees, with a counter-clockwise (anti-
angle
clockwise) rotation being positive.



Graphics search path
By default, LTEX looks for graphics ¬les in any directory on the TEX search path. In addi-
A

tion to these directories, LTEX also looks in any directories speci¬ed in the \graphicspath
A

command. For example,
\graphicspath{{dir1/}{dir2/}}
figure ENVIRONMENT 129
THE
XI.1.




\includegraphics[width=1in]{tex.png}




\includegraphics[height=1.5in]{tex.png}




\includegraphics[scale=.25,angle=45]{tex.png}




\includegraphics[scale=.25,angle=90]{tex.png}




tells LTEX to look for graphics ¬les also in dir1/ and dir2/. For Macintosh, this becomes
A

\graphicspath{{dir1:}{dir2:}}


Graphics extensions
The \DeclareGraphicsExtensions command tells LTEX which extensions to try if a ¬le
A

with no extension is speci¬ed in the \includegraphics command. For convenience, a
default set of extensions is pre-de¬ned depending on which graphics driver is selected.
For example if dvips is used, the following graphics extensions (de¬ned in dvips.def) are
used by default
\DeclareGraphicsExtensions{.eps,.ps,.eps.gz,.ps.gz,.eps.Z}

With the above graphics extensions speci¬ed, \includegraphics¬le ¬rst looks for file.eps,
then file.ps, then ¬le file.eps.gz, etc. until a ¬le is found. This allows the graphics to
be speci¬ed with
\includegraphics{¬le}

instead of
130 FLOATS
XI.


\includegraphics{¬le.eps}


Rotating and scaling objects
XI.1.5.

In addition to the \includegraphics command, the graphicx package includes four other
commands which rotate and scale any LTEX object: text, EPS graphic, etc.
A

\scalebox{2}{\includegraphics{file.eps}}
\resizebox{4in}{!}{\includegraphics{file.eps}}
\rotatebox{45}{\includegraphics{file.eps}}

produces the same three graphics as
\includegraphics[scale=2]{file.eps}
\includegraphics[width=4in]{file.eps}
\includegraphics[angle=45]{file.eps}

For example, the following are produced with
EX
T
LA




\rotatebox{45}{\fbox{\LARGE{\LaTeX}}}




EX
T
LA
\rotatebox{180}{\fbox{\LARGE{\LaTeX}}}


However, the \includegraphics is preferred because it is faster and produces more
ef¬cient PostScript.

table ENVIRONMENT
THE
XI.2.

With the box elements already explained in the previous chapter, it would be possible to
produce all sorts of framed and unframed tables. However, LTEXoffers the user far more
A

convenient ways to build such complicated structures.

Constructing tables
XI.2.1.

The environments tabular and tabular* are the basic tools with which tables can be
constructed. The syntax for these environments is:
\begin{tabular}[pos]{cols} rows \end{tabular}
\begin{tabular*}{width}[pos]{cols} rows \end{tabular*}

Both the above environments actually create a minipage. The meaning of the above
arguments is as follows:
Vertical positioning arguments (see also the explanation of this argument for
pos
parboxes). It can take on the values:
table ENVIRONMENT 131
THE
XI.2.


The top line of the table is aligned with the baseline of the current
t
external line of text.
The bottom line of the table is aligned with the external baseline.
b

With no positioning argument given, the table is centered on the external base-
line.
This argument applies only to the tabular* environment and determines its
width
overall width. In this case, the cols argument must contain the @-expression
(see below) @{\extracolsep{\fill}} somewhere after the ¬rst entry. For the
other two environments, the total width is ¬xed by the textual content.
The column formatting argument. There must be an entry for every column,
cols
as well as possible extra entries for the left and right borders of the table or for
the inter-column spacings. The possible column formatting symbols are:

The column contents are left justi¬ed.
l
The column contents are centered.
c
The column contents are right justi¬ed.
r
The text in this column is set into lines of width wd
{wd}
and the top line is aligned with the other columns.
In fact, the text is set in a parbox with the command
\parbox[t]{wd}{column text}.
The column format contained in cols is reproduced
*{num}{cols}
num times, so that *{3}{|c|}| is the same as |c|c|c|.

The available formatting symbols for right and left borders and for the inter-column
spacing are:

Draws a vertical line.
|
Draws two vertical lines next to each other.
This entry is referred to as an @-expression, and inserts
@{text}
text in every line of the table between the two columns
where it appears.

removes the inter-column spacing that is automatically put between
@-expression
each pair of columns. If white space is needed between the inserted text and the next col-
umn, this must be explicitly included with \hspace{ } within the text of the @-expression.
If the inter-column spacing between two particular columns is to be something other than
the standard, this may be easily achieved by placing @{\hspace{wd}} between the ap-
propriate columns in the formatting argument. This replaces the standard inter-column
spacing with the width wd.
An \extracolsep{wd} within an @-expression will put extra spacing of amount wd
between all the following columns, until countermanded by another \extracolsep com-
mand. In contrast to the standard spacing, this additional spacing is not removed by later
@-expression. In the \tabular* environment, there must be a command @{\extracolsep\fill}
somewhere in the column format so that all the subsequent inter-column spacings can
stretch out to ¬ll the prede¬ned table width.
If the left or right borders of the table do not consist of a vertical line, a spacing equal
to half the normal inter-column spacing is added there. If this spacing is not required, it
may be suppressed by including an empty @-expression @{} at the beginning or end of the
column format.
132 FLOATS
XI.


Contain the actual entries in the table, each horizontal row being terminated
rows
with \\. These rows consist of a sequence of column entries separated from
each other by the & symbol. Thus each row in the table contains the same
number of column entries as in the column de¬nition cols. Some entries may be
empty. The individual column entries are treated by LTEXas though they were
A

enclosed in braces { }, so that any change in type style or size are restricted to
that one column.
This command may only appear before the ¬rst row or immediately after a row
\hline
termination \\. It draws a horizontal line the full width of the table below the
row that was just ended, or at the top of the table if it comes at the beginning.
Two \hline commands together draw two horizontal lines with a little space
between them.
\cline{n ’ m}
This command draws a horizontal line from the left side of column n to the
right side of column m. Like \hline, it may only be given just after a row
termination \\, and there may be more than one after another. The command
\cline{1-3} \cline{5-7} draws two horizontal lines from column 1 to 3 and
from column 5 to 7, below the row that was just ended. In each case, the full
column widths are underlined.
This command draws a vertical line with the height of the row at the location
\vline
where it appears. In this way, vertical lines that do not extend the whole height
of the table may be inserted with a column.
\multicolumn{num}{col}{text}
This command combines the following num columns into a single column with
their total width including inter-column spacing. The argument col contains

<< . .

. 19
( : 23)



. . >>