computersci.org
Print     Recent Changes     Search    
Home




LaTeX Reference Manual


Text Boxes

« Terminal Input and Output | Table of Contents | Typefaces »


\fbox

Command:

    \fbox{text}

The \fbox command is exactly the same as the \mbox command, except that it puts a frame around the outside of the box that it creates.

\framebox

Command:

    \framebox[width][position]{text}

The \framebox command is exactly the same as the \makebox command, except that it puts a frame around the outside of the box that it creates.

The framebox command produces a rule of thickness \fboxrule, and leaves a space \fboxsep between the rule and the contents of the box.

lrbox Environment

   \begin{lrbox}{cmd} 
         text 
   \end{lrbox}

This is the environment form of \sbox. The text inside the environment is saved in the box cmd, which must have been declared with \newsavebox.

\makebox

Command:

    \makebox[width][position]{text}

The \makebox command creates a box just wide enough to contain the text specified. The width of the box is specified by the optional width argument. The position of the text within the box is determined by the optional position argument.

c - centered (default)
l - flushleft
r - flushright
s - stretch from left to right margin. The text must contain stretchable space for this to work.

\mbox

Command:

    \mbox{text}

The \mbox command creates a box just wide enough to hold the text created by its argument. Use this command to prevent text from being split across lines.

\newsavebox

Command:

    \newsavebox{cmd}

Declares cmd, which must be a command name that is not already defined, to be a bin for saving boxes.

\parbox

Command:

    parbox[position][height][inner-pos]{width}{text}

A parbox is a box whose contents are created in paragraph mode. The \parbox has two mandatory arguments:

width
specifies the width of the parbox, and
text
the text that goes inside the parbox.

LaTeX will position a parbox so its center lines up with the center of the text line. The optional position argument allows you to line up either the top or bottom line in the parbox (default is top).

If the height argument is not given, the box will have the natural height of the text.

The inner-pos argument controls the placement of the text inside the box. If it is not specified, position is used.

t
text is placed at the top of the box.
c
text is centered in the box.
b
text is placed at the bottom of the box.
s
stretch vertically. The text must contain vertically stretchable space for this to work.

A \parbox command is used for a parbox containing a small piece of text, with nothing fancy inside. In particular, you shouldn’t use any of the paragraph-making environments inside a \parbox argument. For larger pieces of text, including ones containing a paragraph-making environment, you should use a minipage environment.

\raisebox

Command:

    \raisebox{distance}[extend-above][extend-below]{text}

The \raisebox command is used to raise or lower text. The first mandatory argument specifies how high the text is to be raised (or lowered if it is a negative amount). The text itself is processed in LR mode.

Sometimes it’s useful to make LaTeX think something has a different size than it really does - or a different size than LaTeX would normally think it has. The \raisebox command lets you tell LaTeX how tall it is.

The first optional argument, extend-above, makes LaTeX think that the text extends above the line by the amount specified. The second optional argument, extend-below, makes LaTeX think that the text extends below the line by the amount specified.

\savebox

Command:

    \savebox{cmd}[width][pos]{text}

This command typeset text in a box just as for \makebox. However, instead of printing the resulting box, it saves it in bin cmd, which must have been declared with \newsavebox.

\sbox

Command:

    \sbox{text}

This commands typeset text in a box just as for \mbox. However, instead of printing the resulting box, it saves it in bin cmd, which must have been declared with \newsavebox.

\usebox

Command:

    \usebox{cmd}

Prints the box most recently saved in bin cmd by a \savebox command.



« Terminal Input and Output | Table of Contents | Typefaces »

Page last modified on February 24, 2009, at 12:23 PM