Help On LaTeX Spaces and Boxes

# Hypertext Help with LaTeX
Spaces and Boxes

## "Visible" Spaces

You can generate a "visible" space, generally indicated as a small, squat "u," and useful in didactic material by using the `\verb` command or the `verbatim` environment.

## Non-breaking Spaces

To generate a space where you do not want to allow a break for a new line use a `~`. For example,

      ... in Table~2 and Fig.~3 ...

## Controlling Space in Text

The ends of words and sentences are marked in the input by one or more spaces. LaTeX treats multiple spaces as if they were a single space. An end of line is also equivalent to a space; however, you can end a line without a space by using a `%` (anything following the `%` is considered to be a comment). LaTeX generally ignores spaces at the beginning of lines.

Paragraphs are delineated by a blank line -- one which does not contain even comments (anything following a `%` until the end of a line is a comment). See also the `\par` command.

LaTeX leaves extra space after punctuation, such as the period which ends a sentence, but, it uses a very simple rule (periods end sentences unless they follow a capital letter) so sometimes it needs a little help in determining when this is required. (However, see `\frenchspacing`.) Use

- `\<space>` to create an ordinary interword space
- `\@` before punctuation to force an "end of sentence" space

It is sometimes necessary to add a little additional space, such as between consecutive single and double quotation marks. The `\,` command can be used for this purpose.

Also see

- Dashes
- Ellipses
- Quotation Marks
- Spacing in Math Mode

## Spaces after Commands

Most LaTeX commands consist of a `\` followed by a string of letters. The end of such commands is indicated by a nonletter, i.e., a number, a punctuation mark, a space, or the end of the line. If the command produces text and you want a space to follow this text, you cannot just leave a space after the command; that space is treated as the end-of-command signal and several spaces are equivalent to one in LaTeX. To generate a space after a text-producing command you can use `\<space>`.

For example

       I wrote this on \today   .

generates "I wrote this on Jul 7, 1995." Note that the spaces between `\today` and the period in the input do not generate any space in the output. On the other hand,

      \today\ was a good day.

or

      \today  \  was a good day.

will both produce "Jul 7, 1995 was a good day." The `\<space>` here is necessary to produce space between the date and "was."

An alternatative is to use braces to terminate the command. For example, `\today{} was ...` is equivalent to the above.

### Invisible commands

Some commands do not produce any output text. LaTeX treats these as words of zero length and may try to leave spaces both before and after this "word" which will generally produce an undesirable gap. This can be avoided by attaching these commands directly to the preceding word, i.e., leaving no spaces.

## Some commands which create or manipulate space

- \addvspace
- \bigskip
- \dotfill
- \hfill
- \hrulefill
- \hspace
- \medskip
- \rule
- \smallskip
- \vfill
- \vspace

See also

- spacing in math mode

## Boxes

A box is an object which TeX treats as a single character; it is therefore not broken across lines or pages.

The following commands create or manipulate boxes

- \fbox
- \framebox
- \makebox
- \mbox
- \newsavebox
- \parbox
- \raisebox
- \savebox
- \sbox
- \usebox

Back to the Table of Contents