%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Contents: Specialties of the LaTeX system
% File: spec.tex (lshort2e.tex)
% Change: 16/11/1994 (to)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
\section{Specialities}

In this chapter we will describe some of the untold wonders of the
\LaTeX{} system.  A more complete menu of specialities ``provided'' by
\LaTeX{} is described in the \manual{} and \companion.

\subsection{Fonts and Sizes}

\index{font}\index{font size} \LaTeX{} chooses the appropriate font and
font size based on the logical structure of the document (sections,
footnotes, \ldots).  In some cases one might like to change fonts and
sizes by hand. Therefore you can use the commands listed in
Tables~\ref{fonts} and~\ref{sizes}.

\begin{example}
{\small The small and 
\textbf{bold} Romans ruled}
{\Large all of great big 
\textit{Italy}.}
\end{example}
 
In \emph{math mode} you can use the font changing \emph{commands} to
temporarily exit \emph{math mode} and enter some normal text. If you want to
switch to another font for math typesetting there exists another
special set of commands. Refer to Table~\ref{mathfonts}.

\begin{table}[!bp]
\caption{Fonts} \label{fonts}
\begin{lined}{12cm}
%
% Alan suggested not to tell about the other form of the command
% eg |\sffamily| or |\bfseries|. This seems a good thing to me.
%
\begin{tabular}{@{}rl@{\qquad}rl@{}}
\ci{textrm}|{...}|        &      \textrm{\wi{roman}}&
\ci{textsf}|{...}|        &      \textsf{\wi{sans serif}}\\
\ci{texttt}|{...}|        &      \texttt{typewriter}\\[6pt]
\ci{textmd}|{...}|        &      \textmd{medium}&
\ci{textbf}|{...}|        &      \textbf{\wi{bold face}}\\[6pt]
\ci{textup}|{...}|        &       \textup{\wi{upright}}&
\ci{textit}|{...}|        &       \textit{\wi{italic}}\\
\ci{textsl}|{...}|        &       \textsl{\wi{slanted}}&
\ci{textsc}|{...}|        &       \textsc{\wi{small caps}}\\[6pt]
\ci{emph}|{...}|          &            \emph{emphasised} &
\ci{textnormal}|{...}|    &    \textnormal{document} font
\end{tabular}

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


\begin{table}[!bp]
\index{font size}
\caption{Font sizes} \label{sizes}
\begin{lined}{12cm}
\begin{tabular}{@{}ll}
\ci{tiny}      & \tiny        tiny font \\
\ci{scriptsize}   & \scriptsize  very small font\\
\ci{footnotesize} & \footnotesize  quite small font \\
\ci{small}        &  \small            small font \\
\ci{normalsize}   &  \normalsize  normal font \\
\ci{large}        &  \large       large font
\end{tabular}%
\qquad\begin{tabular}{ll@{}}
\ci{Large}        &  \Large       larger font \\[5pt]
\ci{LARGE}        &  \LARGE       very large font \\[5pt]
\ci{huge}         &  \huge        huge \\[5pt]
\ci{Huge}         &  \Huge        largest
\end{tabular}

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

\begin{table}[!tb]
\caption{Math fonts} \label{mathfonts}
\begin{lined}{12cm}
\begin{tabular}{@{}lll@{}}
\textit{Command}&\textit{Example}&    \textit{Output}\\[6pt]
\ci{mathcal}&    |$\mathcal{B}=c$|&     $\mathcal{B}=c$\\
\ci{mathrm}&     |$\mathrm{K}_2$|&      $\mathrm{K}_2$\\
\ci{mathbf}&     |$\sum x=\mathbf{v}$|& $\sum x=\mathbf{v}$\\
\ci{mathsf}&     |$\mathsf{G\times R}$|&        $\mathsf{G\times R}$\\
\ci{mathtt}&     |$\mathtt{L}(b,c)$|&   $\mathtt{L}(b,c)$\\
\ci{mathnormal}& |$\mathnormal{R_1}=R_1$|&      $\mathnormal{R_1}=R_1$\\
\ci{mathit}&     |$finder\neq\mathit{finder}$|& $finder\neq\mathit{finder}$
\end{tabular}

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

In connection with the font size commands, \wi{curly braces} play a
significant role. They are used to to build \emph{groups}.  Groups
limit the scope of most \LaTeX{} commands.\index{grouping}
 
\begin{example}
He likes {\LARGE large and 
{\small small} letters}. 
\end{example}
 
The font size commands also change the line spacing, but only if the
paragraph ends within the scope of the font size command. The closing curly
brace |}| should therefore not come too early.
Note the position of the |\par| command in the next two examples.

\begin{example}
{\Large Don't read this! It is not
true. You can believe me!\par}
\end{example}
\begin{example}
{\Large This is not true either.
But maybe I am lying.}\par
\end{example}


To conclude this journey into the land of fonts and font sizes,
here is a little word of advice\footnote{Attention: This is a bit of
  satire. I hope you realise that!}:\nopagebreak
\begin{quote}
  \underline{\textbf{Remember\Huge!}} \textit{The}
  \textsf{M\textbf{\LARGE O} \texttt{R}\textsl{E}} fonts \Huge you
  \tiny use \footnotesize \textbf{in} a \small \texttt{document}
  \large \textit{the} \normalsize more \textsc{readable} and
  \textsl{\textsf{beautiful} it bec\large o\Large m\LARGE e\huge s}.
\end{quote}

\subsection{Spacing}
 
\subsubsection{Line Spacing}

\index{line spacing} If you want to use larger interline spacing in a
document, you can change its value with the command:
\begin{command}
\ci{linespread}|{|\emph{factor}|}|
\end{command}

Use the command |\linespread{1.3}| for ``one and a half'' line
spacing, and |\linespread{1.6}| for ``double'' line spacing.  Normally
the lines are not spread, therefore the default linespread factor
is~1.\index{double line spacing}
 
\subsubsection{Paragraph Formating}\label{parsp}

In \LaTeX{}, there are two parameters influencing paragraph layout.
By placing a definition like
\begin{code}
\ci{setlength}|{|\ci{parindent}|}{0pt}| \\
|\setlength{|\ci{parskip}|}{1ex plus 0.5ex minus 0.2ex}|
\end{code}
in the preamble of the input file\footnote{Between the
  $\backslash$\texttt{documentclass} and the
  $\backslash$\texttt{begin\{document\}} commands} the appearance of
paragraphs can be changed. These two lines increase the space between
two paragraphs while setting the paragraph indent to zero.  In
continental Europe, paragraphs are often separated by some space and
not indented.

If you want to indent a paragraph which is not indented, you can use 
\begin{command}
\ci{indent}
\end{command}
\noindent at the beginning of the paragraph\footnote{To indent the first paragraph after each section head, use
the \pai{indentfirst} package in the `tools' bundle} . Obviously this can only
work, when |\parindent| is not set to zero. 

To create a non indented paragraph you can use 
\begin{command}
\ci{noindent}
\end{command}
\noindent as the first command of the paragraph. This might come in handy, when
you start a document with body text and not with a sectioning command.

\subsubsection{Horizontal Space}
 
\LaTeX{} determines the spaces between words and sentences
automatically. To add your own spaces in a place, you
can use: \index{horizontal!space}
\begin{command}
\ci{hspace}|{|\emph{length}|}|
\end{command}
If such a space should be kept even if it falls at the end or the
start of a line, use |\hspace*| instead of |\hspace|.  The
\emph{length} is in the simplest case just a number plus a unit.  The
most important units are listed in Table~\ref{units}. 
\index{units}\index{dimensions}

\begin{example}
This\hspace{1.5cm}is a space 
of 1.5 cm.
\end{example}
\suppressfloats
\begin{table}[tbp]
\caption{\TeX{} Units} \label{units}\index{units}
\begin{lined}{9.5cm}
\begin{tabular}{@{}ll@{}}
|mm| &  millimeter $\approx 1/25$~inch \quad \demowidth{1mm} \\
|cm| & centimeter = 10~mm  \quad \demowidth{1cm}                     \\
|in| & inch $\approx$ 25~mm \quad \demowidth{1in}                    \\
|pt| & point $\approx 1/72$~inch $\approx \frac{1}{3}$~mm  \quad\demowidth{1pt}\\
|em| & approx width of an |m| in the current font \quad \demowidth{1em}\\
|ex| & approx height of an |x| in the current font \quad \demowidth{1ex}
\end{tabular}

\bigskip
\end{lined}
\end{table}
 
The command
\begin{command}
\ci{stretch}|{|\emph{n}|}|
\end{command} 
\noindent generates a special rubber width. It stretches, until all the
remaining space on a line is filled up. If two
|\hspace{\stretch{|\emph{n}|}}| commands are issued on the same line,
they grow according to the stretch factor.

\begin{example}
x\hspace{\stretch{1}}
x\hspace{\stretch{2}}x
\end{example}

\subsubsection{Vertical Space}
The space between paragraphs, sections, subsections, \ldots\ is
determined automatically by \LaTeX. If necessary, additional vertical
space \emph{between two paragraphs} can be added with the command:
\begin{command}
\ci{vspace}|{|\emph{length}|}|
\end{command}

This command should normally be used between two empty lines.  If the
space should be preserved at the top or at the bottom of a page, use
the starred version of the command |\vspace*| instead of |\vspace|.
\index{vertical space}

The |\stretch| command in connection with |\pagebreak| can be used to
typeset text on the last line of a page, or to centre text vertically
on a page.
\begin{code}
\begin{verbatim}
Some text \ldots

\vspace{\stretch{1}}
This goes onto the last line of the page.\pagebreak
\end{verbatim}
\end{code}

 Additional space between two lines of \emph{the same} paragraph or
within a table is specified with the
\begin{command}
\ci{\bs}|[|\emph{length}|]|
\end{command}
\noindent command. 
 
\subsection{Bibliography}
 
With the \ei{thebibliography} environment you can produce a
\wi{bibliography}.  Each entry starts with
\begin{command}
\ci{bibitem}|{|\emph{marker}|}|
\end{command}
The \emph{marker} is then used to cite the book within the document.
\begin{command}
\ci{cite}|{|\emph{marker}|}|
\end{command}
The numbering of the entries is generated automatically.  The
parameter after the |\begin{thebibliography}| command sets the maximum
width of these numbers.

\begin{example}
Partl~\cite{pa} has 
proposed, that \ldots
 
\begin{thebibliography}{99}
\bibitem{pa} H.~Partl: 
\emph{German \TeX},
TUGboat Vol.~9, No.~1 (1988)
\end{thebibliography}
\end{example}

\subsection{Indexing}
A very useful feature of many books is their \wi{index}. With \LaTeX{}
and the support program |makeindx|\footnote{On systems supporting filenames
  longer than 8~characters, the program may be called
  \texttt{makeindex}.} indexes can be generated quite easily.  In this
introduction, only the basic index generation commands will be
explained. For a more in depth view please refer to \companion.
\index{makeindex program} \index{makeidx package}

To enable the indexing feature of \LaTeX{} the \pai{makeidx} package
must be loaded in the preamble with:
\begin{command}
|\usepackage{makeidx}|
\end{command}
The special indexing commands must be enabled with:
\begin{command}
  \ci{makeindex}
\end{command}

The contents of the index is specified with
\begin{command}
  \ci{index}|{|\emph{key}|}|
\end{command}
\noindent commands. Where \emph{key} is the index entry. You enter the
index commands at the points in the text where you want the final index
entries pointing to.  Table~\ref{index} explains the syntax of the
\emph{key} argument with several examples.

\begin{table}[!bp]
\caption{Index Key Syntax Examples}
\label{index}
\begin{center}
\begin{tabular}{@{}lll@{}}
  \textbf{Example} &\textbf{Index Entry} &\textbf{Comment}\\\hline
  \rule{0pt}{1.05em}|\index{hello}| &hello, 1 &Plain entry\\ 
|\index{hello!Peter}|   &\hspace*{2ex}Peter, 3 &Subentry under `hello'\\ 
|\index{Sam@\textsl{Sam}}|     &\textsl{Sam}, 2& Formated entry\\ 
|\index{Lin@\textbf{Lin}}|     &\textbf{Lin}, 7& Formated entry\\ 
\verb.\index{Jenny|textbf}.     &Jenny, \textbf{3}& Formated page number\\
\verb.\index{Joe|textit}.     &Joe, \textit{5}& Formated page number
\end{tabular}
\end{center}
\end{table}

When the input file is processed with \LaTeX{}, each |\index| command
writes an appropriate index entry together with the current page
number to a special file. The file has the same name as the \LaTeX{}
input file, but a different extension (|.ind|). This |.ind| file can
then be processed with the |makeindx| program.
\begin{command}
  |makeidx |\emph{filename}
\end{command}
The |makeindx| program generates a sorted index with the same base
file name, but this time with the extension |.idx|. If now the
\LaTeX{} input file is processed again, this sorted index gets
included into the document at the point where \LaTeX{} finds
\begin{command}
  \ci{printindex}
\end{command}

The \pai{showidx} package which comes with \LaTeXe{} prints out all
index entries in the left margin of the text. This is quite useful for
proofreading a document and verifying the index.
   
% Add some infos on PROTECT ...  

\subsection{Including EPS Graphics}
With the |figure| and the |table| environment \LaTeX{} provides the
basic facilities to work with floating bodies such as images or
graphics.

There are also several possibilities to generate the actual
\wi{graphics} with basic \LaTeX{} or a \LaTeX{} extension package. But
most users find them quite difficult to understand. Therefore this
will not be explained any further in this manual. For more information
on that subject please refer to \companion and the \manual.

A much easier way to get graphics into a document, is to generate them
with a specialised software package\footnote{Such as XFig, CorelDraw!,
  Freehand, GNU Plot, \ldots} and then include the finished graphics
into the document. Here again, \LaTeX{} packages offer many ways to do
that. In this introduction, only the inclusion of \wi{Encapsulated
  PostScript} (EPS) graphics will be discussed, because it is quite
easy to do and widely used.  In order to use pictures in the EPS
format, you must have a \wi{PostScript} printer\footnote{Another
  possibility to output PostScript, is the \textsc{\wi{GhostScript}}
  program available from \texttt{CTAN:/tex-archive/support/ghostscript}}
available for output.

A good set of commands for inclusion of graphics is provided in the
\pai{graphicx} package by D.~P.~Carlisle. It is part of a whole family
of packages called the ``graphics''
bundle\footnote{\texttt{CTAN:/tex-archive/macros/latex/packages/graphics}}.

Assuming you are working on a system with a
PostScript printer available for output and with the \textsf{graphicx}
package installed, you can use the following step by step guide to
include a picture into your document:

\begin{enumerate}
\item Export the picture from your graphics program in EPS
  format.
\item Load the \textsf{graphicx} package in the preamble of the input
  file with
\begin{command}
|\usepackage[|\emph{driver}|]{graphicx}|
\end{command}
\emph{driver} is the name of your ``dvi to postscript''
converter\footnote{The most widely used program is called
  \texttt{dvips}.}. This information is required by the package because
the actual graphics inclusion is done by the printer driver. Knowing
the \emph{driver}, the \textsf{graphicx} package inserts the
correct commands into the |.dvi|~file for the printer driver to
include the desired EPS graphics.
 
\item Use the command 
\begin{command}
\ci{includegraphics}|[|\emph{key}=\emph{value}, \ldots|]{|\emph{file}|}|
\end{command}
to include \emph{file} into your document. The optional parameter
accepts a comma separated list of \emph{keys} and associated
\emph{values}. The \emph{keys} can be used to alter the width, height
and rotation of the included graphic. Table~\ref{keyvals} lists the
most important keys.
\end{enumerate}

\begin{table}[htb]
\caption{Key Names for \textsf{graphicx} Package}
\label{keyvals}
\begin{lined}{9cm}
\begin{tabular}{@{}ll}
\texttt{width}& scale graphic to the specified width\\
\texttt{height}& scale graphic to the specified height\\
\texttt{angle}& rotate graphics clockwise
\end{tabular}

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

The following example code will hopefully make things clear:
\begin{code}
\begin{verbatim}
\begin{figure}
\begin{center}
\includegraphics[angle=90, width=10cm]{test.eps}
\end{center}
\end{figure}
\end{verbatim}
\end{code}
This includes the graphic stored in the file |test.eps|. The graphic
is \emph{first} rotated by 90 degrees and \emph{then} scaled to the
final width of 10\,cm. The aspect ratio is 1.0 because no special
height is specified.

For more information please refer to~\cite{graphics}.  

\endinput

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


