%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Contents: Typesetting Part of LaTeX2e Introduction
% $Id: typeset.tex,v 1.4 1998/09/29 08:05:09 oetiker Exp oetiker $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\chapter{Typesetting Text}

\begin{intro}
  After reading the previous chapter, you should know about the basic
  stuff of which a \LaTeXe{} document is made. In this chapter I
  will fill in the remaining structure you will need to know in order
  to produce real world material.
\end{intro}

\section{The Structure of Text and Language}

The main point of writing a text (some modern DAAC\footnote{Different
  At All Cost, a translation of the Swiss German UVA (Um's Verrecken
  Anders).} literature excluded), is to convey ideas, information, or
knowledge to the reader.  The reader will understand the text better
if these ideas are well-structured, and will see and feel this
structure much better if the typographical form reflects the logical
and semantical structure of the content.

\LaTeX{} is different from other typesetting systems in that you just
have to tell it the logical and semantical structure of a text.  It
then derives the typographical form of the text according to the
``rules'' given in the document class file and in various style files.

The most important text unit in \LaTeX{} (and in typography) is the
\wi{paragraph}.  We call it ``text unit'' because a paragraph is the
typographical form which should reflect one coherent thought, or one
idea.  You will learn in the following sections, how you can force
linebreaks with e.g.{} \texttt{\bs\bs} and paragraph breaks with e.g.{} 
leaving an empty line in the source code.  Therefore, if a new thought
begins, a new paragraph should begin, and if not, only linebreaks
should be used.  If in doubt about paragraph breaks, think about your
text as a conveyor of ideas and thoughts.  If you have a paragraph
break, but the old though continues, it should be removed.  If some
totally new line of thought occurs in the same paragraph, then it
should be broken.

Most people completely underestimate the importance of well-placed
paragraph breaks.  Many people do not even know what the meaning of
paragraph break is, or, especially in \LaTeX, introduce paragraph
breaks without knowing it.  The latter mistake is especially easy to
make if equations are used in the text.  Look at the following
examples, and figure out why sometimes empty lines (paragraph breaks)
are used before and after the equation, and sometimes not.  (If you
don't yet understand all commands well enough to understand these
examples, please read this and the following chapter, and then read
this section again.)

\begin{code}
\begin{verbatim}
% Example 1
\ldots when Einstein introduced his formula 
\begin{equation} 
  e = m \cdot c^2 \; , 
\end{equation} 
which is at the same time the most widely known 
and the least well understood physical formula. 


% Example 2
\ldots from which follows Kirchoff's current law:
\begin{equation} 
  \sum_{k=1}{n} I_k = 0 \; .
\end{equation} 

Kirchhoff's voltage law can be derived \ldots


% Example 3
\ldots which has several advantages.

\begin{equation} 
  I_D = I_F - I_R
\end{equation} 
is the core of a very different transistor model. \ldots
\end{verbatim}
\end{code} 

The next smaller text unit is a sentence.  In English texts, there is
a larger space after a period which ends a sentence than after one
which ends an abbreviation.  \LaTeX{} tries to figure out which one
you wanted to have.  If \LaTeX{} gets it wrong, you must tell it what
you want.  This is explained later in this chapter.

The structuring of text even extends to parts of sentences.  Most
languages have very complicated punctuation rules, but in many
languages (including German and English), you will get almost every
comma right if you remember what it represents: a short stop in the
flow of language.  If you are not sure about where to put a comma,
read the sentence aloud, and take a short breath at every comma.  If
this feels awkward at some place, delete that comma, if you feel the
urge to breath (or make a short stop) at some other place, insert a
comma.

Finally, the paragraphs of a text should also be structured logically
at a higher level, by putting them into chapters, sections,
subsections, and so on.  However, the typographical effect of writing
e.g.{} \verb|\section{The| \texttt{Structure of Text and Language}\verb|}| is
so obvious that it is almost self-evident how these high-level
structures should be used.

\section{Linebreaking and Pagebreaking}
 
\subsection{Justified Paragraphs}

Often books are typeset with each line having the same length.
\LaTeX{} inserts the necessary \wi{linebreak}s and spaces between words
by optimizing the contents of a whole paragraph. If necessary, it
also hyphenates words that would not fit comfortably on a line.
How the paragraphs are typeset depends on the document class.
Normally the first line of a paragraph is indented, and there is no
additional space between two paragraphs. Refer to section~\ref{parsp}
for more information.

In special cases it might be necessary to order \LaTeX{} to break a
line: 
\begin{command}
\ci{\bs} or \ci{newline} 
\end{command}
\noindent starts a new line without starting a new paragraph. 

\begin{command}
\ci{\bs*}
\end{command}
\noindent additionally prohibits a pagebreak after the forced
linebreak. 

\begin{command}
\ci{newpage}
\end{command}
\noindent starts a new page. 

\begin{command}
\ci{linebreak}\verb|[|\emph{n}\verb|]|,
\ci{nolinebreak}\verb|[|\emph{n}\verb|]|, 
\ci{pagebreak}\verb|[|\emph{n}\verb|]| and
\ci{nopagebreak}\verb|[|\emph{n}\verb|]|
\end{command}
\noindent do what their names say. They enable the author to influence their
actions with the optional argument \emph{n}. It can be set to a number
between zero to four. By setting \emph{n} to a value below 4 you leave
\LaTeX{} the option of ignoring your command if the result would look very
bad. Do not confuse these ``break'' commands with the ``new'' commands. Even
when you give a ``break'' command, \LaTeX{} still tries to even out the
right border of the page and the total length of the page as described in
the next section. If you really want to start a ``new line'', then use the
corresponding command. Guess its name!

\LaTeX{} always tries to produce the best linebreaks possible. If it
cannot find a way to break the lines in a manner which meets its high
standards, it lets one line stick out on the right of the paragraph.
\LaTeX{} then complains (``\wi{overfull hbox}'') while processing the
input file. This happens most often when \LaTeX{} cannot find a
suitable place to hyphenate a word.\footnote{Although \LaTeX{} gives
  you a warning when that happens (Overfull hbox), such lines are not
  always easy to find. If you use the option \texttt{draft} in the
  \ci{documentclass} command, these lines will be marked with a
  thick black line on the right margin.} You can instruct \LaTeX{} to
lower its standards a little by giving the \ci{sloppy}
command. It prevents such over-long lines by increasing the inter-word
spacing --- even if the final output is not optimal.  In this case a
warning (``\wi{underfull hbox}'') is given to the user. In most such cases
the result doesn't look very good. The command \ci{fussy} acts in the
opposite direction. Just in case you want to see \LaTeX{} complaining
all over the place.

\subsection{Hyphenation} \label{hyph}

\LaTeX{} hyphenates words whenever necessary. If the hyphenation
algorithm does not find the correct hyphenation points, you can
remedy the situation by using the following commands to tell \TeX{}
about the exception.

The command
\begin{command}
\ci{hyphenation}\verb|{|\emph{word list}\verb|}|
\end{command}
\noindent causes the words listed in the argument to be hyphenated only at the
points marked by ``\verb|-|''.  This command should be given in the
preamble of the input file and should only contain words built from
normal letters. The case of the letters is ignored. The example below
will allow ``hyphenation'' to be hyphenated as well as ``Hyphenation'',
and it prevents ``FORTRAN'', ``Fortran'' and ``fortran'' from being
hyphenated at all.  No special characters or symbols are allowed in
the argument.

Example:
\begin{code}
\verb|\hyphenation{FORTRAN Hy-phen-a-tion}|
\end{code}

The command \ci{-} inserts a discretionary hyphen into a word. This
also becomes the only point hyphenation is allowed in this word. This
command is especially useful for words containing special characters
(e.g.{} accented characters), because \LaTeX{} does not automatically
hyphenate words containing special characters.
%\footnote{Unless you are using the new
%\wi{DC fonts}.}.

\begin{example}
I think this is: su\-per\-cal\-%
i\-frag\-i\-lis\-tic\-ex\-pi\-%
al\-i\-do\-cious
\end{example}

Several words can be kept together on one line with the command
\begin{command}
\ci{mbox}\verb|{|\emph{text}\verb|}|
\end{command}
\noindent It causes its argument to be kept together under all circumstances.

\begin{example}
My phone number will change soon.
It will be \mbox{0116 291 2319}.

The parameter 
\mbox{\emph{filename}} should 
contain the name of the file.
\end{example}
 
\section{Special Characters and Symbols}
%
% Rewrite Section to be more logical.
%
 
\subsection{Quotation Marks}

You should \emph{not} use the \verb|"| for \wi{quotation marks} 
\index{""@\texttt{""}} as you would on a typewriter.  In publishing there are
special opening and closing quotation marks.  In \LaTeX{}, use
two~\verb|`|s on for opening quotation marks and two~\verb|'|s for closing
quotation marks.

\begin{example}
``Please press the `x' key.''
\end{example}
 
\subsection{Dashes and Hyphens}

\LaTeX{} knows four kinds of \wi{dash}es. You can access three of
them with different numbers of consecutive dashes. The fourth sign
is actually not a dash at all: It is the mathematical minus sign: \index{-}
\index{--} \index{---} \index{-@$-$} \index{mathematical!minus}

\begin{example}
daughter-in-law, X-rated\\
pages 13--67\\
yes---or no? \\
$0$, $1$ and $-1$
\end{example}

The names for these dashes are: 
'-` \wi{hyphen}, '--` \wi{en-dash}, '---` \wi{em-dash} and
'$-$` \wi{minus sign}.

\subsection{Ellipsis ( \ldots )}

On a typewriter a \wi{comma} or a \wi{period} takes the same amount of
space as any other letter. In book printing these characters occupy
only a little space and are set very close to the preceding letter.
Therefore you cannot enter ``\wi{ellipsis}'' by just typing three
dots, as the spacing would be wrong. Besides that there is a special
command for these dots. It is called

\begin{command}
\ci{ldots}
\end{command}
\index{...@\ldots}

\begin{example}
Not like this ... but like this:\\
New York, Tokyo, Budapest, \ldots
\end{example}
 
\subsection{Ligatures}

Some letter combinations are typeset not just by setting the
different letters one after the other, but by actually using special
symbols.
\begin{code}
{\large ff fi fl ffi\ldots}\quad
instead of\quad {\large f{}f f{}i f{}l f{}f{}i \ldots}
\end{code}
These so-called \wi{ligature}s can be prohibited by inserting a \ci{mbox}\verb|{}|
between the two letters in question. This might be necessary with
words built from two words.

\begin{example}
Not shelfful\\
but shelf\mbox{}ful
\end{example}
 
\subsection{Accents and Special Characters}
 
\LaTeX{} supports the use of \wi{accent}s and \wi{special character}s
from many languages. Table~\ref{accents} shows all sorts of accents
being applied to the letter o. Naturally other letters work too.

To place an accent on top of an i or a j, their dots have to be
removed. This is accomplished by typing \verb|\i| and \verb|\j|.

\begin{example}
H\^otel, na\"\i ve, \'el\`eve,\\ 
sm\o rrebr\o d, !`Se\~norita!,\\
Sch\"onbrunner Schlo\ss{} 
Stra\ss e
\end{example}

\begin{table}[!hbp]
\caption{Accents and Special Characters.} \label{accents}
\begin{lined}{10cm}
\begin{tabular}{*4{cl}}
\A{\`o} & \A{\'o} & \A{\^o} & \A{\~o} \\
\A{\=o} & \A{\.o} & \A{\"o} & \B{\c}{c}\\[6pt]
\B{\u}{o} & \B{\v}{o} & \B{\H}{o} & \B{\c}{o} \\
\B{\d}{o} & \B{\b}{o} & \B{\t}{oo} \\[6pt]
\A{\oe}  &  \A{\OE} & \A{\ae} & \A{\AE} \\
\A{\aa} &  \A{\AA} \\[6pt]
\A{\o}  & \A{\O} & \A{\l} & \A{\L} \\
\A{\i}  & \A{\j} & !` & \verb|!`| & ?` & \verb|?`| 
\end{tabular}
\index{dotless \i and \j}\index{Scandinavian letters}
\index{ae@\ae}\index{umlaut}\index{grave}\index{acute}
\index{oe@\oe}

\bigskip
\end{lined}
\end{table}

\section{International Language Support}
\index{international} If you need to write documents in \wi{language}s
other than English, there are two areas where \LaTeX{} has to be
configured appropriately:

\begin{enumerate}
\item All automatically generated text strings\footnote{Table of
    Contents, List of Figures, \ldots.} have to be adapted to the new
  language.  For many languages, these changes can be accomplished by
  using the \pai{babel} package by Johannes Braams.
\item \LaTeX{} needs to know the hyphenation rules for the new
  language. Getting hyphenation rules into \LaTeX{} is a bit more
  tricky. It means rebuilding the format file with different
  hyphenation patterns enabled. Your \guide{} should give more
  information on this.
\end{enumerate}

If your system is already configured appropriately, you can activate
the \pai{babel} package by adding the command
\begin{command}
\ci{usepackage}\verb|[|\emph{language}\verb|]{babel}| 
\end{command}
\noindent after the \verb|\documentclass| command. The \emph{language}s your
system supports should also be listed in the Local Guide. Babel will
automatically activate the apropriate hyphenation rules for the
language you choose. If your \LaTeX{} format does not support
hyphenation in the language of your choice, babel will still work but
it will disable hyphenation which has quite a negative effect on the
visual appearance of the typeset document.

For some languages, \textsf{babel} also specifies new commands which
simplify the input of special characters. The \wi{German} language, for
example, contains a lot of umlauts (\"a\"o\"u).  With \textsf{babel},
you can enter an \"o by typing \verb|"o| instead of~\verb|\"o|.

Some computer systems allow you to input special characters directly
from the keyboard. \LaTeX{} can handle such characters. Since the
December 1994 release of \LaTeXe{}, support for several input
encodings is included in the basic distribution of \LaTeXe. Check the
\pai{inputenc} package. When using this package, you should consider
that other people might not be able to display your input files on
their computer, because they use a different encoding. For example,
the German umlaut \"a on a PC is encoded as 132, but on some Unix
systems using ISO-LATIN~1 it is encoded as 228. Therefore you should
use this feature with care.


Font encoding is a different matter. It defines at which position inside
a \TeX-font each letter is stored. The original Computer Modern
\TeX{} font does only contain the 128 characters of the old 7-bit ASCII
character set. When accented characters are required, \TeX{} creates
them by combining a normal character with an accent. While the
resulting output looks perfect, this approach stops the automatic
hyphenation from working inside words containing accented characters.

Fortunately, most modern \TeX{} distributions contain a copy of the EC
fonts. These fonts look like the Computer Modern fonts, but contain
special characters for most of the accented characters used in
European languages. By using these fonts you can improve hyphenation
in non-English documents. The EC fonts are activated by including the
\pai{fontenc} package in the preamble of your document.

\begin{command}
\ci{usepackage}\verb|[T1]{fontenc}| 
\end{command}


\section{The Space between Words}

To get a straight right margin in the output, \LaTeX{} inserts varying
amounts of space between the words. It inserts slightly more space at
the end of a sentence, as this makes the text more readable.  \LaTeX{}
assumes that sentences end with periods, question marks or exclamation
marks. If a period follows an uppercase letter, this is not taken as a
sentence ending, since periods after uppercase letters normally occur in
abbreviations.

Any exception from these assumptions has to be specified by the
author. A backslash in front of a space generates a space which will
not be enlarged. A tilde~`\verb|~|' character generates a space which cannot be
enlarged and which additionally prohibits a linebreak. The command
\verb|\@| in front of a period specifies that this period terminates a
sentence even when it follows a uppercase letter.
\cih{"@} \index{~@ \verb.~.} \index{tilde@tilde ( \verb.~.)}
\index{., space after}

\begin{example}
Mr.~Smith was happy to see her\\
cf.~Fig.~5\\
I like BASIC\@. What about you?
\end{example}

The additional space after periods can be disabled with the command
\begin{command}
\ci{frenchspacing}
\end{command}
\noindent which tells \LaTeX{} \emph{not} to insert more space after a
period than after ordinary character. This is very common in
non-English languages, except bibliographies. If you use
\ci{frenchspacing}, the command \verb|\@| is not necessary.
    
\section{Titles, Chapters, and Sections}

To help the reader find his or her way through your work, you should
divide it into chapters, sections, and subsections.  \LaTeX{} supports
this with special commands which take the section title as their
argument.  It is up to you to use them in the correct order.

The following sectioning commands are available for the
\texttt{article} class: \nopagebreak
\begin{code}
\ci{section}\verb|{...}           |\ci{paragraph}\verb|{...}|\\
\ci{subsection}\verb|{...}        |\ci{subparagraph}\verb|{...} |\\
\ci{subsubsection}\verb|{...}     |\ci{appendix}
\end{code}

You can use two additional sectioning commands for the \texttt{report}
and the \texttt{book} class:
\begin{code}
\ci{part}\verb|{...}              |\ci{chapter}\verb|{...}|
\end{code}

As the \texttt{article} class does not know about chapters, it is quite easy
to add articles as chapters to a book.
The spacing between sections, the numbering and the font size of the
titles will be set automatically by \LaTeX. 

\pagebreak[3]
Two of the sectioning commands are a bit special: 
\begin{itemize}
\item The \ci{part} command does
  not influence the numbering sequence of chapters.  
\item The \ci{appendix} command does not take an argument. It just
  changes the chapter numbering to letters.\footnote{For the article
    style it changes the section numbering.}
\end{itemize}



\LaTeX{} creates a table of contents by taking the section headings
and page numbers from the previous run of the document. The command
\begin{command}
\ci{tableofcontents}
\end{command}
\noindent expands to a table of contents at the place where it is issued. A new
document has to be processed (``\LaTeX ed'') twice to get a
correct \wi{table of contents}. Sometimes it might be
necessary to compile the document a third time. \LaTeX{} will tell you
when this is necessary.

All sectioning commands listed above also exist as ``starred''
versions.  A ``starred'' version of a command is built by adding a
star \verb|*| after the command name.  They generate section headings
which do not not show up in the table of contents and which are not
numbered. The command \verb|\section{Help}|, for example, would become
\verb|\section*{Help}|.

Normally the section headings show up in the table of contents exactly
as they are entered in the text. Sometimes this is not possible,
because the heading is too long to fit into the table of contents. The
entry for the table of contents can then be specified as an
optional argument in front of the actual heading.
\begin{code}
\verb|\chapter[Read it! It's Exciting]{This is a very long|\\
\verb|                 and especially boring title}|
\end{code} 

The \wi{title} of the whole document is generated by issuing a 
\begin{command}
\ci{maketitle}
\end{command}
\noindent command. The contents of the title have to be defined by the commands
\begin{command}
\ci{title}\verb|{...}|, \ci{author}\verb|{...}| 
and optionally \ci{date}\verb|{...}| 
\end{command}
\noindent before calling \verb|\maketitle|. In the argument of \ci{author}, you can
supply several names separated by \ci{and} commands. 

An example of some of the commands mentioned above can be found in
Figure~\ref{document} on page~\pageref{document}.

Apart from the sectioning commands explained above, \LaTeXe{}
introduced 3 additional commands for use with the \verb|book| class. 
\begin{command}
\ci{frontmatter}, \ci{mainmatter} and \ci{backmatter}
\end{command}
They are useful for dividing your publication. The commands alter
chapter headings and page numbering to work as you would expect it in
a book.

\section{Cross References}

In books, reports and articles, there are often 
\wi{cross-references} to figures, tables and special segments of text.
\LaTeX{} provides the following commands for cross referencing
\begin{command}
\ci{label}\verb|{|\emph{marker}\verb|}|, \ci{ref}\verb|{|\emph{marker}\verb|}| 
and \ci{pageref}\verb|{|\emph{marker}\verb|}|
\end{command}
\noindent where \emph{marker} is an identifier chosen by the user. \LaTeX{}
replaces \verb|\ref| by the number of the section, subsection, figure,
table, or theorem after which the corresponding \verb|\label| command
was issued. \verb|\pageref| prints the page number of the
corresponding \verb|\label| command.\footnote{Note that these commands
  are not aware of what they refer to. \ci{label} just saves the last
  automatically generated number.} Just as the section titles, the
numbers from the previous run are used.

\begin{example}
A reference to this subsection
\label{sec:this} looks like:
``see section~\ref{sec:this} on 
page~\pageref{sec:this}.''
\end{example}
 
% \section{Footnotes}
% With the command
% \begin{command}
% \ci{footnote}\verb|{|\emph{footnote text}\verb|}|
% \end{command}
% \noindent a footnote will be printed at the foot of the current page.

% \begin{example}
% Footnotes\footnote{This 
%   is a footnote} are often used
% by people using \LaTeX.
% \end{example}
 

% \section{Emphasized Words}

% In manuscripts produced by typewriter, important words get
% $\underline{\mathrm{underlined}}$. In printed books these words are
% \emph{emphasized}. The command to switch to an \emph{emphasized} font
% is called
% \begin{command}
% \ci{emph}\verb|{|\emph{text}\verb|}|
% \end{command}
% \noindent Its argument is the text to be \wi{emphasize}d.

% \begin{example}
% \emph{If you use 
%   \emph{emphasising} in an
%   already emphasized text, then
%   \LaTeX{} uses an 
%   \emph{upright} font for 
%   emphasising.}
% \end{example}

\section{Footnotes}
With the command
\begin{command}
\ci{footnote}\verb|{|\emph{footnote text}\verb|}|
\end{command}
\noindent a footnote is printed at the foot of the current page.  Footnotes
should always be put\footnote{``put'' is one of the most common
  English words.} after the word or sentence they refer
to.\footnote{Footnotes referring to a sentence or part of it should
  therefore be put after the comma or period.}

\begin{example}
Footnotes\footnote{This is 
  a footnote.} are often used 
by people using \LaTeX.
\end{example}
 
\section{Emphasized Words}

If a text is typed using a typewriter, \texttt{important words are
  emphasized by \underline{underlining} them.}  In printed books,
however, words are emphasized by typesetting them in an \emph{italic}
font.  \LaTeX{} provides the command
\begin{command}
\ci{emph}\verb|{|\emph{text}\verb|}|
\end{command}
\noindent to emphasize text.  What the command actually does with 
its argument depends on the context:

\begin{example}
\emph{If you use 
  emphasizing inside a piece
  of emphasized text, then 
  \LaTeX{} uses the
  \emph{normal} font for 
  emphasizing.}
\end{example}

Please note the difference between telling \LaTeX{} to
\emph{emphasize} something and telling it to use a different
\emph{font}:

\begin{example}
\textit{You can also
  \emph{emphasize} text if 
  it is set in italics,} 
\textsf{in a 
  \emph{sans-serif} font,}
\texttt{or in 
  \emph{typewriter} style.}
\end{example}

\section{Environments} \label{env}

% To typeset special purpose text, \LaTeX{} defines many different
% \wi{environment}s for all sorts of formatting:
\begin{command}
\ci{begin}\verb|{|\emph{name}\verb|}|\quad
   \emph{text}\quad
\ci{end}\verb|{|\emph{name}\verb|}|
\end{command}
\noindent Where \emph{name} is the name of the environment. Environments can be
called several times within each other as long as the calling order is
maintained.
\begin{code}
\verb|\begin{aaa}...\begin{bbb}...\end{bbb}...\end{aaa}|
\end{code}

\noindent In the following sections all important environments are explained.

\subsection{Itemize, Enumerate, and Description}

The \ei{itemize} environment is suitable for simple lists, the
\ei{enumerate} environment for enumerated lists, and the
\ei{description} environment for descriptions.
\cih{item}

\begin{example}
\flushleft
\begin{enumerate}
\item You can mix the list
environments to your taste:
\begin{itemize}
\item But it might start to
look silly. 
\item[-] With a dash.
\end{itemize}
\item Therefore remember:
\begin{description}
\item[Stupid] things will not
become smart because they are
in a list.
\item[Smart] things, though, can be
presented beautifully in a list.
\end{description}
\end{enumerate}
\end{example}
 
\subsection{Flushleft, Flushright, and Center}

The environments \ei{flushleft} and \ei{flushright} generate
paragraphs which are either left- or \wi{right-aligned}. \index{left
  aligned} The \ei{center} environment generates centred text. If you
do not issue \ci{\bs} to specify linebreaks, \LaTeX{} will
automatically determine linebreaks.

\begin{example}
\begin{flushleft}
This text is\\ left-aligned. 
\LaTeX{} is not trying to make 
each line the same length.
\end{flushleft}
\end{example}

\begin{example}
\begin{flushright}
This text is right-\\aligned. 
\LaTeX{} is not trying to make
each line the same length.
\end{flushright}
\end{example}

\begin{example}
\begin{center}
At the centre\\of the earth
\end{center}
\end{example}

\subsection{Quote, Quotation, and Verse}

The \ei{quote} environment is useful for quotes, important phrases and
examples.

\begin{example}
A typographical rule of thumb
for the line length is:
\begin{quote}
No line should contain more than
66~characters.

This is why \LaTeX{} pages have 
such large borders by default.
\end{quote}
That's why multicolumn print is
often used in newspapers.
\end{example}

There are two similar environments: the \ei{quotation} and the
\ei{verse} environments. The \texttt{quotation} environment is useful
for longer quotes going over several paragraphs, because it does
indent paragraphs. The \texttt{verse} environment is useful for poems
where the line breaks are important. The lines are separated by
issuing a \ci{\bs} at the end of a line and a empty line after each
verse.


\begin{example}
I know only one English poem by 
heart. It is about Humpty Dumpty.
\begin{flushleft}
\begin{verse}
Humpty Dumpty sat on a wall:\\
Humpty Dumpty had a great fall.\\ 
All the King's horses and all
the King's men\\
Couldn't put Humpty together
again.
\end{verse}
\end{flushleft}
\end{example}

\subsection{Printing Verbatim}

Text which is enclosed between \verb|\begin{|\ei{verbatim}\verb|}| and
\verb|\end{verbatim}| will be directly printed, as if it was typed on a
typewriter, with all linebreaks and spaces, without any \LaTeX{}
command being executed.

Within a paragraph, similar functionality can be accessed with
\begin{command}
\ci{verb}\verb|+|\emph{text}\verb|+|
\end{command}
\noindent The \verb|+| is just an example of a delimiter character. You can use any
character except letters, \verb|*| or space. Many \LaTeX{} examples in this
booklet are typeset with this command.

\begin{example}
The \verb|\ldots| command \ldots

\begin{verbatim}
10 PRINT "HELLO WORLD ";
20 GOTO 10
\end{verbatim}
\end{example}

\begin{example}
\begin{verbatim*}
the starred version of
the      verbatim   
environment emphasizes
the spaces   in the text
\end{verbatim*}
\end{example}

The \ci{verb} command can be used in a similar fashion with a star:

\begin{example}
\verb*|like   this :-) |
\end{example}

The \texttt{verbatim} environment and the \verb|\verb| command may not be used
within parameters of other commands.


\subsection{Tabular}

The \ei{tabular} environment can be used to typeset beautiful
\wi{table}s with optional horizontal and vertical lines. \LaTeX{}
determines the width of the columns automatically.

The \emph{table spec} argument of the 
\begin{command}
\verb|\begin{tabular}{|\emph{table spec}\verb|}|
\end{command} 
\noindent command defines the format of the table. Use an \texttt{l} for a column of
left-aligned text, \texttt{r} for right-aligned text, and \texttt{c} for
centred text; \verb|p{|\emph{width}\verb|}| for a column containing justified
text with linebreaks, and \verb.|. for a vertical line.
 
Within a \texttt{tabular} environment, \verb|&| jumps to the next column, \ci{\bs}
starts a new line and \ci{hline} inserts a horizontal line.
\index{"|@ \verb."|.}

\begin{example}
\begin{tabular}{|r|l|}
\hline
7C0 & hexadecimal \\
3700 & octal \\
11111000000 & binary \\
\hline \hline
1984 & decimal \\
\hline
\end{tabular}
\end{example}

\begin{example}
\begin{tabular}{|p{4.7cm}|}
\hline
Welcome to Boxy's paragraph.
We sincerely hope you'll 
all enjoy the show.\\
\hline 
\end{tabular}
\end{example}

The column separator can be specified With the \verb|@{...}|
construct. This command kills the inter-column space and replaces it
with whatever is between the curly braces.  One common use for
this command is explained below in the decimal alignment problem.
Another possible application is to suppress leading space in a table with
\verb|@{}|.

\begin{example}
\begin{tabular}{@{} l @{}}
\hline 
no leading space\\
\hline
\end{tabular}
\end{example}

\begin{example}
\begin{tabular}{l}
\hline
leading space left and right\\
\hline
\end{tabular}
\end{example}

%
% This part by Mike Ressler
%

\index{decimal alignment} Since there is no built-in way to align
numeric columns to a decimal point,\footnote{If the `tools' bundle is
  installed on your system, have a look at the \pai{dcolumn} package.}
we can ``cheat'' and do it by using two columns: a right-aligned
integer and a left-aligned fraction. The \verb|@{.}| command in the
\verb|\begin{tabular}| line replaces the normal inter-column spacing with
just a ``.'', giving the appearance of a single,
decimal-point-justified column.  Don't forget to replace the decimal
point in your numbers with a column separator (\verb|&|)! A column label
can be placed above our numeric ``column'' by using the
\ci{multicolumn} command.
 
\begin{example}
\begin{tabular}{c r @{.} l}
Pi expression       &
\multicolumn{2}{c}{Value} \\
\hline
$\pi$               & 3&1416  \\
$\pi^{\pi}$         & 36&46   \\
$(\pi^{\pi})^{\pi}$ & 80662&7 \\
\end{tabular}
\end{example}

\section{Floating Bodies}
Today most publications contain a lot of figures and tables. These
elements need special treatment, because they cannot be broken across
pages.  One method would be to start a new page every time a figure or
a table is too large to fit on the present page. This approach would
leave pages partially empty, which looks very bad.

The solution to this problem is to `float' any figure or table which
does not fit on the current page to a later page, while filling the
current page with body text. \LaTeX{} offers two environments for
\wi{floating bodies}. One for tables and  one for figures.  To
take full advantage of these two environments it is important to
understand approximately how \LaTeX{} handles floats internally.
Otherwise floats may become a major source of frustration, because
\LaTeX{} never puts them where you want them to be.

\bigskip
Let's first have a look at the commands \LaTeX{} supplies
for floats:

Any material enclosed in a \ei{figure} or \ei{table} environment will
be treated as floating matter. Both float environments support an optional
parameter
\begin{command}
\verb|\begin{figure}[|\emph{placement specifier}\verb|]| or
\verb|\begin{table}[|\emph{placement specifier}\verb|]|
\end{command}
\noindent called the \emph{placement specifier}. This parameter
is used to tell \LaTeX{} about the locations the float is allowed to
be moved to.  A \emph{placement specifier} is constructed by building a string
of \emph{float placing permissions}. See Table~\ref{tab:permiss}.

\begin{table}[!bp]
\caption{Float Placing Permissions.}\label{tab:permiss}
\noindent \begin{minipage}{\textwidth}
\medskip
\begin{center}
\begin{tabular}{@{}cp{10cm}@{}}
Spec&Permission to place the float \ldots\\
\hline
\rule{0pt}{1.05em}\texttt{h} & \emph{here} at the very place in the text
  where it occurred.  This is useful mainly for small floats.\\[0.3ex]
\texttt{t} & at the \emph{top} of a page\\[0.3ex]
\texttt{b} & at the \emph{bottom} of a page\\[0.3ex]
\texttt{p} & on a special \emph{page} containing only floats.\\[0.3ex]
\texttt{!} & without considering most of the  internal parameters\footnote{Such as the
    maximum number of floats allowed  on one page.} which could stop this
  float from being placed.
\end{tabular}
\end{center}
\end{minipage}
\end{table}

\pagebreak[3]
A table could be started with the following line e.g.{}
\begin{code}
\verb|\begin{table}[!hbp]|
\end{code}
\noindent The \wi{placement specifier} \verb|[!hbp]| allows \LaTeX{} to 
place the table right here (\texttt{h}) or at the bottom (\texttt{b}) 
of some page
or on a special floats page (\texttt{p}), and all this even if it does not
look that good (\texttt{!}). If no placement specifier is given, the standard
classes assume \verb|[tbp]|.

\LaTeX{} will place every float it encounters, according to the
placement specifier supplied by the author. If a float cannot be
placed on the current page it is deferred either to the
\emph{figures} or the \emph{tables} queue\footnote{These are fifo -
  `first in first out' queues!}.  When a new page is started,
\LaTeX{} first checks if it is possible to fill a special `float'
page with floats from the queues. If this is not possible, the first
float on each queue is treated as if it had just occurred in the
text: \LaTeX{} tries again to place it according to its
respective placement specifiers (except `h' which is no longer
possible).  Any new floats occurring in the text get placed into the
appropriate queues. \LaTeX{} strictly maintains the original order of
appearance for each type of float. That's why a figure which cannot
be placed pushes all further figures to the end of the document.
Therefore:

\begin{quote}
If \LaTeX{} is not placing the floats as you expected,
it is often only one float jamming one of the two float queues.
\end{quote}                 

\bigskip
\noindent Having explained the difficult bit, there are some more things to
mention about the \ei{table} and \ei{figure} environments.
With the 

\begin{command}
\ci{caption}\verb|{|\emph{caption text}\verb|}|
\end{command}

\noindent command, you can define a caption for the float. A running number and
the string ``Figure'' or ``Table'' will be added by \LaTeX.

The two commands

\begin{command}
\ci{listoffigures} and \ci{listoftables} 
\end{command}

\noindent operate analogously to the \verb|\tableofcontents| command,
printing a list of figures or tables, respectively.  In these lists,
the whole caption will be repeated. If you tend to use long captions,
you must have a shorter version of the caption going into the lists.
This is accomplished by entering the short version in brackets after
the \verb|\caption| command.
\begin{code}
\verb|\caption[Short]{LLLLLoooooonnnnnggggg}| 
\end{code}

With \verb|\label| and \verb|\ref|, you can create a reference to a float 
within your text.

The following example draws a square and inserts it into the
document. You could use this if you wanted to reserve space for images
you are going to paste into the finished document.

\begin{code}
\begin{verbatim}
Figure~\ref{white} is an example of Pop-Art.
\begin{figure}[!hbp]
\makebox[\textwidth]{\framebox[5cm]{\rule{0pt}{5cm}}}
\caption{Five by Five in Centimetres.} \label{white}
\end{figure}
\end{verbatim}
\end{code}

\noindent In the example above, 
\LaTeX{} will try \emph{really hard}~(\texttt{!}) to place the figure
right \emph{here}~(\texttt{h}).\footnote{assuming the figure queue is
  empty.} If this is not possible, it tries to place the figure at the
\emph{bottom}~(\texttt{b}) of the page.  Failing to place the figure
on the current page, it determines whether it is possible to create a float
page containing this figure and maybe some tables from the tables
queue. If there is not enough material for a special float page,
\LaTeX{} starts a new page, and once more treats the figure as if it
had just occurred in the text.

Under certain circumstances it might be necessary to use the 

\begin{command}
\ci{clearpage} or even the \ci{cleardoublepage} 
\end{command}

\noindent command. It orders \LaTeX{} to immediately place all 
floats remaining in the queues and then start a new
page. \ci{cleardoublepage} even goes to a new lefthand page.

You will learn how to include PostScript
drawings into your \LaTeXe{} documents later in this introduction.

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: "lshort2e"
%%% En
