<< . .

. 18
( : 23)



. . >>


In addition to the centering the text with positional argument [c] (the default), you
can position the text ¬‚ush left ([l]). LTEX also offers you an [s] speci¬er that will stretch
A

your text from the left margin to the right margin of the box provided it contains some
stretchable space. The inter-word space is also stretchable and shrinkable to a certain
extent.
With LTEX, the above box commands with arguments for specifying the dimensions
A

of the box allow you to make use of four special length parameters: \width, \height,

119
120 SEVERAL KINDS BOXES
X. OF


and \totalheight. They specify the natural size of the text, where \totalheight
\depth
is the sum of the \height and \depth.

A few words of advice

A few words of advice

A few words of advice



\framebox{A few words of advice}\\[6pt]
\framebox[5cm][s]{A few words of advice}\\[6pt]
\framebox{1.5\width}{A few words of advice}


As seen in the margin of the current line, boxes with zero width can be used to make text
stick out in the margin. This effect was produced by beginning the paragraph as follows:

\makebox{0mm}{r}{$\Leftrightarrow$}
As seen in the margin of the \dots


The appearance of frameboxes can be controlled by two style parameters.
width of the lines comprising the box produced with the command \fbox
\fboxruleThe
or \framebox. The default value in all standard classes is 0.4pt.
The space left between the edge of the box and its contents by \fbox or \framebox.
\fboxsep
The default value in all standard classes is 3pt.


Text in a box

Text in a box




\fbox{Text in a box}
\setlength\fboxrule{2pt}\setlength\fboxsep{2mm}
\fbox{Text in a box}

Another interesting possibility is to raise or lower boxes. This can be achieved by
the very powerful \raisebox command, which has two obligatory and two optional pa-
rameters, de¬ned as follows:
\raisebox{lift}{depth}{height}{contents}

An example of lowered and elevated text boxes is given below.

baseline upward baseline downward baseline



baseline \raisebox{1ex}{upward} baseline
\raisebox{-1ex}{downward} baseline
121
PARAGRAPH
X.2. BOXES


As with \makebox and \framebox the LTEX implementation of \raisebox offers you
A

the use of the lengths \height, \depth, \totalheight and \width in the ¬rst three argu-
ments. Thus, to pretend that a box extends only 90% of its actual height above the
baseline you could write:

\raisebox{0pt}{0.9\height}{text}

or to rotate a box around its lower left corner (instead of its reference point lying on the
baseline), you could raise it by its \depth ¬rst, e.g.:
g
in
g
in




th
th




g
d




in
Ba
d




th
Ba




x1 x2 x3 x4
d
Ba




$x_1$ \doturn{\fbox{Bad thing}}\\
$x_2$ \doturn{\raisebox{\depth}\\
{\fbox{Bad thing}}}\\
$x_3$ \doturn{\raisebox{-\height}\\
{\fbox{Bad thing}}} $x_4$


PARAGRAPH
X.2. BOXES

Paragraph boxes are constructed using the \parbox command or minipage environment.
The text material is typeset in paragraph mode inside a box of width width. The vertical
positioning of the box with respect to the text baseline is controlled by the one-letter
optional parameter pos ([c], [t], and [b]).
The usage for \parbox command is,
\parbox{pos}{width}{text}

whereas that of the minipage environment will be:
\begin{minipage}{pos}{width}
. . . here goes the text matter . . .
\end{minipage}

The center position is the default as shown by the next example. You can also observe
that LTEX might produce wide inter-word spaces if the measure is incredibly small.
A

This is the right-most parbox.
Note that the typeset text looks
This is the contents of the left-
CURRENT LINE sloppy because L TEX cannot
A
most parbox.
nicely balance the material in
these narrow columns.
The code for generating these three \parbox™s in a row is given below:

\parbox{.3\bs linewidth}
{This is the contents of the left-most parbox.} \hfill CURRENT LINE \hfill
\parbox{.3\bs linewidth}{This is the right-most parbox. Note that the typeset
text looks sloppy because \LaTeX{} cannot nicely balance the material in
these narrow columns.}
122 SEVERAL KINDS BOXES
X. OF


The minipage environment is very useful for the placement of material on the page.
In effect, it is a complete mini-version of a page and can contain its own footnotes, para-
graphs, and array, tabular and multicols (we will learn about these later) environments.
A simple example of minipage environment at work is given below. The baseline is indi-
cated with a small line.

\begin{minipage}{b}{.3\linewidth}
The minipage environment creates a vertical box like the parbox command.
The bottom line of this minipage is aligned with the
\end{minipage}\hrulefill
\begin{minipage}{c}{.3\linewidth}
middle of this narrow parbox, which in turn is
\end{minipage}\hrulefill
\begin{minipage}{t}{.3\linewidth}
the top line of the right hand minipage. It is recommended that the user
experiment with the positioning arguments to get used to their effects.
\end{minipage}

The minipage environment
creates a vertical box like
the parbox command. The
bottom line of this minipage is
middle of this narrow parbox,
aligned with the the top line of the right hand
which in turn is minipage. It is recommended
that the user experiment with
the positioning arguments to
get used to their effects.

PARAGRAPH
X.3. BOXES WITH SPECIFIC HEIGHT

In LTEX, the syntax of the \parbox and minipage has been extended to include two more
A

optional arguments.
\parbox{pos}{height}{inner pos}{width}{text}

is the usage for \parbox command, whereas that of the minipage environment will be:
\begin{minipage}{pos}{height}{inner pos}{width}
. . . here goes the text matter . . .
\end{minipage}

In both cases, height is a length specifying the height of the box; the parameters \height,
\width, \depth, and \totalheight may be employed within the emph argument in the
same way as in the width argument of \makebox and \framebox.
The optional argument inner pos states how the text is to be positioned internally,
something that is only meaningful if height has been given. Its possible values are:
To push the text to the top of the box.
t
To shove it to the bottom.
b
To center it vertically.
c
To stretch it to ¬ll up the whole box.
s
In the last case, we must specify the interline space we wish to have and the deviations
allowed from this value as in the example below.
Note the difference between the external positioning argument pos and the internal
one inner pos: the former states how the box is to be aligned with the surrounding text,
123
NESTED
X.4. BOXES


while the latter determines how the contents are placed within the box itself. See an
example below. We frame the minipages to make it more comprehensible.

This is a mini- In this fourth
page with a
box of same
height of 3 cm
In this minipage
with the text height, the text
of same height,
aligned at the
the text is verti-
top. is stretched to
In this third box
cally centered.
of same height, ¬ll in the entire
text is aligned at
the bottom. vertical space.


See the code that generated the above boxed material:

\begin{minipage}[b][3cm][t]{2cm}
This is a minipage with a height of 3˜cm with the text aligned
at the top.
\end{minipage}\hfill
\begin{minipage}[b][3cm][c]{2cm}
In this minipage of same height, the text is vertically centered.
\end{minipage}}\hfill
\begin{minipage}[b][3cm][b]{2cm}
In this third box of same height, text is aligned at the bottom.
\end{minipage}\hfill
\begin{minipage}{b}{3cm}{s}{2cm}
\baselineskip 10pt plus 2pt minus 2pt
In this fourth box of same height, the text is stretched to fill in the entire
vertical space.
\end{minipage}

In the last minipage environment the command \baselineskip gets the interline
space to be 10 points text allows it to be as low as 8 points or as high as 12 points.

NESTED
X.4. BOXES

The box commands described above may be nested to any desired level. Including an
LR box within a parbox or a minipage causes no obvious conceptual dif¬culties. The
opposite, a parbox within an LR box, is also possible, and is easy to visualize if one keeps
in mind that every box is a unit, treated by TEX as a single character of the corresponding
size.


A parbox inside an \fbox command has the effect that the entire parbox is
framed. The present structure was made with
{A parbox ...}}}
\fbox{\fbox{\parbox{.75\linewidth}

This is a parbox of width .75\linewidth inside an fbox inside a second fbox,
which thus produces the double framing effect.
124 SEVERAL KINDS BOXES
X. OF


RULE
X.5. BOXES

A rule box is basically a ¬lled-in black rectangle. The syntax for the general command is:
\rule{lift}{width}{height}

which produces a solid rectangle of width width and height height, raised above the
baseline by an amount lift. Thus
\rule{8mm}{3mm}

generates



and
\rule{3in}{.2pt}

generates
.


Without an optional argument lift, the rectangle is set on the baseline of the current
line of the text. The parameters lift, width and height are all lengths. If lift has a negative
value, the rectangle is set below the baseline.
It is also possible to have a rule box of zero width. This creates an invisible line with
the given height. Such a construction is called a strut and is used to force a horizontal
box to have a desired height or depth that is different from that of its contents.
TUTORIAL XI


FLOATS


figure ENVIRONMENT
THE
XI.1.

Figures are really problematical to present in a document because they never split between
pages. This leads to bad page breaks which in turn leave blank space at the bottom
of pages. For ¬ne-tuning that document, the typesetter has to adjust the page breaks
manually.
But LTEX provides ¬‚oating ¬gures which automatically move to suitable locations.
A

So the positioning of ¬gures is the duty of LTEX.
A


Creating ¬‚oating ¬gures
XI.1.1.

Floating ¬gures are created by putting commands in a figure environment. The con-
tents of the ¬gure environment always remains in one chunk, ¬‚oating to produce good
page breaks. The following commands put the graphic from figure.eps inside a ¬‚oating
¬gure:
\begin{figure}
\centering
\includegraphics{figure.eps}
\caption{This is an inserted EPS graphic}
\label{fig1}
\end{figure}


Features
• The optional \label command can be used with the \ref, and \pageref commands
to reference the caption. The \label command must be placed immediately after
the \caption
• If the ¬gure environment contains no \caption commands, it produces an unnum-
bered ¬‚oating ¬gure.
• If the ¬gure environment contains multiple \caption commands, it produces multi-
ple ¬gures which ¬‚oat together. This is useful in constructing side-by-side graphics
or complex arrangements.
• A list of ¬gures is generated by the \listoffigures command.
• By default, the caption text is used as the caption and also in the list of ¬gures.
The caption has an optional argument which speci¬es the list-of-¬gure entry. For
example,

\caption[List Text]{Caption Text}


125
126 FLOATS
XI.




¤¥ ¤¢ 
¦ £¡

¨  ¤ £ ©§


!¨ ¤
 



¤¨ ¤!¨ "
% $#
¡ $ £ ¤¤¨ 
)(



¤ ¤!¤¨ ¦' $ &
 $#(

<< . .

. 18
( : 23)



. . >>