28.03.2013 Views

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

Guide to LaTeX (4th Edition) (Tools and Techniques

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4.7. Boxes 93<br />

contents as a unit with the neighboring text or boxes. An example of this<br />

is given in Exercise 4.10.<br />

Finally, vertical boxes such as \parbox comm<strong>and</strong>s <strong>and</strong> minipage environments<br />

may be saved as the text in an \sbox or \savebox comm<strong>and</strong>,<br />

<strong>to</strong> be recalled later with \usebox, as described in Section 4.7.1.<br />

4.7.8 Box style parameters<br />

There are two style parameters for the frame boxes \fbox <strong>and</strong> \framebox that<br />

! may be reset by the user:<br />

\fboxrule determines the thickness of the frame lines,<br />

\fboxsep sets the amount of spacing between the frame <strong>and</strong> enclosed text.<br />

New values are assigned <strong>to</strong> these length parameters in the usual L AT E X manner with<br />

the comm<strong>and</strong> \setlength: the line thickness for all the following \framebox<br />

<strong>and</strong> \fbox comm<strong>and</strong>s is set <strong>to</strong> 0.5 mm with \setlength{\fboxrule}{0.5mm}.<br />

The scope of these settings also obeys the usual rule: if they are found<br />

in the preamble then they apply <strong>to</strong> the entire document; if they are within an<br />

environment then they are valid only until the end of that environment.<br />

These parameters do not influence the \framebox comm<strong>and</strong> that is employed<br />

within the picture environment (Section 13.1.4) <strong>and</strong> which has different syntax<br />

<strong>and</strong> functionality from those of the normal \framebox comm<strong>and</strong>.<br />

Exercise 4.10: How can the following nested structure be generated? (Note: font<br />

size is \footnotesize)<br />

The first line of this 3.5 cm<br />

wide minipage or parbox is<br />

aligned with the first line<br />

of the neighboring minipage<br />

or parbox.<br />

This 4.5 cm wide minipage or parbox<br />

is positioned so that its <strong>to</strong>p<br />

line is at the same level as that of<br />

the box on the left, while its bot<strong>to</strong>m<br />

line is even with that of the<br />

box on the right. The naïve notion<br />

that this arrangement may be<br />

achieved with the positioning arguments<br />

set <strong>to</strong> t, t, <strong>and</strong> b is incorrect.<br />

Why? What would this<br />

selection really produce?<br />

The true solution<br />

involves the nesting<br />

of two of the three<br />

structures in an enclosing<br />

minipage,<br />

which is then separately<br />

aligned with the<br />

third one.<br />

Note: there are two variants for the solution, depending on whether the left <strong>and</strong><br />

middle structures are first enclosed in a minipage, or the middle <strong>and</strong> right ones.<br />

Try <strong>to</strong> work out both solutions. Incidentally, the third minipage is 3 cm wide.<br />

Note: the problems of correctly aligning two side-by-side boxes as a pair on a<br />

line of text (Section 4.7.4) arises here once more. It will be necessary <strong>to</strong> add a<br />

dummy line <strong>to</strong> get the vertical alignment correct.<br />

Exercise 4.11: Produce the framed structure shown below <strong>and</strong> s<strong>to</strong>re it with<br />

the comm<strong>and</strong> \sbox{\warning}{structure}. You will first have <strong>to</strong> create a<br />

box named \warning with the \newsavebox{\warning} comm<strong>and</strong>. Print this<br />

warning at various places in your exercise file by giving \usebox{\warning}.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!