\def\faqfileversion{3.10e}    \def\faqfiledate{2003/11/18}
%
% The above line defines the file version, and must remain the first
% line with any `assignment' in the file, or things will blow up
% nastily
%
% get lists of CTAN labels
%
% configuration for the lists, if we're going to need to generate urls
% for the files
\ifpdf
\InputIfFileExists{archive.cfg}{}{}
\fi
%
% ... directories
\input{dirctan}
%
% ... files
\input{filectan}

\section{Introduction}

This \acro{FAQ} was originated by the Committee of the \acro{UK} \TeX{}
Users' Group (\acro{UK}~\acro{TUG}) as a development of a regular
posting to the \emph{Usenet} newsgroup \Newsgroup|comp.text.tex| that
was maintained for some time by Bobby Bodenheimer.  The first
\acro{UK} version was much re-arranged and corrected from the
original, and little of Bodenheimer's work now remains.

\htmlignore
An \acro{HTML} translation of the \acro{FAQ} is available on the
World-Wide Web, via \acro{URL}
\URL{http://www.tex.ac.uk/faq}; an alternative \acro{HTML} version
is also to be found on the
\endhtmlignore
\begin{htmlversion}

An alternative \acro{HTML} version of the \acro{FAQ} may be found on the
\end{htmlversion}
% beware line breaks
\TeX{}~Live \nothtml{\CDROM{} (}\Qref{\CDROM{}}{Q-CD}\nothtml{)}.

\begin{htmlversion}
  A copy of the complete \acro{FAQ}, in \acro{PDF} with many
  hyperlinks, may be found on
  \CTANref{faq-a4} (formatted for A4 paper) or
  \CTANref{faq-letter} (formatted for North American ``letter''
  paper).
\end{htmlversion}

Most members of the committee of \acro{UK}~\acro{TUG}, over the years
since 1994, have contributed to this \acro{FAQ} to some extent.  The
following people, who have never been members of the committee, have
also contributed help or advice:
Donald Arseneau,
Barbara Beeton,
Karl Berry,
Giuseppe Bilotta,
Charles Cameron,
Damian Cugley,
Michael Dewey,
Michael Downes,
Thomas Esser,
Anthony Goreham,
Norman Gray,
Eitan Gurari,
Hartmut Henkel,
John Hobby,
Berthold Horn,
Ian Hutchinson,
Werner Icking,
Regnor Jernsletten,
David Kastrup,
Simon Law,
Daniel Luecking,
Sanjoy Mahajan,
Andreas Matthias,
%Dick Nickalls, % now a member of the committee
Ted Nieland,
Hans Nordhaug,
Pat Rau,
Heiko Oberdiek,
Piet van Oostrum,
Scott Pakin,
Oren Patashnik,
Jos\'e Carlos Santos,
Walter Schmidt,
Hans-Peter Schr\"ocker,
Joachim Schrod,
Ulrik Vieth,
Mike Vulis,
Peter Wilson,
Rick Zaccone and
Reinhard Zierke.

\begin{htmlversion}

% pseudo-subsection here, because of limitations of latex->html translator
\textbf{Caveat: Acquiring files}

Most answers in this \acro{FAQ} provide links for downloading
software; a large proportion of these links direct you to entire
directories on the \acro{CTAN} archives.  Unfortunately, some browsers
issue a sequence of commands that causes \acro{CTAN} servers to deny
the existence of compressed archive files of the directory.  The
\acro{FAQ} now therefore offers three possible links for downloading
directories (that aren't already designated ``browse only''): the
links give you |.tar.gz| and |.zip| archives, and (for those with the
troublesome browsers) a link for browsing the directory.
\end{htmlversion}

\htmlignore
\subsection*{Finding the Files}

Unless otherwise specified, all files mentioned in this \acro{FAQ} are
available from a \acro{CTAN} archive, or from one of their mirrors.
\Qref[Question]{}{Q-archives} % this one doesn't need anchor text
gives details of the \acro{CTAN} archives, and how to retrieve files from
them.  If you don't have access to the Internet,
\Qref[question]{}{Q-CD} tells you of sources of \CDROM{}s that offer
snapshots of the archives.

The reader should also note that the first directory name of the path
name of every file on \acro{CTAN} has been elided from what follows, for the
simple reason that it's always the same (\path|tex-archive/|).

To avoid confusion, we've also elided the full
stop%
\begin{footnoteenv}
  `Full stop' (British English)==`period' (American English)
\end{footnoteenv}
from the end of any sentence whose last item is a path name (such
sentences are rare, and only occur at the end of paragraphs).  Though
the path names are set in a different font from running text, it's not
easy to distinguish the font of a single dot!
\endhtmlignore

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{The Background}

\Question[Q-whatTeX]{What is \TeX{}?}

\TeX{} is a typesetting system written by
\href{http://sunburn.stanford.edu/~knuth/}{Donald E. Knuth}, who
says in the Preface to his book on \TeX{}
(see \Qref[question]{books about TeX}{Q-books}) that it is
%% beware line wrap
``\emph{intended for the creation of beautiful books~--- and especially for books that contain a lot of mathematics}''.

Knuth is Emeritus Professor of the Art of Computer Programming at
Stanford University in California, \acro{USA}.  Knuth developed the
first version of \TeX{} in 1978 to deal with revisions to his series
``the Art of Computer Programming''.  The idea proved popular and
Knuth produced a second version (in 1982) which is the basis of what
we use today.

Knuth developed a system of
% beware line breaks
`\nothtml{literate programming' (}% beware line break
\Qref{literate programming}{Q-lit}\latexhtml{)}{'}
to write \TeX{},
and he provides the literate (\acro{WEB}) source of \TeX{} free of charge,
together with tools for processing the |web| source into something
that can be compiled and something that can be printed; there's never
any mystery about what \TeX{} does.  Furthermore, the \acro{WEB} system
provides mechanisms to port \TeX{} to new operating systems and
computers; and in order that one may have some confidence in the ports,
Knuth supplied a \nothtml{test (}\Qref{test}{Q-triptrap}\nothtml{)} by
means of which one may judge the fidelity of a \TeX{} system.  \TeX{}
and its documents are therefore highly portable.

\TeX{} is a macro processor, and offers its users a powerful
programming capability.  For this reason, \TeX{} on its own is a
pretty difficult beast to deal with, so Knuth provided a package of
macros for use with \TeX{} called Plain \TeX{}; Plain \TeX{} is
effectively the minimum set of macros one can usefully employ with
\TeX{}, together with some demonstration versions of higher-level
commands (the latter are better regarded as models than used as-is).
When people say they're ``programming in \TeX{}'', they usually mean
they're programming in Plain \TeX{}.

\Question[Q-TeXpronounce]{How should I pronounce ``\TeX{}''?}

The `X' stands for the lower case Greek letter
\htmlignore
Chi ($\chi$~--- the upper-case Greek letter doesn't look in the least
like a letter ``X''),
\endhtmlignore
\begin{htmlversion}
Chi (the upper-case Greek letter doesn't look in the least like a
letter ``X'')
\end{htmlversion}
and is pronounced by English-speakers either a bit like the `ch' in
the Scots word `loch' ([x] in the IPA) or like `k'.  It definitely is
not pronounced `ks'.

\Question[Q-MF]{What is \MF{}?}

\MF{} was written by Knuth as a companion to \TeX{}; whereas \TeX{}
defines the layout of glyphs on a page, \MF{} defines the shapes of
the glyphs and the relations between them.  \MF{} details the sizes of
glyphs, for \TeX{}'s benefit, and details the rasters used to
represent the glyphs, for the benefit of programs that will produce
printed output as post processes after a run of \TeX{}.

\MF{}'s language for defining fonts permits the expression of several
classes of things: first (of course), the simple geometry of the
glyphs; second, the properties of the print engine for which the
output is intended; and third, `meta'-information which can
distinguish different design sizes of the same font, or the difference
between two fonts that belong to the same (or related) families.

Knuth (and others) have designed a fair range of fonts using \MF{},
but font design using \MF{} is much more of a minority skill than is
\TeX{} macro-writing.  The complete \TeX{}-user nevertheless needs to
be aware of \MF{}, and to be able to run \MF{} to generate personal
copies of new fonts.

\Question[Q-MP]{What is \MP{}?}

The \MP{} system (by John Hobby) implements a picture-drawing language
very much like that of \MF{} except that it outputs Encapsulated \PS{}
files instead of run-length-encoded bitmaps.  \MP{} is a powerful
language for producing figures for documents to be printed on \PS{}
printers, either directly or embedded in \AllTeX{} documents. It
includes facilities for directly integrating \TeX{} text and
mathematics with the graphics. (Knuth tells us that he uses nothing
but \MP{} for diagrams in text that he is writing.)

Although \PDFLaTeX{} cannot ordinarily handle \PS{} graphics, the
output of \MP{} is sufficiently simple and regular that \PDFLaTeX{}
can handle it direct, using code borrowed from \CONTeXT{}~--- see
\Qref[question]{graphics in \PDFLaTeX{}}{Q-pdftexgraphics}.

Much of \MP{}'s source code was copied from \MF{}'s sources, with
Knuth's permission.

A mailing list discussing \MP{} is available;
\htmlignore
\begin{dviversion}
  subscribe via the \acro{NTG} \ProgName{mailman} interface at
  \URL{http://www.ntg.nl/mailman/listinfo/metapost}
\end{dviversion}
\begin{pdfversion}
  subscribe via the
  \href{http://www.ntg.nl/mailman/listinfo/metapost}{\acro{NTG} \ProgName{mailman} interface}.
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
  subscribe via the
  \href{http://www.ntg.nl/mailman/listinfo/metapost}{\acro{NTG} \ProgName{mailman} interface}.
\end{htmlversion}

\Question[Q-triptrap]{How can I be sure it's really \TeX{}?}

\TeX{} (and \MF{} and \MP{}) are written in a
\htmlignore
`literate' programming language called Web (\Qref{}{Q-lit})
\endhtmlignore
\begin{htmlversion}
  \Qref{`literate' programming}{Q-lit} language called Web
\end{htmlversion}
which is designed to be portable across a wide range of computer
systems.  How, then, is a new version of \TeX{} checked?

Of course, any sensible software implementor will have his own suite
of tests to check that his software runs: those who port \TeX{} and
its friends to other platforms do indeed perform such tests.

Knuth, however, provides a `conformance test' for both \TeX{}
(\texttt{trip}) and \MF{} (\texttt{trap}).
%%% Is there a similar one for \MP{}?
He characterises these as `torture tests': they are designed not to
check the obvious things that ordinary typeset documents, or font
designs, will exercise, but rather to explore small alleyways off the
main path through the code of \TeX{}.  They are, to the casual reader,
pretty incomprehensible!

Once an implementation of \TeX{} has passed its \texttt{trip}, or an
implementation of \MF{} has passed its \texttt{trap}, test it may
reasonably be distributed as a working version.


\Question[Q-y2k]{Are \TeX{} and friends Y2K compliant?}

\begin{description}
\item[Crashing:] None of \TeX{}, \MF{} or \MP{} can themselves crash
  due to any change whatever in the date of any sort.
\item[Timestamps:] In the original sources, a 2-digit year was
  stored as the creation time for format files and that value is
  printed in logfiles.  These items should not be of general concern,
  since the only use of the date format file is to produce the log
  output, and the log file is designed for human readers only.
  
  Knuth announced in 1998 that implementators could
  alter this code without fear of being accused of non-compliance.
  Nearly all implementations that are being actively maintained had
  been modified to generate 4-digit years in the format file and the
  log, by the end of 1998.  The original sources themselves have now
  been modified so that 4-digit year numbers are stored.
\item[The \cs|year| primitive:] Certification of a \TeX{}
  implementation (see \Qref[question]{trip/trap testing}{Q-triptrap})
  does not require that \cs|year| return a meaningful value (which
  means that \TeX{} can, in principle, be implemented on platforms
  that don't make the value of the clock available to user programs).
  The \emph{\TeX{}book} (see
  \Qref[question]{TeX-related books}{Q-books}) defines \cs|year| as
  ``the current year of our Lord'', which is the only correct meaning
  for \cs|year| for those implementations which can supply a
  meaningful value, which is to say nearly all of them.

  In short, \TeX{} implementations should provide a value in \cs|year|
  giving the 4-digit year Anno Domini, or the value 1776 if the
  platform does not support a date function.

  Note that if the system itself fails to deliver a correct date to
  \TeX{}, then \cs|year| will of course return an incorrect value.
  \TeX{} cannot be considered Y2K compliant, in this sense, on a
  system that is not itself Y2K compliant.
\item[Macros:] \TeX{} macros can in principle perform calculations on
  the basis of the value of \cs|year|.
\begin{htmlversion}
  The \Qref{LaTeX}{Q-latex} suite
\end{htmlversion}
\htmlignore
  The \LaTeX{} suite (\Qref{}{Q-latex})
\endhtmlignore
  performs such calculations in a small number of places; the
  calculations performed in the current (supported) version of \LaTeX{} are
  known to be Y2K compliant.

  Other macros and macro packages should be individually checked.
\item[External software:] Software such as \acro{DVI} translators
  needs to be individually checked.
\end{description}


\Question[Q-latex]{What is \LaTeX{}?}

\LaTeX{} is a \TeX{} macro package, originally written by Leslie Lamport, that
provides a document processing system.  \LaTeX{} allows markup to
describe the structure of a document, so that the user
need not think about presentation. By using document classes and
add-on packages, the same document can be produced in a variety of
different layouts.

Lamport says that \LaTeX{}
``\emph{represents a balance between functionality and ease of use}''.
This shows itself as a continual conflict that leads to
the need for such things as \acro{FAQ}s: \LaTeX{} \emph{can} 
meet most user requirements, but finding out \emph{how} is often
tricky.

\Question[Q-latex2e]{What is \LaTeXe{}?}

Lamport's last version of \LaTeX{} (\LaTeXo{}, last updated in 1992)
was superseded in 1994 by a new version (\LaTeXe{}) written by
\nothtml{the \LaTeX{} team (}\Qref{the \LaTeX{} team}{Q-LaTeX3}\nothtml{)}.
\LaTeXe{} is now the only readily-available version of
\LaTeX{}, and draws together several threads of \LaTeX{} development
from the later days of \LaTeXo{}.

\LaTeXe{} has several enhancements over \LaTeXo{}, but they were all
rather minor, with a view to continuity and stability rather than the
``big push'' that some had expected from the team.  \LaTeXe{}
continues to this day to offer a compatibility mode in which most
files prepared for use with \LaTeXo{} will run (albeit with somewhat
reduced performance).  Differences between \LaTeXe{} and \LaTeXo{} are
outlined in a series of `guide' files that are available in every
\LaTeX{} distribution; the most important of these files is available
on the Web as 
\URL{http://www.tex.ac.uk/tex-archive/macros/latex/doc/html/usrguide/}
and outlines the differences as seen by the ordinary writer of
documents and of simple macros.


\htmlignore
\begingroup\boldmath
\endhtmlignore
\Question[Q-latexpronounce]{How should I pronounce ``\LaTeX{}(\twee{})''?}
\htmlignore
\afterquestion
\endhtmlignore

Lamport never recommended how one should pronounce \LaTeX{}, but a lot
of people pronounce it `Lay \TeX{}' or perhaps `Lah \TeX{}' (with
\TeX{} pronounced as the program itself; see
\Qref[question]{the rules for TeX}{Q-TeXpronounce}).  It is definitely
\emph{not} to be pronounced in the same way as the rubber-tree gum.

The `epsilon' in `\LaTeXe{}' is supposed to be suggestive of a small
improvement over the old \LaTeXo{}.  Nevertheless, most people
pronounce the name as `\LaTeX{}-two-ee'.

\Question[Q-plainvltx]{Should I use Plain \TeX{} or \LaTeX{}?}

There's no straightforward answer to this question.  Many people swear
by Plain \TeX{}, and produce highly respectable documents using it
(Knuth is an example of this, of course).  But equally, many people
are happy to let someone else take the design decisions for them,
accepting a small loss of flexibility in exchange for a saving of
brain power.

The arguments around this topic can provoke huge amounts of noise and
heat, without offering much by way of light; your best bet is to find
out what those around you are using, and to go with the crowd.  Later
on, you can always switch your allegiance; don't bother about it.

If you are preparing a manuscript for a publisher or journal, ask them
what markup they want before you
develop your own; many big publishers have developed their own
\AllTeX{} styles for journals and books, and insist that authors stick
closely to their markup.

\Question[Q-LaTeXandPlain]{How does \LaTeX{} relate to Plain \TeX{}?}

\LaTeX{} is a program written in the programming language \TeX{}.  (In
the same sense, any \LaTeX{} document is also a program, which is
designed to run `alongside', or `inside' \LaTeX{}, whichever metaphor
you prefer.)

Plain \TeX{} is also a program written in the programming language
\TeX{}.

Both exist because writing your documents in `raw' \TeX{} would
involve much reinventing of wheels for every document.  They both
serve as convenient aids to make document writing more pleasant:
\LaTeX{} is a far more extensive aid.

\LaTeX{} is close to being a superset of Plain \TeX{}.  Many documents
designed for Plain \TeX{} will work with \LaTeX{} with no more than
minor modifications (though some will require substantial work).

Interpretation of any \AllTeX{} program involves some data-driven
elements, and \LaTeX{} has a wider range of such elements than does
Plain \TeX{}.  As a result, the mapping from \LaTeX{} to Plain \TeX{}
is far less clear than that in the other direction.

\Question[Q-context]{What is \CONTeXT{}?}

\href{http://www.pragma-ade.com/}{\CONTeXT{}} is a macro package
developed by Hans Hagen, originally to
serve the needs of the Dutch firm, Pragma.  It was designed with the
same general-purpose aims as \LaTeX{}, but (being younger) reflects
much more recent thinking about the structure of markup, etc.  In
particular, \CONTeXT{} can customise its markup to an
author's language (customising modules for Dutch, English and German
are provided, at present).

\CONTeXT{} is well integrated, in all of its structure,
with the needs of hypertext markup, and in particular with the
facilities offered by \nothtml{\PDFTeX{} (}%
% beware line wrap
\Qref{\PDFTeX{}}{Q-pdftex}\nothtml{)}.
The default installation employs a
version of \TeX{} built with both the \PDFTeX{} and
\nothtml{\eTeX{} (}\Qref{\eTeX{}}{Q-NTS}\nothtml{)}
extensions, and makes good use of both.

\CONTeXT{} doesn't yet have quite such a large developer community as
does \LaTeX{}, but those developers who are active seem to have
prodigious energy.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\CONTeXT{} distribution]\CTANref{context}
\end{ctanrefs}

\htmlignore
\begingroup\boldmath
\endhtmlignore
\Question[Q-AMSpkg]{What are the \acro{AMS} packages (\AMSTeX{}, \emph{etc}.)?}
\htmlignore
\afterquestion
\endhtmlignore

\AMSTeX{} is a \TeX{} macro package, originally written by Michael Spivak for
the American Mathematical Society (\acro{AMS}) during 1983--1985 and
is described in the book \nothtml{``The Joy of \TeX{}'' (}%
\htmlonly{``}\Qref{The Joy of \TeX{}}{Q-books}\latexhtml{)}{''}.
It is based on Plain \TeX{}, and provides many
features for producing more professional-looking maths formulas with
less burden on authors.  It pays attention to the finer details of
sizing and positioning that mathematical publishers care about. The
aspects covered include multi-line displayed equations, equation
numbering, ellipsis dots, matrices, double accents, multi-line
subscripts, syntax checking (faster processing on initial
error-checking \TeX{} runs), and other things.

As \LaTeX{} increased in popularity, authors asked to submit papers to
the \acro{AMS} in \LaTeX{}, and so the \acro{AMS} developed
\AMSLaTeX{}, which is a
collection of \LaTeX{} packages and classes that offer authors most of
the functionality of \AMSTeX{}.
\checked{RAB}{1994/11/12} % edited by RF; input from Michael Downes, too
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\AMSTeX{} distribution]\CTANref{amstex}
\item[\nothtml{\rmfamily}\AMSLaTeX{} distribution]\CTANref{amslatex}
\end{ctanrefs}

\Question[Q-eplain]{What is \Eplain{}?}

The
\href{http://www.ccs.neu.edu/~dorai/eplain/index.html}{\Eplain{}}
macro package expands on and extends the definitions in Plain \TeX{}.
\Eplain{} is not intended to provide ``generic typesetting
capabilities'', as do \LaTeX{} or % beware line break
\nothtml{Texinfo (}\Qref{Texinfo}{Q-texinfo}\nothtml{)}.  Instead, it
defines macro tools that should be useful whatever commands you choose
to use when you prepare your manuscript.

For example, \Eplain{} does not have a command \cs|section|,
which would format section headings in an ``appropriate'' way, as
\LaTeX{}'s \cs|section| does.  The philosophy of \Eplain{} is that
some people will always need or want to go beyond the macro designer's
idea of ``appropriate''.  Such canned macros are fine~--- as long as you
are willing to accept the resulting output.  If you don't like the
results, or if you are trying to match a different format, you are out
of luck.

On the other hand, almost everyone would like capabilities such as
cross-referencing by labels, so that you don't have to put actual page
numbers in the manuscript.  Karl Berry, the author of \Eplain{}, says
he is not aware of any generally available macro packages that do
not force their typographic style on an author, and yet provide
such capabilities.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\Eplain{} distribution]\CTANref{eplain}
\end{ctanrefs}

\Question[Q-lollipop]{What is Lollipop?}

Lollipop is a macro package written by Victor Eijkhout; it was used in
the production of his book ``\emph{\TeX{} by Topic}'' (see
\Qref[question]{\AllTeX{} Tutorials}{Q-tutorials}).  The manual says of
it:
\begin{quote}
  Lollipop is `\TeX{} made easy'. Lollipop is a macro package that
  functions as a toolbox for writing \TeX{} macros.  It was my
  intention to make macro writing so easy that implementing a fully
  new layout in \TeX{} would become a matter of less than an hour for
  an average document, and that it would be a task that could be
  accomplished by someone with only a very basic training in \TeX{}
  programming.

  Lollipop is an attempt to make structured text formatting available
  for environments where previously only \WYSIWYG{} packages could be
  used because adapting the layout is so much more easy with them than
  with traditional \TeX{} macro packages.
\end{quote}

The manual goes on to talk of ambitions to ``capture some of the
\LaTeX{} market share''; it's a very witty package, but little sign of
\htmlignore
it taking over from \LaTeX{} is detectable\dots\@
\endhtmlignore
\begin{htmlversion}
it taking over from \LaTeX{} is detectable\dots{}
\end{htmlversion}
An article about Lollipop appeared in \TUGboat{} 13(3).
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Lollipop distribution]\CTANref{lollipop}
\end{ctanrefs}

\Question[Q-texinfo]{What is Texinfo?}

Texinfo is a documentation system that uses one source file to produce
both on-line information and printed output.  So instead of writing
two different documents, one for the on-line help and the other for a
typeset manual, you need write only one document source file.  When
the work is revised, you need only revise one document.  You can read
the on-line information, known as an ``Info file'', with an Info
documentation-reading program.  By convention, Texinfo source file
names end with a |.texi| or |.texinfo| extension.  You can write and
format Texinfo files into Info files within \acro{GNU}
\ProgName{emacs}, and read them using the \ProgName{emacs} Info
reader.  You can also format Texinfo files into Info files using
\ProgName{makeinfo} and read them using \ProgName{info}, so you're not
dependent on \ProgName{emacs}.  The distribution includes a
\ProgName{Perl} script, \ProgName{texi2html}, that will convert
Texinfo sources into \acro{HTML}.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Texinfo distribution]\CTANref{texinfo}
\end{ctanrefs}

\Question[Q-whyfree]{If \TeX{} is so good, how come it's free?}

It's free because Knuth chose to make it so.  He is nevertheless
apparently happy
that others should earn money by selling \TeX{}-based services and
products. While several valuable \TeX{}-related tools and packages are
offered subject to restrictions imposed by the \acro{GNU} General Public
Licence (`Copyleft'), \TeX{} itself is not subject to Copyleft.

There are commercial versions of \TeX{} available; for some users,
it's reassuring to have paid support.  What is more, some of the
commercial implementations
have features that are not available in free versions.  (The
reverse is also true: some free implementations have features
not available commercially.)

This \acro{FAQ} concentrates on `free' distributions of \TeX{}, but we
do at least list the
\htmlignore
major vendors (\Qref{}{Q-commercial}).
\endhtmlignore
\begin{htmlversion}
  \Qref{major vendors}{Q-commercial}.
\end{htmlversion}

\Question[Q-TeXfuture]{What is the future of \TeX{}?}

Knuth has declared that he will do no further development of \TeX{};
he will continue to fix any bugs that are reported to him (though
bugs are rare).  This decision was made soon after
\TeX{} version~3.0 was released; at each bug-fix release
the version number acquires one more digit, so that it tends to the
limit~$\pi$ (at the time of writing, Knuth's latest release is version
3.14159).  Knuth wants \TeX{} to be frozen at version~$\pi$ when he
dies; thereafter, no further changes may be made to Knuth's source.
(A similar rule is applied to \MF{}; its version number tends to the
limit~$e$, and currently stands at 2.718.)

There are projects (some of them long-term
projects: see, for example,
\Qref[question]{the LaTeX3 project}{Q-LaTeX3})
%\Qref[and]{and the SGML work}{Q-SGML})
to build substantial
new macro packages based on \TeX{}.  For the even longer term, there
are various projects to build a \emph{successor} to \TeX{}; see
\Qref[questions]{the Omega project}{Q-omega} and \Qref[]{NTS}{Q-NTS}.

\Question[Q-readtex]{Reading \AllTeX{} files}

So you've been sent a \TeX{} file: what are you going to do with it?
Well, the good news is that \TeX{} systems are available, free, for
most sorts of computer; the bad news is that you need a pretty
complete \TeX{} system even to read a single file, and complete \TeX{}
systems are pretty large.

\TeX{} is a typesetting system that arose from a publishing project (see
\htmlonly{``}\Qref[question]{what is \TeX{}}{Q-whatTeX}\htmlonly{''}),
and its basic source is available free from its author.  However, at
its root, it is \emph{just} a typesetting engine: even to view or to
print the typeset output, you will need anciliary programs.  In short,
you need a \TeX{} \emph{distribution}~--- a collection of
\TeX{}-related programs tailored to your operating system: for details
of the sorts of things that are available, see
% beware line break
\htmlonly{``}\Qref[question]{\TeX{} distributions}{Q-TeXsystems}\htmlonly{''}
or
% beware line break
\htmlonly{``}\Qref[\htmlonly]{commercial \TeX{} distributions}{Q-commercial}\latexhtml{ (for commercial distributions)}{''}.

But beware~--- \TeX{} makes no attempt to look like the sort of
\WYSIWYG{} system you're probably used to (see
% beware line wrap
\htmlonly{``}\Qref[question]{why is \TeX{} not \WYSIWYG{}}{Q-notWYSIWYG}\htmlonly{''}):
while many modern versions of \TeX{} have a compile--view cycle that
rivals the best commercial word processors in its responsiveness, what
you type is usually \emph{markup}, which typically defines a logical
(rather than a visual) view of what you want typeset.

However, in this context markup proves to be a blessing in disguise: a
good proportion of most \TeX{} documents is immediately readable in an
ordinary text editor.  So, while you need to install a considerable
system to attain the full benefits of the \TeX{} document that you
were sent, the chances are you can understand quite a bit of it with
nothing more than the ordinary tools you already have on your computer.

\Question[Q-notWYSIWYG]{Why is \TeX{} not a \WYSIWYG{} system?}

\WYSIWYG{} is a marketing term (``What you see is what you get'') for
a particular style of text processor.  \WYSIWYG{} systems are
characterised by two principal claims: that you type what you want to
print, and that what you see on the screen as you type is a close
approximation to how your text will finally be printed.

The simple answer to the question is, of course, that \TeX{} was
conceived long before the marketing term, at a time when the marketing
imperative wasn't perceived as significant.  However, that was a long
time ago: why has nothing been done with the ``wonder text processor''
to make it fit with modern perceptions?

There are two answers to this.  First, the simple ``things \emph{have}
been done'' (but they've not taken over the \TeX{} world); and second,
``there are philosophical reasons why the way \TeX{} has developed is
ill-suited to the \WYSIWYG{} style''.
Indeed, there is a fundamental problem with applying \WYSIWYG{} techniques
to \TeX{}: the complexity of \TeX{} makes it hard to get the
equivalent of \TeX{}'s output without actually running \TeX{}.

A celebrated early system offering ``\WYSIWYG{} using \TeX{}'' came from the
Vor\TeX{} project: a pair of (early) Sun workstations worked in
tandem, one handling the user interface while the other beavered away
in the background typesetting the result.  Vor\TeX{} was quite
impressive for its time, but the two workstations combined had hugely less
power than the average sub-thousand dollar Personal Computer
nowadays, and its code has not proved portable (it never even made the
last `great' \TeX{} version change, at the turn of the 1990s, to
\TeX{} version 3).  Modern systems that are similar in
their approach are Lightning Textures (an extension of
Blue Sky's original \TeX{} system for the Macintosh), and Scientific
Word (which can also cooperate with a computer algebra system); both
these systems are \nothtml{commercially available (}%
\Qref{commercially available}{Q-commercial}\nothtml{)}.

The issue has of recent years started to attract attention from \TeX{}
developers, and several interesting projects addressing the
\nothtml{``\TeX{} document preparation environment'' (}% beware line breaks
\htmlonly{``}\Qref{\TeX{} document preparation environment}{Q-WYGexpts}\latexhtml{)}{''}
are in progress.

Nevertheless, the \TeX{} world has taken a long time to latch onto the
idea of \WYSIWYG{}.
Apart from simple arrogance (``we're better, and have no need to
consider the petty doings of the commercial word processor market''),
there is a real conceptual difference between the word processor model
of the world and the model \LaTeX{} and \CONTeXT{} employ~--- the idea of
``markup''.  ``Pure'' markup expresses a logical model of a document,
where every object within the document is labelled according to what
it is rather than how it should appear: appearance is deduced from the
properties of the type of object.  Properly applied, markup can
provide valuable assistance when it comes to re-use of documents.

Established \WYSIWYG{} systems find the expression of this sort of
structured markup difficult; however, markup \emph{is} starting to
appear in the lists of the commercial world's requirements, for two
reasons.  First, an element of markup helps impose style on a
document, and commercial users are increasingly obsessed with
uniformity of style; and second, the increasingly pervasive use of
\acro{XML}-derived document archival formats demands it.  The same
challenges must needs be addressed by \TeX{}-based document
preparation support schemes, so we are
observing a degree of confluence of the needs of the two communities:
interesting times may be ahead of us.

\Question[Q-TUG*]{\TeX{} User Groups}

There has been a \TeX{} User Group since very near the time \TeX{}
first appeared.  That first group, \acro{TUG}, is still active and its
journal \textsl{TUGboat} continues in regular publication
with articles about \TeX{}, \MF{} and related technologies, and about
document design, processing and production.  \acro{TUG} holds a yearly
conference, whose proceedings are published in \textsl{TUGboat}.

\acro{TUG}'s web site is a valuable resource for all sorts of
\TeX{}-related matters, such as details of \TeX{} software, and lists
of \TeX{} vendors and \TeX{} consultants.  Back articles from
\textsl{TUGboat} are slowly (subject to copyright issues, etc.\@)
making their way to the site, too.

Some time ago, \acro{TUG} established a ``technical council'', whose
task was to oversee the development of \TeX{}nical projects.  Most
such projects nowadays go on their way without any support from
\acro{TUG}, but \acro{TUG}'s web site lists its
\htmlignore
\ifpdf
\href{http://www.tug.org/twg.html}{Technical Working Groups (\acro{TWG}s)}.
\else
Technical Working Groups (\acro{TWG}s: see
\URL{http://www.tug.org/twg.html}).
\fi
\endhtmlignore
\begin{htmlversion}
\href{http://www.tug.org/twg.html}{Technical Working Groups (\acro{TWG}s)}.
\end{htmlversion}

\acro{TUG} has a reasonable claim to be considered a world-wide
organisation, but there are many national and regional user groups,
too; \acro{TUG}'s web site maintains a list of
\htmlignore
\ifpdf
\href{http://www.tug.org/lugs.html}{``Local User Groups'' (\acro{LUG}s)}.
\else
``local user groups'' (\acro{LUG}s: see
\URL{http://www.tug.org/lugs.html}).
\fi
\endhtmlignore
\begin{htmlversion}
\href{http://www.tug.org/lugs.html}{``local user groups'' (\acro{LUG}s)}.
\end{htmlversion}

Contact \acro{TUG} itself via:
\begin{quote}
  \TeX{} Users Group\\
  1466 NW Front Avenue, Suite 3141\\
  Portland, OR 97209\\
  \acro{USA}\\[.25\baselineskip]
  Tel: +1 503-223-9994\\
  Fax: +1 503-223-3960\\
  Email: \mailto|tug@mail.tug.org|\\
  Web: \URL{http://www.tug.org/}
\end{quote}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Documentation and Help}

\Question[Q-books]{Books on \TeX{} and its relations}

While Knuth's book is the definitive reference for \TeX{}, there are
other books covering \TeX{}:
\begin{booklist}
\item[The \TeX{}book]by Donald Knuth (Addison-Wesley, 1984,
  \ISBN{0-201-13447-0}, paperback \ISBN{0-201-13448-9})
\item[A Beginner's Book of \TeX{}]by Raymond Seroul and Silvio Levy,
  (Springer Verlag, 1992, \ISBN{0-387-97562-4})
\item[\TeX{} by Example: A Beginner's Guide]by Arvind Borde 
  (Academic Press, 1992, \ISBN{0-12-117650-9}~--- now out of print)
\item[Introduction to \TeX{}]by Norbert Schwarz (Addison-Wesley,
  1989, \ISBN{0-201-51141-X}~--- now out of print)
\item[A Plain \TeX{} Primer]by Malcolm Clark (Oxford University
  Press, 1993, ISBNs~0-198-53724-7 (hardback) and~0-198-53784-0
  (paperback))
\item[A \TeX{} Primer for Scientists]by Stanley Sawyer and Steven
  Krantz (CRC Press, 1994, \ISBN{0-849-37159-7})
\item[\TeX{} by Topic]by Victor Eijkhout (Addison-Wesley, 1992,
  \ISBN{0-201-56882-9}~--- now out of print, but see
  \Qref[question]{\AllTeX{} tutorials}{Q-tutorials})
\item[\TeX{} for the Beginner]by Wynter Snow (Addison-Wesley, 1992,
  \ISBN{0-201-54799-6})
\item[\TeX{} for the Impatient]by Paul W.~Abrahams, Karl Berry and
  Kathryn A.~Hargreaves (Addison-Wesley, 1990,
  \ISBN{0-201-51375-7}~--- now out of print, but see
  \Qref[question]{\AllTeX{} tutorials}{Q-tutorials})
\item[\TeX{} in Practice]by Stephan von Bechtolsheim (Springer
  Verlag, 1993, 4 volumes, \ISBN{3-540-97296-X} for the set, or
% nos in brackets are for German distribution (Springer Verlag, Berlin)
  Vol.~1: \ISBN{0-387-97595-0}, % (3-540-97595-0)
  Vol.~2: \ISBN{0-387-97596-9}, % (3-540-97596-9)
  Vol.~3: \ISBN{0-387-97597-7}, and % (3-540-97597-7)
  Vol.~4: \ISBN{0-387-97598-5})% (3-540-97598-5)
\htmlignore
\item[\TeX{}: Starting from \sqfbox{1}\,\footnotemark]%
\footnotetext{That's `Starting from Square One'}%
\endhtmlignore
\begin{htmlversion}
\item[\TeX{}: Starting from Square One]
\end{htmlversion}
  by Michael Doob (Springer
  Verlag, 1993, \ISBN{3-540-56441-1}~--- now out of print)
\item[The Joy of \TeX{}]by Michael D.~Spivak (second edition,
  \acro{AMS}, 1990, \ISBN{0-821-82997-1})
\item[The Advanced \TeX{}book]by David Salomon (Springer Verlag, 1995,
  \ISBN{0-387-94556-3})
\end{booklist}
A collection of Knuth's publications about typography is also available:
\begin{booklist}
\item[Digital Typography]by Donald Knuth (CSLI and Cambridge
  University Press, 1999, \ISBN{1-57586-011-2}, paperback
  \ISBN{1-57586-010-4}).
\end{booklist}
\nothtml{\noindent}and in late 2000, a ``Millennium Boxed Set'' of all
5 volumes of Knuth's ``Computers and Typesetting'' series (about
\TeX{} and \MF{}) was published by Addison Wesley:
\begin{booklist}
\item[Computers \& Typesetting, Volumes A--E Boxed Set]by Donald Knuth
  (Addison-Wesley, 2001, \ISBN{0-201-73416-8}).
\end{booklist}
\checked{rf}{2000/02/12 -- http://cseng.aw.com/book/0,3828,0201734168,00.html}
For \LaTeX{}, see:
\begin{booklist}
\item[\LaTeX{}, a Document Preparation System]by Leslie Lamport
  (second edition, Addison Wesley, 1994, \ISBN{0-201-52983-1})
\item[A guide to \LaTeX{}]Helmut Kopka and Patrick W.~Daly (third
  edition, Addison-Wesley, 1998, \ISBN{0-201-39825-7})
\item[The \LaTeX{} Companion]by Michel Goossens, Frank Mittelbach,
  and Alexander Samarin (Addison-Wesley, 1993, \ISBN{0-201-54199-8})
\item[The \LaTeX{} Graphics Companion:]%
  \emph{Illustrating documents with \TeX{} and \PS{}} by Michel
  Goossens, Sebastian Rahtz and Frank Mittelbach (Addison-Wesley,
  1997, \ISBN{0-201-85469-4})
\item[The \LaTeX{} Web Companion:]%
  \emph{Integrating \TeX{}, \acro{HTML} and \acro{XML}} by Michel
  Goossens and Sebastian Rahtz (Addison-Wesley, 1999, \ISBN{0-201-43311-7})
\item[\TeX{} Unbound:]%
  \emph{\LaTeX{} and \TeX{} strategies for fonts, graphics, and more}
  by Alan Hoenig (Oxford University Press, 1998, \ISBN{0-19-509685-1}
  hardback, \ISBN{0-19-509686-X} paperback)
\item[Math into \LaTeX{}:]\emph{An Introduction to \LaTeX{} and \AMSLaTeX{}}
  by George Gr\"atzer (third edition Birkh\"auser and Springer Verlag,
  2000, \ISBN{0-8176-4431-9}, \ISBN{3-7643-4131-9})
\checked{RF}{2001/01/16}
%% gr\"atzer's home page
%% http://www.maths.umanitoba.ca/homepages/gratzer.html/LaTeXBooks.html

  A list of errata for the first printing is available from:
  \URL{http://www.springer-ny.com/catalog/np/jan99np/0-387-98708-8.html}
\item[First Steps in \LaTeX{}]by George Gr\"atzer (Birkh\"auser, 1999,
  \ISBN{0-8176-4132-7}) 
\item[\LaTeX{}: Line by Line:]%
  \emph{Tips and Techniques for Document Processing}
  by Antoni Diller (second edition, John Wiley \& Sons,
  1999, \ISBN{0-471-97918-X})
\item[\LaTeX{} for Linux:]\emph{A Vade Mecum}
  by Bernice Sacks Lipkin (Springer-Verlag, 1999,
  \ISBN{0-387-98708-8}, second printing)
\end{booklist}
A sample of George Gr\"atzer's ``Math into \LaTeX{}'', in Adobe
Acrobat format, and example files
%for von Bechtolsheim's ``\TeX{} in Practice'', 
for the \LaTeX{} Graphics and Web Companions, and for
Gr\"atzer's ``First Steps in \LaTeX{}'', are all available on
\acro{CTAN}.

There's a nicely-presented list of of ``recommended books'' to be had
on the web: \URL{http://www.macrotex.net/texbooks/}

The list of \MF{} books is rather short:
\begin{booklist}
\item[The \MF{}book]by Donald Knuth (Addison Wesley, 1986,
  \ISBN{0-201-13445-4}, \ISBN{0-201-52983-1} paperback)
\end{booklist}
Alan Hoenig's `\textsl{\TeX{} Unbound}' includes some discussion and
examples of using \MF{}.

A book covering a wide range of topics (including installation and
maintenance) is:
\begin{booklist}
\item[Making \TeX{} Work]by Norman Walsh (O'Reilly and Associates,
  Inc, 1994, \ISBN{1-56592-051-1})
\end{booklist}
The book is decidedly dated, and is now out of print, but a copy is
available via |sourceforge| and on \acro{CTAN}, 
and we list it under % beware line break
``\nothtml{tutorials'' (}\Qref{tutorials}{Q-tutorials}\latexhtml{)}{''}.


This list only covers books in English: notices of new books, or
warnings that books are now out of print are always welcome.  However,
this \acro{FAQ} does \emph{not} carry reviews of current published material.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Examples for \nothtml{\upshape}First Steps in \LaTeX{}]\CTANref{gfs}
\item[\nothtml{\rmfamily}Examples for \nothtml{\upshape}\LaTeX{} Graphics Companion]\CTANref{lgc}
\item[\nothtml{\rmfamily}Examples for \nothtml{\upshape}\LaTeX{} Web Companion]\CTANref{lwc}
%\item[\nothtml{\rmfamily}Examples for \nothtml{\upshape}\TeX{} in Practice]\CTANref{tip}
\item[\nothtml{\rmfamily}Sample of \nothtml{\upshape}Math into \LaTeX{}]\CTANref{mil}
\end{ctanrefs}

\Question[Q-typebooks]{Books on Type}

    The following is a partial listing of books on typography in general.
Of these, Bringhurst seems to be the one most often recommended.
\begin{booklist}
\item[The Elements of Typographic Style]by Robert Bringhurst
  (Hartley \& Marks, 1992, \ISBN{0-88179-033-8})
\item[Finer Points in the Spacing \& Arrangement of Type]by Geoffrey Dowding
  (Hartley \& Marks, 1996, \ISBN{0-88179-119-9})
\item[The Thames \& Hudson Manual of Typography]by Ruari McLean
  (Thames \& Hudson, 1980, \ISBN{0-500-68022-1})
\item[The Form of the Book]by Jan Tschichold
  (Lund Humphries, 1991, \ISBN{0-85331-623-6})
\item[Type \& Layout]by Colin Wheildon
  (Strathmore Press, 1995, \ISBN{0-9624891-5-8})
\item[The Design of Books]by Adrian Wilson
  (Chronicle Books, 1993, \ISBN{0-8118-0304-X})
\end{booklist}

    There are many catalogues of type specimens but the following books provide
a more interesting overall view of types in general and some of their history.
\begin{booklist}
\item[Alphabets Old \& New]by Lewis F.~Day
  (Senate, 1995, \ISBN{1-85958-160-9})
\item[An Introduction to the History of Printing Types]by Geoffrey Dowding
  (British Library, 1998, UK \ISBN{0-7123-4563-9}; USA \ISBN{1-884718-44-2})
\item[The Alphabet Abecedarium]by Richar A.~Firmage
  (David R.~Godine, 1993, \ISBN{0-87923-998-0})
\item[The Alphabet and Elements of Lettering]by Frederick Goudy
  (Dover, 1963, \ISBN{0-486-20792-7})
\item[Anatomy of a Typeface]by Alexander Lawson
  (David R.~Godine, 1990, \ISBN{0-87923-338-8})
\item[A Tally of Types]by Stanley Morison
  (David R.~Godine, 1999, \ISBN{1-56792-004-7})
\item[Counterpunch]by Fred Smeijers
  (Hyphen, 1996, \ISBN{0-907259-06-5})
\item[Treasury of Alphabets and Lettering]by Jan Tschichold
  (W.~W.~Norton, 1992, \ISBN{0-393-70197-2})
\item[A Short History of the Printed Word]by Warren Chappell and
  Robert Bringhurst (Hartley \& Marks, 1999, \ISBN{0-88179-154-7})
\end{booklist}

    The above lists are limited to books published in English. Typographic 
styles are somewhat language-dependent, and similarly the `interesting' fonts
depend on the particular writing system involved.

\Question[Q-whereFAQ]{Where to find \acro{FAQ}s}

Bobby Bodenheimer's article, from which this \acro{FAQ} was developed, used
to be posted (nominally monthly) to newsgroup
\Newsgroup|comp.text.tex| and cross-posted to newsgroups
\Newsgroup|news.answers| and \Newsgroup|comp.answers|. The (long
obsolete) last posted copy of that article is kept on \acro{CTAN} for
auld lang syne; it is no longer kept in the
\Newsgroup|news.answers| archives.

\htmlignore
\ifpdf
A version of the \href{http://www.tex.ac.uk/faq}{present \acro{FAQ}}
may be browsed via the World-Wide Web, and its sources
\else
A version of the present \acro{FAQ} may be browsed via the World-Wide Web, at
\acro{URL} \URL{http://www.tex.ac.uk/faq}, and its sources
\fi
\endhtmlignore
\begin{htmlversion}
The sources of the present \acro{FAQ}
\end{htmlversion}
are available from \acro{CTAN}.

Another excellent information source, available in English, is the
\htmlignore
\ifpdf
\href{http://tex.loria.fr}{\AllTeX{} navigator}.
\else
\AllTeX{} navigator (see \URL{http://tex.loria.fr}).
\fi
\endhtmlignore
\begin{htmlversion}
\href{http://tex.loria.fr}{\AllTeX{} navigator}.
\end{htmlversion}

Both the Francophone \TeX{} usergroup Gutenberg and the Czech/Slovak
usergroup CS-TUG have published translations of this \acro{FAQ}, with
extensions appropriate to their languages.

The Open Directory Project (\acro{ODP}) maintains a list of sources of
\AllTeX{} help, including \acro{FAQ}s.  View the \TeX{} area at
\URL{http://dmoz.org/Computers/Software/Typesetting/TeX/}

Other non-English \acro{FAQ}s are available:
\begin{booklist}
\item[German]Posted regularly to \Newsgroup|de.comp.tex|, and archived
  on \acro{CTAN}; the \acro{FAQ} also appears at
  \URL{http://www.dante.de/faq/de-tex-faq/}
\item[French]Posted regularly to \Newsgroup|fr.comp.text.tex|, and
  archived on \acro{CTAN}.
\item[Spanish]See \URL{http://apolo.us.es/CervanTeX/FAQ/}
\item[Czech]See \URL{http://www.fi.muni.cz/cstug/csfaq/}
\end{booklist}
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Dante \acro{FAQ}]\CTANref{dante-faq}
\item[\nothtml{\rmfamily}French \acro{FAQ}]\CTANref{french-faq}
\item[\nothtml{\rmfamily}Sources of this \acro{FAQ}]\CTANref{faq}
\item[\nothtml{\rmfamily}Obsolete \texttt{comp.text.tex} \acro{FAQ}]%
  \CTANref{TeX-FAQ}
\end{ctanrefs}

\Question[Q-maillists]{Where to get help}

First~\dots{} read any \acro{FAQ} you can find.  (Which is what you're
doing now, isn't it?)

An ambitious \acro{FAQ}-like project to collect all \TeX{}-related
information into one place is under way at
\URL{http://www.ctv.es/USERS/irmina/TeEncontreX.html}; as with any
\acro{FAQ}, this project needs the support and help of all users~---
as yet, it carries an incomplete set of answers to potential
questions.  The sources of the package (including a complete set of
|html| files) are available on \acro{CTAN}

The tutorials and other on-line documentation (see
\Qref[question]{\AllTeX{} Tutorials}{Q-tutorials}) can get you started but
for more in-depth understanding you should get and read at least one of the
many good books on the subject
(see \Qref[question]{\TeX{}-related books}{Q-books}). The definitive source for
\AllTeX{} is the source code itself, but that is not something to be 
approached lightly (if at all).

    If you are seeking a particular package or program, look on your own
system first: you might already have it~--- the better \TeX{}
distributions contain a wide range of supporting material.

    If you have access to the internet, and in particular newsgroups,
then \AllTeX{} discussions, including \MF{} and \MP{}, are on
\Newsgroup|comp.text.tex|.
It is best to
spend a little time familiarising yourself with the current threads before
asking a question. The group is normally very responsive but asking a question
that has just been answered is likely to dampen people's enthusiasm to help
you. 

\URL{http://groups.google.com/} archives Usenet news discussions, and
\Newsgroup|comp.text.tex| may be found there.  Google's archive now
goes impressively far back in time (before \Newsgroup|comp.text.tex|
even existed), and it is a powerful resource for tracking down that
recommendation that no-one can now remember.  Google also allows
you to post your own questions or followups.

The few people who can't use the World Wide Web, can't access Usenet
news, but can use electronic mail can seek help through mailing lists.

The \TeX{}hax digest is nowadays operated as a
``\ProgName{MailMan}'' mailing list: its members now have the option
of receiving messages in `real time', and answers are more quickly
forthcoming than ever they were in the past.  Subscribe via
\URL{http://www.tug.org/mailman/listinfo/texhax}; archives back to
April 2000 are available via the same link, and earlier
digests are available on \acro{CTAN}.

Many mailing lists exist that cover some small part of the \TeX{}
arena.  A good source of pointers is \URL{http://www.tug.org/}

Announcements of \TeX{}-related installations on the \acro{CTAN}
archives are sent to the mailing list |ctan-ann|.  Subscribe
to the list by sending a message
% beware line wrap
`\texttt{subscribe ctan-ann <your email address>}' to
\mailto|majordomo@dante.de|

Issues related to \MF{} (and, increasingly, \MP{}) are discussed on
the |metafont| mailing list; subscribe by sending a message
`\texttt{subscribe metafont <\emph{your name}>}' to \mailto|listserv@ens.fr|

A few other \TeX{}-related lists may be accessed via
\mailto|listserv@urz.uni-heidelberg.de|.  Send a message containing
the line `|help|' to this address, or browse
\URL{http://listserv.uni-heidelberg.de/cgi-bin/wa}
\begin{ctanrefs}
\item[\nothtml{\rmfamily}TeEncontreX sources, etc.]\CTANref{teencontrex}
\item[\nothtml{\rmfamily}\TeX{}hax digests]Browse \CTANref{texhax}
\end{ctanrefs}

\Question[Q-askquestion]{How to ask a question}

You want help from the community at large; you've decided where you're
going to \nothtml{ask your question (}%
% beware line-wrap
\Qref{ask your question}{Q-maillists}\nothtml{)}, but how do you
phrase it?

Excellent ``general'' advice (how to ask questions of anyone) is
contained in
%beware line break
\href{http://catb.org/~esr/faqs/smart-questions.html}{Eric Raymond's article on the topic}.
Eric's an extremely self-confident person, and this comes through in
his advice; but his guidelines are very good, even for us in the
un-self-confident majority.  It's important to remember that you don't
have a right to advice from the world, but that if you express
yourself well, you will usually find someone who will be pleased to
help.

So how do you express yourself in the \AllTeX{} world?  There aren't
any comprehensive rules, but a few guidelines may help in the
application of your own common sense.
\begin{enumerate}
\item Make sure you're asking the right people.  Don't ask in a \TeX{}
  forum about printer device drivers for the \ProgName{Foobar}
  operating system.  Yes, \TeX{} users need printers, but no, \TeX{}
  users will typically \emph{not} be \ProgName{Foobar} systems
  managers.

  Similarly, avoid posing a question in a language that the majority
  of the group don't use: post in Ruritanian to
  \Newsgroup|de.comp.text.tex| and you may have a long wait before a
  German- and Ruritanian-speaking \TeX{} expert notices your
  question.
\item If your question is (or may be) \TeX{}-system-specific, report
  what system you're using, or intend to use: ``I can't install
  \TeX{}'' is as good as useless, whereas ``I'm trying to install the
  \ProgName{mumbleTeX} distribution on the \ProgName{Grobble}
  operating system'' gives all the context a potential respondent
  might need.  Another common situation where this information is
  important is when you're having trouble installing something new in
  your system: ``I want to add the \Package{glugtheory} package to my
  \ProgName{mumbleTeX v12.0} distribution on the \ProgName{Grobble 2024}
  operating system''.
\item If you need to know how to do something, make clear what your
  environment is: ``I want to do \emph{x} in Plain \TeX{}'', or ``I
  want to do \emph{y} in \LaTeX{} running the \Class{boggle}
  class''.  If you thought you knew how, but your attempts are
  failing, tell us what you've tried: ``I've already tried installing
  the \Package{elephant} in the \Package{minicar} directory, and it
  didn't work, even after refreshing the filename database''.
\item If something's going wrong within \AllTeX{}, pretend you're
  % beware line breaks
  \nothtml{submitting a \LaTeX{} bug report (}%
  \Qref{submitting a \LaTeX{} bug report}{Q-latexbug}\nothtml{)},
  and try to generate a minimum failing example.  If your example
  needs your local \Class{xyzthesis} class, or some other resource
  not generally available, be sure to include a pointer to how the
  resource can be obtained.
\item Be as succinct as possible.  Your helpers probably don't need to
  know \emph{why} you're doing something, just \emph{what} you're
  doing and where the problem is.
\end{enumerate}

\Question[Q-tutorials]{\AllTeX{} Tutorials, etc.}

Some very fine tutorials have been written, over the years.  Michael
Doob's splendid `Gentle Introduction' to Plain \TeX{} (available on
\acro{CTAN}) has been stable for a very long time.  Another contender
in the same game is from one D. R.~Wilkins, available on the web at
\URL{http://www.ntg.nl/doc/wilkins/pllong.pdf}

More dynamic is Tobias Oetiker's `(Not so) Short Introduction to
\LaTeXe{}', which is regularly updated, as
people suggest better ways of explaining things, etc.  The
introduction is available on \acro{CTAN}, together with versions in
the some of the many languages it  has been translated into.

Harvey Greenberg's `Simplified Introduction to \LaTeX{}' was written
for a lecture course, and is also available on \acro{CTAN} (in \PS{}
only, unfortunately).

Peter Flynn's ``Beginner's \LaTeX{}'' (which also started as course
material) is a pleasing read.  A complete copy may be found on
\acro{CTAN}, but it may also be browsed over the web
(\URL{http://www.tex.ac.uk/tex-archive/info/beginlatex/html/}).

T\acro{UG} India is developing a series of online \LaTeX{} tutorials
which can be strongly recommended: select single chapters at a time
from \URL{http://www.tug.org.in/tutorials.html}~--- the set comprises
two parts, ``Text'' and ``Graphics'', so far.

An interesting (and practical) tutorial about what \emph{not} to do is
\Package{l2tabu}, or ``A list of sins of \LaTeXe{} users'' by Mark
Trettin, translated into English by J\"urgen Fenn.  The
tutorial is available from \acro{CTAN} as a \acro{PDF} file (though
the source is also available).

The \acro{AMS} publishes a ``Short Math Guide for \LaTeX{}'', which is
available (in several formats) via
\URL{http://www.ams.org/tex/short-math-guide.html}

Herbert Vo\ss{} is developing a parallel document, that is also very
useful: it's on his web site:
\URL{http://www.perce.de/LaTeX/math/Mathmode-TeX.pdf}

Keith Reckdahl's ``Using Imported Graphics in \LaTeXe{}'' is an
excellent introduction to graphics use, though it's slightly dated in
not discussing anything other than the \ProgName{dvips} route.
Available on \acro{CTAN}, but again without sources.

An invaluable step-by-step setup guide for establishing a ``work
flow'' through your \AllTeX{} system, so that output appears at the
correct size and position on standard-sized paper, and that the print
quality is satisfactory, is Mike Shell's \Package{testflow}.  The
tutorial consists of a large plain text document, and there is a
supporting \LaTeX{} file together with correct output, both in \PS{} and
\acro{PDF}, for each of \acro{A}4 and ``letter'' paper sizes.  The
complete kit is available on \acro{CTAN} (distributed with the
author's macros for papers submitted for \acro{IEEE} publications).

Reference material is somewhat more difficult to come by.  A sterling
example is set by David Bausum's
\href{http://www.tug.org/utilities/plain/cseq.html}{list of \TeX{} primitives}.

Some university departments make their local documentation available
on the web.  Most straightforwardly, there's the simple translation of
existing documentation into \acro{HTML}, for example the \acro{INFO}
documentation of the \AllTeX{} installation, of which a sample is the
\LaTeX{} documentation available at
\URL{http://www.tac.dk/cgi-bin/info2www?(latex)}

More ambitiously, some departments have enthusiastic documenters who
make public record of their \AllTeX{} support.  For example, Tim Love
(of Cambridge University Engineering Department) maintains his
deparment's excellent pages
\URL{http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/}

Another summary by command (somewhat akin to David Basum's work for
Plain \TeX{}) is to be found at
\URL{http://www.giss.nasa.gov/latex/ltx-2.html}; sadly this stuff is
woefully out of date, and only covers \LaTeXo{}.

People have long argued for \AllTeX{} books to be made available on
the web, and 
Victor Eijkhout's excellent ``\TeX{} by Topic'' (previously published
by Addison-Wesley, but long out of print) was offered in this way at
Christmas 2001.  The book is currently
available at \URL{http://www.eijkhout.net/tbt/};
it's not a beginner's tutorial but it's a fine reference
(contributions are invited, and the book is well
worth the suggested contribution).

Addison-Wesley have also released the copyright of ``\TeX{} for the
Impatient'' by Paul W.~Abrahams, Karl Berry and Kathryn A.~Hargreaves,
another book whose unavailability many have lamented.  The authors
have re-released the book under the \acro{GNU} general documentation
licence, and it is available from \acro{CTAN}.

Norm Walsh's ``Making \TeX{} Work'' is also available (free) on the
Web, at \URL{http://makingtexwork.sourceforge.net/mtw/}; the sources
of the Web page are on \acro{CTAN}.

The book was an excellent resource in its day, but is now somewhat
dated; nevertheless, it still has its uses, and is a welcome addition
to the list of on-line resources.  A project to update it is believed
to be under way.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Beginner's \LaTeX{}]\CTANref{beginlatex-pdf}
\item[\nothtml{\rmfamily}Gentle Introduction]\CTANref{gentle}
\item[l2tabu]\CTANref{l2tabuen}; source also available: \CTANref{l2tabuen.src}
\item[\nothtml{\rmfamily}Graphics in \LaTeXe{}]\CTANref{epslatex}; the
  document is also available in \PS{} format as \CTANref{epslatex_ps}
\item[\nothtml{\rmfamily}Making \TeX{} Work]\CTANref{mtw}
\item[\nothtml{\rmfamily}Not so Short Introduction]\CTANref{lshort}
  (in English, or browse for sources and other language versions at
  \CTANref{lshort-parent})
\item[\nothtml{\rmfamily}Simplified \LaTeX{}]\CTANref{simpl-latex}
\item[\nothtml{\rmfamily}\TeX{} for the Impatient]\CTANref{TftI}
\item[testflow]\CTANref{testflow}
\end{ctanrefs}

\Question[Q-pkgdoc]{Documentation of packages}

These \acro{FAQ}s regularly suggest packages that will ``solve''
particular problems.  Mostly, however, the answer doesn't provide a
detailed recipe for the job~--- how is the poor user to find out what
(exactly) to do?

If you're lucky, the package you need is already in your installation.
If you're particularly lucky, you're using a distribution that gives
access to package documentation and the documentation is available in
a form that can easily be shown.  For example, on a te\TeX{}-based
system, the \ProgName{texdoc} command is usually useful, as in:
\begin{verbatim}
  texdoc footmisc
\end{verbatim}
which opens an \ProgName{xdvi} window showing documentation of the
\Package{footmisc} package.  According to the type of file
\ProgName{texdoc} finds, it will launch \ProgName{xdvi},
\ProgName{ghostscript} or a \acro{PDF} reader.  If it can't find any
documentation, it may launch a Web browser to look at its copy of the
\acro{CTAN} catalogue.

If your luck (as defined above) doesn't hold out, you've got to find
documentation by other means.  This is where you need to exercise your
intelligence: you have to find the documentation for yourself.  What
follows offers a range of possible techniques.

The commonest form of documentation of \LaTeX{} add-ons is within the
|.dtx| file in which the code is distributed (see
\Qref[question]{documented \LaTeX{} sources}{Q-dtx}).  Such files
are supposedly processable by \LaTeX{} itself, but there are
occasional hiccups on the way to readable documentation.  Common
problems are that the package itself is needed to process its own
documentation (so must be unpacked before processing), and that the
|.dtx| file will \emph{not} in fact process with \LaTeX{}.  In the
latter case, the |.ins| file will usually produce a |.drv| (or
similarly-named) file, which you process with \LaTeX{} instead.
(Sometimes the package author even thinks to mention this wrinkle in
a package |README| file.)

Another common form is the separate documentation file; particularly
if a package is ``conceptually large'' (and therefore needs a lot of
documentation), the documentation would prove a cumbersome extension
to the |.dtx| file.  Examples of such cases are the \Class{memoir}
class (whose documentation, \File|memman|, is widely praised as an
introduction to typesetting concepts), the \Class{KOMA-script} bundle
(whose developers take the trouble to produce documentation both in
German and English), and the \Package{fancyhdr} package (whose
documentation derives from a definitive tutorial in a mathematical
journal).  Even if the documentation is not separately identified in a
|README| file, it should not be too difficult to recognise its
existence.

Documentation within the package itself is the third common form.
Such documentation ordinarily appears in comments at the head of the
file, though at least one eminent author regularly places it after the
\cs|endinput| command in the package.  (This is desirable, since
\cs|endinput| is a `logical' end-of-file, and \AllTeX{} doesn't read
beyond it: thus such documentation does not `cost' any package loading time.)

The above suggestions cover most possible ways of finding
documentation.  If, despite your best efforts, you can't find
it in any of the above places, there's the awful possibility that the
author didn't bother to document his package (on the ``if it was hard
to write, it should be hard to use'' philosophy).  Most ordinary
mortals will seek support from some more experienced user at this
stage; however, it is possible to proceed in the way that the original
author apparently expected\dots{}by reading his code.

\Question[Q-writecls]{Learning to write \LaTeX{} classes and packages}

There's nothing particularly magic about the commands you use when
writing a package, so you can simply bundle up a set of \LaTeX{}
\cs|(re)newcommand| and \cs|(re)newenvironment| commands, put them in
a file \File|package.sty| and you have a package.

However, any but the most trivial package will require rather more
sophistication.  Some details of \LaTeX{} commands for the job are to
be found in `\LaTeXe{} for class and package writers'
(\URL{http://www.tex.ac.uk/tex-archive/macros/latex/doc/html/clsguide}:
the \LaTeX{} source of this document appears in the \LaTeX{} distribution).
Beyond this, a good knowledge of \TeX{} itself is valuable.  With such
knowledge it is possible to use the documented source of \LaTeX{} as
reference material (dedicated authors will acquaint themselves with the
source as a matter of course).  A complete set of the documented
source of \LaTeX{} may be prepared by processing the file
\File|source2e.tex| in the \LaTeX{} distribution.

Writing good classes is not easy; it's a good idea to read some
established ones (\File|classes.dtx|, for example, is the documented
source of the standard classes other than \Class{Letter}, and may
itself be formatted with \LaTeX{}).  Classes that are not part of the
distribution are commonly based on ones that are, and start by loading
the standard class with \cs|LoadClass|~--- an example of this
technique may be seen in \Package{ltxguide.cls}
\begin{ctanrefs}
\item[classes.dtx]\CTANref{latex-classes}
\item[ltxguide.cls]\CTANref{ltxguide}
\item[source2e.tex]\CTANref{latex-source}
\end{ctanrefs}

\Question[Q-mfptutorials]{\MF{} and \MP{} Tutorials}

Apart from Knuth's book, there seems to be only one publicly-available
\href{http://metafont.tutorial.free.fr/}{tutorial for \MF{}}, by
Christophe Grandsire (a copy in \acro{PDF} form may be downloaded).
Geoffrey Tobin's \textit{\MF{}  for Beginners} % !! line break
(see \Qref[question]{using \MF{}}{Q-useMF}) describes how the \MF{}
system works and how to avoid some of the potential pitfalls.

There are also an article on how to run both \MF{} and \MP{} (the
programs).  Peter Wilson's % !! line break
\textit{Some Experiences in Running \MF{} and \MP{}}
offers the benefit of Peter's experience (he has designed a number of
`historical' fonts using \MF{}).  For \MF{} the article is geared
towards testing and installing new \MF{} fonts, while its \MP{}
section describes how to use \MP{} illustrations in \LaTeX{} and
\PDFLaTeX{} documents, with an emphasis on how to use appropriate
fonts for any text or mathematics.

Hans Hagen (of \CONTeXT{} fame) offers a \MP{} tutorial called
MetaFun (which admittedly concentrates on the use of \MP{} within \CONTeXT{}).  It may be found on his company's
\href{http://www.pragma-ade.com/metapost.htm}{\MP{} page}.

Other \MP{} tutorials that have appeared are one in English by % ! line breaks
\href{http://remote.science.uva.nl/~heck/Courses/mptut.pdf}{Andr\'e Heck},
and one in French (listed here because it's clearly enough written
that this author understands it), by
\href{http://pauillac.inria.fr/~cheno/metapost/metapost.pdf}{Laurent Ch\'eno};
both have been recommended for inclusion in the \acro{FAQ}

Vincent Zoonekynd's massive set of example \MP{} files is available on
\acro{CTAN}; the set includes a \ProgName{perl} script to convert the
set to html, and that set may be % beware line break
\href{http://zoonek.free.fr/LaTeX/Metapost/metapost.html}{viewed on the web}.
While these examples don't exactly constitute a ``tutorial'', they're
most certainly valuable learning material.  Urs Oswald presents a
\href{http://www.ursoswald.ch/metapost/tutorial.pdf}{similar document},
written more as a document, and presented in \acro{PDF}.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Beginners' guide]\CTANref{mf-beginners}
\item[\nothtml{\rmfamily}Peter Wilson's ``experiences'']\CTANref{metafp-ps}
  (\PS{}) or \CTANref{metafp-pdf} (\acro{PDF} format)
\item[\nothtml{\rmfamily}Vincent Zoonekynd's examples]\CTANref{zoon-mp-eg}
\end{ctanrefs}

\Question[Q-BibTeXing]{\BibTeX{} Documentation}

\BibTeX{}, a program originally designed to produce bibliographies in
conjunction with \LaTeX{}, is explained in Section~4.3 and Appendix~B
of Leslie Lamport's \LaTeX{} manual
(see \Qref[question]{TeX-related books}{Q-books}).
The document ``\BibTeX{}ing'', contained in the file \File{btxdoc.tex},
expands on the chapter in Lamport's book.  \emph{The \LaTeX{} Companion}
(see \Qref[question]{TeX-related books}{Q-books}) also
has information on \BibTeX{} and writing \BibTeX{} style files.

The document ``Designing \BibTeX{} Styles'', contained in the file
|btxhak.tex|, explains the postfix stack-based language used to write
\BibTeX{} styles (|.bst| files). The file |btxbst.doc| is the template
for the four standard styles (|plain|, |abbrv|, |alpha|, |unsrt|). It
also contains their documentation.
The complete \BibTeX{} documentation set (including the files above)
is available on \acro{CTAN}.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\BibTeX{} documentation]\CTANref{bibtex-doc}
\item[\nothtml{\rmfamily}\BibTeX{} documentation, in \acro{PDF}]%
  \CTANref{bibtex-doc-pdf}
\end{ctanrefs}

\Question[Q-symbols]{Where can I find the symbol for\dots{}}
\keywords{assignment circular integral degrees diagonal dots Fourier transform}
\keywords{Laplace greater less complex integer natural real}
\keywords{cent euro}

There is a wide range of symbols available for use with \TeX{}, most
of which are not shown (or even mentioned) in \AllTeX{} books.
\emph{The Comprehensive \LaTeX{} Symbol List} (by Scott Pakin
% beware line wrap
\emph{et al.}\@) illustrates over 2000 symbols, and details the
commands and packages needed to produce them.

Other questions in this \acro{FAQ} offer specific help on kinds of
symbols:
\begin{itemize}
\item \nothtml{Script fonts for mathematics (}%
  \Qref[question]{Script fonts for mathematics}{Q-scriptfonts}%
  \nothtml{)}
\item \nothtml{Fonts for the number sets (}%
  \Qref[question]{Fonts for the number sets}{Q-numbersets}%
  \nothtml{)}
\item \nothtml{Typesetting the principal value integral (}%
  \Qref[question]{Typesetting the principal value integral}{Q-prinvalint}%
  \nothtml{)}
\end{itemize}
\begin{ctanrefs}
\item[Symbol List]Browse \CTANref{symbols}; there are processed
  versions in both \PS{} and \acro{PDF} forms for both A4 and
  letter paper.
\end{ctanrefs}

\Question[Q-docpictex]{The \PiCTeX{} manual}

\PiCTeX{} is a set of macros by Michael Wichura for drawing diagrams
and pictures. The
macros are freely available; however, the
\PiCTeX{} manual itself is not free.
Unfortunately, \acro{TUG} is no longer able to supply copies of the
manual (as it once did), and it is now available only through Personal
\TeX{} Inc, the vendors of PC\TeX{} (\URL{http://www.pctex.com/}).  The
manual is \emph{not} available electronically.
\begin{ctanrefs}
\item[pictex]\CTANref{pictex}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Bits and pieces of \TeX{}}

\Question[Q-dvi]{What is a \acro{DVI} file?}

A \acro{DVI} file (that is, a file with the type or extension |.dvi|) is
\TeX{}'s main output file, using \TeX{} in its broadest sense to
include \LaTeX{}, etc.  `\acro{DVI}' is supposed to be an acronym for
\acro{D}e\acro{V}ice-\acro{I}ndependent, meaning that the file can be
printed on almost any
kind of typographic output device.  The \acro{DVI} file is designed to be
read by a driver (\Qref{DVI drivers}{Q-driver}) to produce
further output designed specifically for a particular printer (e.g., a
LaserJet) or to be used as input to a previewer for display on a
computer screen.  \acro{DVI} files use \TeX{}'s internal coding; a \TeX{}
input file should produce the same \acro{DVI} file regardless of which
implementation of \TeX{} is used to produce it.

A \acro{DVI} file contains all the information that is needed for printing 
or previewing except for the actual bitmaps or outlines of fonts, and 
possibly material to be introduced by means of
\htmlignore
\cs|special| commands (\Qref{}{Q-specials}).
\endhtmlignore
\begin{htmlversion}
  \Qref{\cs|special| commands}{Q-specials}.
\end{htmlversion}

The canonical reference for the structure of a \acro{DVI} file is the
source of \ProgName{dvitype}.
\begin{ctanrefs}
\item[dvitype]\CTANref{dvitype}
\end{ctanrefs}

\Question[Q-driver]{What is a driver?}

A driver is a program that takes as input a \acro{DVI} file
(\Qref{\acro{DVI} files}{Q-dvi})  and
(usually) produces a file that can be sent to a typographic
output device, called a printer for short.

A driver will usually be specific to a particular printer,
although any \PS{} printer ought to be able to print
the output from a \PS{} driver.
% (these are also called \PS{} conversion programs).

As well as the \acro{DVI} file, the driver needs font information.
Font information may be held as bitmaps or as outlines, or simply as a
set of pointers into the fonts that the printer itself `has'.
Each driver will expect the font information in
a particular form.  For more information on the forms of fonts,
see \Qref[questions]{|pk| files}{Q-pk},
% beware of fill-paragraph here!!!!
\Qref[]{|tfm| files}{Q-tfm},
\Qref[]{virtual fonts}{Q-virtualfonts}
and \Qref[]{Using \PS{} fonts with \TeX{}}{Q-usepsfont}.


\Question[Q-pk]{What are \acro{PK} files?}

\acro{PK} files (packed raster) contain font bitmaps. The output
from
\htmlignore
\MF{} (\Qref{}{Q-useMF})
\endhtmlignore
\begin{htmlversion}
  \Qref{\MF{}}{Q-useMF}
\end{htmlversion}
includes a generic font (\acro{GF}) file and the
utility \ProgName{gftopk} produces the \acro{PK} file from that.
There are a lot of \acro{PK} files, as one is needed for each font,
that is each magnification (size) of each design (point) size for each
weight for each family.  Further, since the \acro{PK} files for one printer
do not necessarily work well for another, the whole set needs to be
duplicated for each printer type at a site.  As a result, they are
often held in an elaborate directory structure, or in `font library
files', to regularise access.


\Question[Q-tfm]{What are \acro{TFM} files?}

\acro{TFM} stands for \TeX{} font metrics, and \acro{TFM} files hold
information about the sizes of the characters of the font in question,
and about ligatures and kerns within that font.  One \acro{TFM} file is
needed for each font used by \TeX{}, that is for each design (point)
size for each weight for each family; one \acro{TFM} file serves for all
magnifications, so that there are (typically) fewer \acro{TFM} files than
there are \acro{PK} files.  The important point is that \acro{TFM} files are
used by \TeX{} (\LaTeX{}, etc.), but are not, generally, needed by the
printer driver.


\Question[Q-virtualfonts]{Virtual fonts}

Virtual fonts for \TeX{} were first implemented by David Fuchs in the
early days of \TeX{}, but for most people they date from when Knuth
redefined the format, and wrote some support software, in 1989 (he
published an article in \textsl{TUGboat} at the time, and a copy is
available on \acro{CTAN}).
Virtual fonts provide a way of telling \TeX{} about something more
complicated than just a one-to-one character mapping. The entities you
define in a virtual font look like characters to \TeX{} (they appear
with their sizes in a font metric file), but the \acro{DVI} processor may
expand them to something quite different. You can use this facility
just to remap characters, to make a composite font with glyphs drawn
from several sources, or to build up an effect in arbitrarily
complicated ways~--- a virtual font may contain anything which is
legal in a \acro{DVI} file.
In practice, the most common use of virtual fonts is to remap
\PS{} fonts (see \Qref[question]{font metrics}{Q-metrics}) or to
build `fake' maths fonts.

It is important to realise that \TeX{} itself does \emph{not} see
virtual fonts; for every virtual font read by the \acro{DVI} driver there
is a corresponding \acro{TFM} file read by \TeX{}. Virtual fonts are normally
created in a single \acro{ASCII} |vpl| (Virtual Property List) file, which
includes both sets of information. The \ProgName{vptovf} program is
then used to the create the binary \acro{TFM} and \acro{VF} files.  The
commonest way (nowadays) of generating |vpl| files is to use the
\ProgName{fontinst} package, which is described in detail
\htmlonly{together with the }%
\Qref[in question]{discussion of \PS{} font metrics}{Q-metrics}.
\Package{qdtexvpl} is another utility for creating ad-hoc virtual
fonts.
\begin{ctanrefs}
\item[fontinst]\CTANref{fontinst}
\item[\nothtml{\rmfamily}Knuth on virtual fonts]\CTANref{vf-knuth}
\item[qdtexvpl]\CTANref{qdtexvpl}
\end{ctanrefs}

\Question[Q-specials]{\cs|special| commands}

\TeX{} provides the means to express things that device drivers can
do, but about which \TeX{} itself knows nothing.  For example, \TeX{}
itself knows nothing about how to include \PS{} figures into
documents, or how to set the colour of printed text; but some device
drivers do.

Such things are introduced to your document by means of |\special|
commands; all that \TeX{} does with these commands is to expand their
arguments and then pass the command to the \acro{DVI} file.  In most
cases, there are macro packages provided (often with the driver) that
provide a comprehensible interface to the |\special|; for example,
there's little point including a figure if you leave no gap for it in
your text, and changing colour proves to be a particularly fraught
operation that requires real wizardry. \LaTeXe{}
has standard graphics and colour packages that make figure inclusion,
rotation and scaling, and colour typesetting via |\special|s all easy.

The allowable arguments of |\special| depend on the device driver
you're using.  Apart from the examples above, there are |\special|
commands in the em\TeX{} drivers (e.g., \ProgName{dvihplj}, \ProgName{dviscr},
\emph{etc}.)~that will draw lines at arbitrary orientations, and
commands in \ProgName{dvitoln03} that permit the page to be set in
landscape orientation.

\Question[Q-dtx]{Documented \LaTeX{} sources (\texttt{.dtx} files)}

\LaTeXe{}, and many support macro packages, are now written in a
\nothtml{literate programming style (}% beware line break
\Qref{literate programming}{Q-lit}\latexhtml{)}{ style},
with source and documentation in the
same file.  This format, known as `doc', in fact originated before the
days of the \LaTeX{} project as one of the ``Mainz'' series of
packages. The documented sources conventionally have the suffix
\texttt{.dtx}, and should normally be stripped of documentation
before use with \LaTeX{}.  Alternatively you can run \LaTeX{} on a
\texttt{.dtx} file to produce a nicely formatted version of the
documented code. An installation script (with suffix
\texttt{.ins}) is usually provided, which needs the standard \LaTeXe{}
\ProgName{docstrip} package (among other things, the installation
process strips all the comments that make up the documentation for
speed when loading the file into a running \LaTeX{} system).  Several
packages can be included in one \texttt{.dtx} file, with conditional
sections, and there facilities for indices of macros etc.  Anyone can
write \texttt{.dtx} files; the format is explained in
\emph{The \LaTeX{} Companion}
% beware line break
(see \Qref[question]{books on \TeX{}}{Q-books}), and a tutorial is
available from \acro{CTAN} (together with skeleton \texttt{.dtx} and
\texttt{.ins} files).  There are no programs yet to assist in
composition of \texttt{.dtx} files.

\texttt{.dtx} files are not used by \LaTeX{} after they have been
processed to produce \texttt{.sty} or \texttt{.cls} (or whatever)
files.  They need not be kept with the working system; however, for
many packages the \texttt{.dtx} file is the primary source of
documentation, so you may want to keep \texttt{.dtx} files elsewhere.

An interesting sideline to the story of \texttt{.dtx} files is the
\Package{docmfp} package, which extends the model of the \Package{doc}
package to \latexhtml{\MF{}}{\Qref{\MF{}}{Q-MF}} and % beware line break
\latexhtml{\MP{} (\Qref[see questions]{}{Q-MF} and\Qref[]{}{Q-MP})}{\Qref{\MP{}}{Q-MP}},
thus permitting documented distribution of bundles containing code for
\MF{} and \MP{} together with related \LaTeX{} code.
\begin{ctanrefs}
\item[docmfp.sty]\CTANref{docmfp}
\item[DTX tutorial]\CTANref{dtxtut}
\end{ctanrefs}

\Question[Q-whatenc]{What are encodings?}

Let's start by defining two concepts, the \emph{character} and the
\emph{glyph}.
The character is the abstract idea of the `atom' of a
language or other dialogue: so it might be a letter in an alphabetic
language, a syllable in a syllabic language, or an ideogram in an
ideographic language.  The glyph is the mark created on screen or
paper which represents a character.  Of
course, if reading is to be possible, there must be some agreed
relationship between the glyph and the character, so while the precise
shape of the glyph can be affected by many other factors, such as the
capabilities of the writing medium and the designer's style, the
essence of the underlying character must be retained.

Whenever a computer has to represent characters, someone has to define
the relationship between a set of numbers and the characters they
represent.  This is the essence of an encoding: it is a mapping
between a set of numbers and a set of things to be represented.

\TeX{} of course deals in encoded characters all the time: the
characters presented to it in its input are encoded, and it emits
encoded characters in its \acro{DVI} (or \acro{PDF}) output.  These
encodings have rather different properties.

The \TeX{} input stream was pretty unruly back in the days when Knuth
first implemented the language.  Knuth himself prepared documents on
terminals that produced all sorts of odd characters, and as a result
\TeX{} contains some provision for translating the input encoding to
something regular.  Nowadays, 
the operating system translates keystrokes into a code appropriate for
the user's language: the encoding used is often a national or
international standard, though many operating systems use ``code
pages'' defined by MicroSoft.  These standards and code pages often
contain characters that can't appear in the \TeX{} system's input
stream.  Somehow, these characters have to be dealt with~--- so
an input character like ``\'e'' needs to be interpreted by \TeX{} in
a way that that at least mimics the way it interprets ``|\'||e|''.  

The \TeX{} output stream is in a somewhat different situation:
characters in it are to be used to select glyphs from the fonts to be
used.  Thus the encoding of the output stream is notionally a font
encoding (though the font in question may be a
% beware line break (twice)
\nothtml{virtual one~--- see }%
\Qref[question]{virtual font}{Q-virtualfonts}).  In principle, a
fair bit of what appears in the output stream could be direct
transcription of what arrived in the input, but the output stream
also contains the product of commands in the input, and translations
of the input such as ligatures like |fi|%
\nothtml{\ensuremath\Rightarrow``fi''}.

Font encodings became a hot topic when the
\nothtml{Cork encoding (}\Qref{Cork encoding}{Q-ECfonts}\nothtml{)}
appeared, because of the possibility of suppressing
\cs|accent| commands in the output stream (and hence improving the
quality of the hyphenation of text in inflected languages, which is
interrupted by the \cs|accent| commands~--- see
% beware line break
\Qref[question]{``how does hyphenation work''}{Q-hyphen}).
To take advantage of the diacriticised characters represented in the
fonts, it is necessary to arrange that whenever the
command sequence ``|\'||e|'' has been input
(explicitly, or implicitly via the sort of mapping of input mentioned
above), the character that codes the position of the ``\'e'' glyph is
used.

Thus we could have the odd arrangement that the diacriticised character in
the \TeX{} input stream is translated into \TeX{} commands that would
generate something looking like the input character; this sequence of
\TeX{} commands is then translated back again into a single
diacriticised glyph as the output is created.  This is in fact
precisely what the \LaTeX{} packages \Package{inputenc} and
\Package{fontenc} do, if operated in tandem on (most) characters in
the \acro{ISO}~Latin-1 input encoding and the \acro{T}1 font encoding.
At first sight, it seems eccentric to have the first package do a thing, and
the second precisely undo it, but it doesn't always happen that way:
most font encodings can't match the corresponding input encoding
nearly so well, and the two packages provide the sort of symmetry the
\LaTeX{} system needs.

\Question[Q-hyphen]{How does hyphenation work in \TeX{}?}

Everyone knows what hyphenation is: we see it in most books we read,
and (if we're alert) often spot ridiculous mis-hyphenation from time
to time (at one time, British newspapers were a fertile source).

Hyphenation styles are culturally-determined, and the same language
may be hyphenated differently in different countries~--- for example,
British and American styles of hyphenation of English are very
different.  As a result, a typesetting system that is not restricted
to a single language at a single locale needs to be able to change its
hyphenation rules from time to time.

\TeX{} uses a pretty good system for hyphenation (originally designed
by Frank Liang), and while it's capable of missing ``sensible''
hyphenation points, it seldom selects grossly wrong ones.  The
algorithm matches candidates for hyphenation against a set of
``hyphenation patterns''.  The candidates for hyphenation must be
sequences of letters (or other single characters that \TeX{} may be
persuaded to think of as letters)~--- things such as \TeX{}'s
\cs|accent| primitive interrupt hyphenation.

Sets of hyphenation patterns are usually derived from analysis of
a list of valid hyphenations (the process of derivation, using a tool
called \Package{patgen}, is not ordinarily a participatory sport).

The patterns for the languages a \TeX{} system is going to deal with
may only be loaded when the system is installed.  To change the set of
languages, a
\begin{htmlversion}
  \Qref{partial reinstallation}{Q-newlang}
\end{htmlversion}
\htmlignore
  partial reinstallation (\Qref{}{Q-newlang})
\endhtmlignore
is necessary.

\TeX{} provides two ``user-level'' commands for control of
hyphenation: \cs|language| (which selects a hyphenation style), and
\cs|hyphenation| (which gives explicit instructions to the hyphenation
engine, overriding the effect of the patterns).

The ordinary \LaTeX{} user need not worry about \cs|language|, since
it is very thoroughly managed by the \Package{babel} package; use of
\cs|hyphenation| is discussed in
% beware line wrap
\Qref[question]{hyphenation failure}{Q-nohyph}.

\Question[Q-ECfonts]{What are the \acro{EC} fonts?}

A font consists of a number of \emph{glyphs}.  In order that the
glyphs may be printed, they are \nothtml{\emph{encoded} (see}
\Qref[question]{\emph{encoded}}{Q-whatenc}\nothtml{)}, and the
encoding is used as an index into tables within the font.  For
various reasons, Knuth chose deeply eccentric encodings for his
Computer Modern family of fonts; in
particular, he chose different encodings for different fonts, so that
the application using the fonts has to remember which font of the
family it's using before selecting a particular glyph.

When \TeX{} version 3 arrived, most of the excuses for the
eccentricity of Knuth's encodings went away, and at \acro{TUG}'s Cork
meeting, an encoding for a set of 256 glyphs, for use in \TeX{} text,
was defined.  The intention was that these glyphs should cover `most'
European languages that use Latin alphabets, in the sense of including
all accented letters needed.  (Knuth's \acro{CMR} fonts missed things
necessary for Icelandic and Polish, for example, but the Cork
fonts have them.  Even Cork's coverage isn't complete: it misses
letters from Romanian, Eastern and Northern Sami, and Welsh, at
least.  The Cork encoding does contain ``\acro{NG}'' glyphs that
allows it to support Southern Sami.)  \LaTeX{} refers to the
Cork encoding as \acro{T}1, and
provides the means to use fonts thus encoded to avoid problems with
the interaction of accents and hyphenation
% beware!!!  fill-paragraph!!!
(see \Qref[question]{hyphenation of accented words}{Q-hyphenaccents}).
% beware!!!  fill-paragraph!!!

The only \MF{}-fonts that conform to the Cork encoding are the
\acro{EC} fonts.  They look \acro{CM}-like, though their metrics
differ from \acro{CM}-font metrics in several areas.  The fonts are
now regarded as `stable' (in the same sense that the \acro{CM} fonts
are stable: their metrics are unlikely ever to change).  Their serious
disadvantages for the casual user are their size (each \acro{EC} font
is roughly twice the size of the corresponding \acro{CM} font), and
there are far more of them than there are \acro{CM} fonts.  The simple
number of fonts has acted as a disincentive to the production of Adobe
Type~1 versions of the fonts,, but several commercial suppliers offer
\acro{EC} or
\acro{EC}-equivalent fonts in type~1 or TrueType form~--- see
% beware line fill
\Qref[question]{commercial suppliers}{Q-commercial}, and free
\htmlonly{\Qref{auto-traced versions}{Q-textrace}} are
available\nothtml{ (\Qref{ }{Q-textrace})}.
What's more, until corresponding fonts for mathematics are produced,
the \acro{CM} fonts must be retained because some mathematical symbols
are drawn from text fonts in the \acro{CM} encodings.

The \acro{EC} fonts are distributed with a
set of `Text Companion' (\acro{TC}) fonts that provide glyphs for
symbols commonly used in text.  The \acro{TC} fonts are encoded
according to the \LaTeX{} \acro{TS}1 encoding, and are not viewed as
`stable' in the same way as are the \acro{EC} fonts are.

The Cork encoding is also implemented by virtual fonts provided in the
\htmlignore
\acro{PSNFSS} system (\Qref{}{Q-usepsfont}),
\endhtmlignore
\begin{htmlversion}
  \Qref{\acro{PSNFSS} system}{Q-usepsfont},
\end{htmlversion}
for \PS{} fonts, and also by the \Package{txfonts} and
\Package{pxfonts} font packages
% beware line wrap
(see \Qref[question]{``choice of scalable fonts''}{Q-psfchoice}).
\begin{ctanrefs}
\item[EC and TC fonts]\CTANref{ec}
\end{ctanrefs}

\Question[Q-tds]{What is the \acro{TDS}?}

    \acro{TDS} stands for the \TeX{} Directory Structure, which is a standard
way of organising all the \TeX{}-related files on a computer system. 

    Most modern distributions conform to the \acro{TDS}, which
provides for both a `standard' and a (set of) `local' hierarchies of
directories containing \TeX{}-related files. The
\acro{TDS} reserves the name |texmf| as the name of the root directory
(folder) of the hierarchies.  Files supplied as part of the
distribution are put into the standard hierarchy. The location of the
standard hierarchy is system dependent, but on a Unix system it might
be at 
\path|/usr/local/texmf|, or
\path|/usr/local/share/texmf|, or
\path|/opt/texmf|, or
a similar location, but in each case the \TeX{} files will be under the 
\path|/texmf| subdirectory. 

There may be more than on `local' hierarchy in which additional files
can be stored. In the extreme an installation can have a local
hierarchy and each user can also have an individual local hierarchy. The
location of any local hierarchy is not only system dependent but also user
dependent. Again, though, all files should be put under a local \path|/texmf|
directory.

The \acro{TDS} is published as the output of a \acro{TUG} % beware line wrap
\nothtml{Technical Working Group (}%
\Qref{Technical Working Group}{Q-TUG*}\nothtml{)}.
You may browse an \href{http://tug.org/tds/}{on-line version} of the
standard, and copies in several other formats (including source) are
available on \acro{CTAN}.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\acro{TDS} specification]\CTANref{tds}
\end{ctanrefs}

\Question[Q-eps]{What is ``Encapsulated \PS{}''}

\PS{} has over the years become a \emph{lingua franca} of
powerful printers; since \PS{} is also a powerful graphical
programming language, it is commonly used as an output medium for
drawing (and other) packages.

However, since \PS{} \emph{is} such a powerful language, some
rules need to be imposed, so that the output drawing may be included
in a document as a figure without ``leaking'' (and thereby destroying
the surrounding document, or failing to draw at all).

Appendix \acro{H} of the \PS{} Language Reference Manual (second
and subsequent editions), specifies a set of rules for \PS{} to
be used as figures in this way.  The important features are:
\begin{itemize}
\item certain ``structured comments'' are required; important ones are
  the identification of the file type, and information about the
  ``bounding box'' of the figure (i.e., the minimum rectangle
  enclosing it);
\item some commands are forbidden~--- for example, a |showpage|
  command will cause the image to disappear, in most \TeX{}-output
  environments; and
\item ``preview information'' is permitted, for the benefit of things
  such as word processors that don't have the ability to draw
  \PS{} in their own right~--- this preview information may be in
  any one of a number of system-specific formats, and any viewing
  program may choose to ignore it.
\end{itemize}
A \PS{} figure that conforms to these rules is said to be in
``Encapsulated \PS{}'' format.  Most \AllTeX{} packages for
including \PS{} are structured to use Encapsulated \PS{};
which of course leads to much hilarity as exasperated \AllTeX{} users
struggle to cope with the output of drawing software whose authors
don't know the rules.

\Question[Q-adobetypen]{Adobe font formats}
\keywords{type1 type3}

Adobe has specified a number of formats for files to represent fonts
in \PS{} files; this question doesn't attempt to be encyclopaedic, but
we'll discuss the two formats most commonly encountered in the
\AllTeX{} context, types~1 and 3.

Adobe Type~1 format specifies a means to represent outlines of the glyphs
in a font.  The `language' used is closely restricted, to ensure that
the font is rendered as quickly as possible.  (Or rather, as quickly
as possible with Adobe's technology at the time the specification was
written: the structure could well be different if it were specified
now.)  The format has long been the basis of the digital type-foundry
business, though things are showing signs of change.

Type~1 fonts are directly supported by some operating system software,
and at least one \TeX{} system, the commercial
\nothtml{\YandY{} system (}% beware line wrap
\Qref{\YandY{} system}{Q-commercial}\nothtml{)}, bases its entire
operation on the use of Type~1 fonts.

In the \AllTeX{} context, Type~1 fonts are extremely important even if
you're not using \YandY{}~\TeX{}.  Apart from their simple
availability (there are thousands of commercial fonts around), the
commonest reader for \acro{PDF} files effectively \emph{insists} on
their use (see \Qref[question]{\acro{PDF} quality}{Q-dvips-pdf}).

Type~3 fonts have a more forgiving specification.  A wide range of
\PS{} operators is permissible, including bitmaps operators.  Type~3
is therefore the natural format to be used for programs such as
\ProgName{dvips} when they auto-generate something to represent
\MF{}-generated fonts in a \PS{} file.  It's Adobe Acrobat Viewer's
treatment of bitmap Type~3 fonts that has made direct \MF{} output
inreasingly unattractive, in recent years.  If you have a \acro{PDF}
document in which the text looks fuzzy and uneven in Acrobat Reader,
ask Reader for the \texttt{File}\arrowhyph{}%
\texttt{Document Properties}\arrowhyph{}%
\texttt{Fonts ...}, and it will show some font or other as ``Type~3''
(usually with encoding ``Custom'').

Type~3 fonts should not entirely be dismissed, however.  Acrobat
Reader's failure with them is entirely derived from its failure to use
the anti-aliasing techniques common in \TeX{}-ware.  Choose a
different set of \PS{} graphical operators, and you can make pleasing
Type~3 fonts that don't ``annoy'' Reader.  For example, you may not
change colour within a Type~1 font glyph, but there's no such
restriction on a Type~3 font, which opens opportunities for some
startling effects.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Acquiring the Software}

\Question[Q-archives]{Repositories of \TeX{} material}

To aid the archiving and retrieval of of \TeX{}-related files, a
\acro{TUG} working group developed the Comprehensive \TeX{} Archive
Network (\acro{CTAN}).  Each \acro{CTAN} site has identical material,
and maintains authoritative versions of its material.  These
collections are extensive; in particular, almost everything mentioned
in this \acro{FAQ}
is archived at the \acro{CTAN} sites (see the lists of software at the
end of each answer).

The \acro{CTAN} sites are currently \FTP|dante.ctan.org| (Mainz, Germany),
\FTP|cam.ctan.org| (Cambridge, UK) and \FTP|tug.ctan.org| (Colchester,
Vermont, USA).
The organisation of \TeX{} files on all
\acro{CTAN} sites is identical and starts at
\path|tex-archive/|.  Each \acro{CTAN} node may also be accessed via
the Web at \acro{URL}s \URL{http://www.dante.de/tex-archive},
\URL{http://www.tex.ac.uk/tex-archive} and
\URL{http://www.ctan.org/tex-archive} respectively; not all
\acro{CTAN} mirrors are Web-accessible.
As a matter of course, to reduce network load,
please use the \acro{CTAN} site
or mirror closest to you.  A complete and current list of \acro{CTAN} sites
and known mirrors may be obtained by using the \ProgName{finger} utility on
`user' \Email{ctan@cam.ctan.org}, \Email{ctan@dante.ctan.org} or
\Email{ctan@tug.ctan.org}; it is
also available as file \CTANref{CTAN-sites} on the archives themselves.

For details of how to find files at \acro{CTAN} sites, see
\Qref[questions]{finding files via |ftp|}{Q-siteindex}
\htmlignore
  (searching by |ftp|) \Qref[and]{}{Q-websearch}
  (Web searching).
\endhtmlignore
\begin{htmlversion}
  and \Qref{finding files via Web search}{Q-websearch}.
\end{htmlversion}

The email servers \mailto|ftpmail@dante.ctan.org| and
\mailto|ftpmail@tug.ctan.org| provide an |ftp|-like
interface through mail.  Send a message containing just the line
`|help|' to your nearest server, for details of use.

The \TeX{} user who has no access to any sort of
network may buy a copy of the archive on \CDROM{} (see
\Qref[question]{\TeX{} \CDROM{}s}{Q-CD}).

\Question[Q-nonfree]{What's the \acro{CTAN} \texttt{nonfree} tree?}

The \acro{CTAN} archives are currently restructuring their holdings
so that files that are `not free' are held in a separate tree.  The
definition of what is `free' (for this purpose) is influenced by, but
not exactly the same as the 
\htmlignore
\ifpdf
\href{http://www.debian.org/social_contract#guidelines}%
     {Debian Free Software Guidelines (\acro{DFSG})}.
\else
Debian Free Software Guidelines (\acro{DFSG}: see
\URL{http://www.debian.org/social_contract#guidelines}).
\fi
\endhtmlignore
\begin{htmlversion}
% don't let the line wrap...
\href{http://www.debian.org/social_contract#guidelines}{Debian Free Software Guidelines (\acro{DFSG})}.
\end{htmlversion}

Material is placed on the \texttt{nonfree} tree if it is not
freely-usable (e.g., if the material is shareware, commercial, or if
its usage is not permitted in certain domains at all, or without
payment).  Users of the archive should check that they are entitled to
use material they have retrieved from the \texttt{nonfree} tree.

The Catalogue (one of the prime sources for finding \TeX{}-related
material via \nothtml{web search~--- }%
\Qref{web search}{Q-websearch}) lists the licence details in each
entry in its lists.
%
%% in the previous version, the sentence was interrupted at "provides";
%% i'm not sure what was originally intended (the continuation was
%% typed on autopilot before being reviewed in context.
%   The catalogue also provides short descriptions of
% all packages, most often provided by the authors when the packages
% were submitted to \acro{CTAN} in the first place.
For details of the licence categories, see its
\htmlignore
\ifpdf
\href{http://www.tex.ac.uk/tex-archive/help/Catalogue/licenses.html}%
     {list of licences}.
\else
list of licences~--- see
\URL{http://www.tex.ac.uk/tex-archive/help/Catalogue/licenses.html}
\fi
\endhtmlignore
\begin{htmlversion}
\href{http://www.tex.ac.uk/tex-archive/help/Catalogue/licenses.html}{list of licences}.
\end{htmlversion}

\Question[Q-uploads]{Contributing a file to the archives}

If you are able to use anonymous |ftp|, get yourself a copy of
the file \File|README.uploads| from any
\nothtml{\acro{CTAN} archive (}%
\Qref{\acro{CTAN} archive}{Q-archives}\nothtml{)}.  The file tells you
where to upload, what to upload, and how to notify the \acro{CTAN}
management about what you want doing with your upload.

You may also upload via the Web: each of the principle \acro{CTAN}
sites offers an upload page~--- choose from
\URL{http://www.ctan.org/upload.html},
\URL{http://www.dante.de/CTAN/upload.html} or
\URL{http://www.tex.ac.uk/upload.html}; the pages lead you through the
process, showing you the information you need to supply.

If you can use neither of these methods, ask advice of the
\htmlignore
\ifpdf
  \href{mailto:ctan@dante.de}{\acro{CTAN} management}:
\else
  \acro{CTAN} management (\mailto|ctan@dante.de|):
\fi
\endhtmlignore
\begin{htmlversion}
  \href{mailto:ctan@dante.de}{\acro{CTAN} management}:
\end{htmlversion}
if the worst comes to the worst, it may be possible to mail a contribution.
  
You will make
everyone's life easier if you choose a descriptive and unique name for
your submission.  Descriptiveness is in the eye of the beholder, but
do try and be reasonable; and it's probably a good idea to check that
your chosen name is not already in use by browsing the archive 
% beware line wraps, next two lines
(\htmlonly{see }\Qref{finding files via ftp}{Q-siteindex}), or the Catalogue
(\htmlonly{see }\Qref{finding files via the web}{Q-websearch}).

If it's appropriate (if your package is large, or regularly updated),
the \acro{CTAN} management can arrange to \ProgName{mirror} your
contribution direct into the archive.  At present this may only be
done if your contribution is available via |ftp|, and of course the
directory structure on your archive must `fit'.
\begin{ctanrefs}
\item[README.uploads]\CTANref{CTAN-uploads}
\end{ctanrefs}

\Question[Q-findpkg]{Finding \AllTeX{} macro packages}

Before you ask for a \TeX{} macro or \LaTeX{} class or package file to
do something, try searching Graham Williams'
%(\Email|Graham.Williams@dit.csiro.au|)
catalogue.  You can also
% beware line wrap
\nothtml{search the catalogue over the web (}%
\Qref{search the catalogue over the web}{Q-websearch}\nothtml{)}.

If you have learnt of a file, by some other means,
that seems interesting, search a \acro{CTAN} archive for it (see 
\Qref[question]{finding files on CTAN}{Q-siteindex}). For packages
listed in 
% beware line break
\nothtml{\emph{The \LaTeX{} Companion} (}%
\Qref{\emph{The \LaTeX{} Companion}}{Q-books}\nothtml{)}
the file  may be consulted as an alternative to
searching the archive's index. It lists the current location in the archive of
such files.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Graham Williams' catalogue]\CTANref{catalogue}
\item[companion.ctan]\CTANref{compan-ctan}
\end{ctanrefs}

\Question[Q-siteindex]{Finding files in the \acro{CTAN} archives}

To find software at a \acro{CTAN} site, you can use anonymous |ftp| to
the host with the command `\texttt{quote site index <term>}', or the
searching script at \URL{http://www.dante.de/cgi-bin/ctan-index}

To get the best use out of the |ftp| facility you should remember that
\texttt{<term>} is a \emph{Regular Expression} and not a fixed string,
and also that many files are distributed
in source form with an extension different to the final file. (For
example \LaTeX{} packages are often distributed sources with extension
|dtx| rather than as package files with extension |sty|.)

One should make the regular expresion general enough to find the file
you are looking for, but not too general, as the |ftp| interface will
only return the first 20 lines that match your request.

The following examples illustrate these points.
To search for the \LaTeX{} package `|caption|',
you might use the command:
\begin{verbatim}
  quote site index caption.sty
\end{verbatim}
but it will fail to find the desired package (which is
distributed as |caption.dtx|) and does return unwanted `hits' (such as 
|hangcaption.sty|).  Also, although this example does not show it the
`|.|' in `|caption.sty|' is used as the regular expression that
matches \emph{any} character.
So
\begin{verbatim}
  quote site index doc.sty
\end{verbatim}
matches such unwanted files as
\path|language/swedish/slatex/doc2sty/makefile|

Of course if you \emph{know} the package is stored as |.dtx| you can
search for that name, but in general you may not know the extension
used on the archive.
The solution is to add `|/|' to the front of the package name and
`|\\.| to the end. This will then search for a file name that consists
solely of the package name between the directory separator and the
extension. The two commands:
\begin{verbatim}
  quote site index /caption\\.
  quote site index /doc\\.
\end{verbatim}
do narrow the search down sufficiently. (In the case of doc, a few
extra files are found, but the list returned is sufficiently small to
be easily inspected.)

If the search string is too wide and too many files would match, the
list will be truncated to the first 20 items found. Using some
knowledge of the \acro{CTAN} directory tree you can usually narrow the search
sufficiently. As an example suppose you wanted to find a copy of the
|dvips| driver for \MSDOS{}. You might use the command:
\begin{verbatim}
  quote site index dvips
\end{verbatim}
but the result would be a truncated list, not including the file you
want. (If this list were not truncated 412 items would be returned!)
However we can restrict the search to \MSDOS{} related drivers as
follows.
\begin{verbatim}
  quote site index msdos.*dvips
\end{verbatim}
Which just returns relevant lines such as
\path|systems/msdos/dviware/dvips/dvips5528.zip|

A basic introduction to searching with regular expressions is:
\begin{itemize}
\htmlignore
\itemsep=0.25\itemsep
\endhtmlignore
\item Most characters match themselves, so |"a"| matches |"a"| etc.;
\item |"."|  matches any character;
\item |"[abcD-F]"| matches any single character from the set 
      |{"a"|,|"b"|,|"c"|,|"D"|,|"E"|,|"F"}|;
\item |"*"| placed after an expression matches zero or more occurrences
          so |"a*"| matches |"a"| and |"aaaa"|, and |"[a-zA-Z]*"| matches a
      `word';
\item |"\"| `quotes' a special character such as |"."| so |"\."| just
      matches |"."|;
\item |"^"| matches the beginning of a line;
\item |"$"| matches the end of a line.
\end{itemize}

For technical reasons in the quote site index command, you need to
`double' any |\| hence the string |/caption||\|\cs|.| in the above example.
The quote site command ignores the case of letters.  Searching for
|caption| or |CAPTION| would produce the same result.

\Question[Q-websearch]{Finding files by Web search}

Two of the \acro{CTAN} web servers offer a search facility:
\URL{http://www.tex.ac.uk/search} and
\URL{http://www.ctan.org/search}; you can look for a file whose name
you already know
\begin{htmlversion}
  (in pretty much the same way as the
  \Qref{|ftp|-based |quote site index| command}{Q-siteindex}),
\end{htmlversion}
\htmlignore
  (in pretty much the same way as the
  |ftp|-based |quote site index| command~--- \Qref{}{Q-siteindex}),
\endhtmlignore
or you can do a keyword-based search of the
catalogue.

The search script produces \acro{URL}s for files that match your
search criteria.  The \acro{URL}s point to the \acro{CTAN} site or
mirror of your choice; when you first use the script, it asks you to
choose a site, and stores its details
in a cookie on your machine.  Choose a site that is close
to you, to reduce network load.

The Catalogue, which the search script uses, may be browsed
independently: it's actually kept within the archive itself: to browse
it, visit \URL{http://www.ctan.org/tex-archive/help/Catalogue/},
\URL{http://www.dante.de/tex-archive/help/Catalogue/} or
\URL{http://www.tex.ac.uk/tex-archive/help/Catalogue/}
\begin{ctanrefs}
\item[Catalogue]\CTANref{Catalogue} (this is a very large directory
  tree: browsing, rather than downloading the whole tree, is encouraged)
\end{ctanrefs}

\Question[Q-findfont]{Finding new fonts}

A comprehensive list of \MF{} fonts used to be posted to
\Newsgroup|comp.fonts| and to \Newsgroup|comp.text.tex|, roughly
every six weeks, by Lee Quin. % (\Email|lee@sq.sq.com|)

%The list contains details both of commercial fonts and of fonts
%available via anonymous |ftp|. Most of the fonts are available via
%anonymous |ftp| from the \acro{CTAN} archives
%(see \Qref[question]{sources of software}{Q-archives}).

Nowadays, authors of new material in \MF{} are few and far between
(and mostly designing highly specialised things with limited appeal to
ordinary users).  Most new fonts that appear are prepared in some
scalable outline form or other (see
\Qref[question]{``choice of scalable fonts''}{Q-psfchoice}), and they
are almost all distributed under commercial terms.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\MF{} font list]\CTANref{mf-list}
\end{ctanrefs}

\Question[Q-CD]{\TeX{} \CDROM{}s}

If you don't have access to the Internet, there are obvious
attractions to \TeX{} collections on a \CDROM{}.  Even those with net
access will find large quantities of \TeX{}-related files to hand a
great convenience.

A Ready-to-run \TeX{} system is available from the \TeX{}~Live
\CDROM{}, whose eighth edition will be released in 2003.  The \CDROM{}
was originally developed under the auspices of a consortium of User
Groups (notably \acro{TUG}, \acro{UK}~\acro{TUG} and
\acro{GUT}enberg).  All members of several User Groups receive copies
free of charge.  Some user groups will also sell additional copies:
contact your local user group or \nothtml{\acro{TUG} (}% line break!
\Qref{\acro{TUG}}{Q-TUG*}\nothtml{)}.

\begin{pdfversion}
  Details of \TeX{} Live are available from its own
  \href{http://www.tug.org/texlive.html}{web page}
  on the \acro{TUG} site.
\end{pdfversion}
\begin{dviversion}
  Details of \TeX{} Live are available from its own web page on the
  \acro{TUG} site \URL{http://www.tug.org/texlive.html}
\end{dviversion}
\begin{htmlversion}
  Details of \TeX{} Live are available from its own
  \href{http://www.tug.org/texlive.html}{web page}
  on the \acro{TUG} site.
\end{htmlversion}

An alternative to the ready-to-run system is the \acro{CTAN} archive
snapshot; in general one would expect that such systems would be
harder to use, but that the volume of resources offered would balance
this extra inconvenience.  There were once commercial offerings in
this field, but nowadays the snapshot supplied to user group members
annually is about the only source of such things.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{\TeX{} Systems}

\Question[Q-TeXsystems]{\AllTeX{} for different machines}
\keywords{windows,macintosh,ms-dos,os/2,unix,linux}

We list here the free or shareware packages;
\htmlignore
see \Qref{}{Q-commercial} for details of commercial packages.
\endhtmlignore
\begin{htmlversion}
  another question addresses
  \Qref{commercial \TeX{} vendors'}{Q-commercial} products.
\end{htmlversion}
\begin{description}
\item[Unix] Instructions for retrieving the \Package{web2c} Unix
  \TeX{} distribution via anonymous |ftp| are to be found in
  \File|unixtex.ftp|, though nowadays the sensible installer will
  take (and possibly customise) one of the packaged distributions such
  as te\TeX{} (which often has a more recent version of
  \Package{web2c} embedded than has been released ``in the wild''), or the
  \TeX{}~Live \CDROM{} (see \Qref[question]{\TeX{} \CDROM{}s}{Q-CD}).
  
  To compile and produce a complete te\TeX{} distribution, you need a
  |.tar.gz| file for each of |teTeX-src|, |teTeX-texmf| and
  |teTeX-texmfsrc|.
  
  No sets of te\TeX{} binaries are provided on \acro{CTAN}; however,
  compilation of te\TeX{} is pretty stable, on a wide variety of
  platforms.  If you don't have the means to compile te\TeX{}
  yourself, you will find that most ``support'' sites carry compiled
  versions in their ``free area'', and the \TeX{}-live discs also
  carry a wide range of binary distributions.

  During periods when te\TeX{} is itself under development, a
  ``te\TeX{}-beta'' is available.  Before proceeding with the
  \latexhtml{$\beta$}{beta}-release, check the \File|ANNOUNCE| files
  in the two directories on \acro{CTAN}: it may well be that the
  \latexhtml{$\beta$}{beta}-release doesn't offer you anything new,
  that you need.

  Mac\acro{OS} \acro{X} users should refer to the information below,
  under item ``Mac''.
  \begin{ctanrefs}
  \item[tetex]Browse \CTANref{tetex}
  \item[tetex-beta]\CTANref{tetex-beta}
  \item[unixtex.ftp]\CTANref{unixtexftp}
  \item[web2c]\CTANref{web2c}
  \end{ctanrefs}
\item[Linux] There are at least two respectable implementations of
  \TeX{} to run on Linux, N\TeX{} and te\TeX{} (see above).

  The most recent offering is a free version of the
  commercial \nothtml{V\TeX{} (see }%
  \Qref[question]{V\TeX{}}{Q-commercial}\nothtml{)}, which among other
  things, specialises in direct production of \acro{PDF} from
  \AllTeX{} input.
  \begin{ctanrefs}
  \item[ntex]\CTANref{ntex}
  \item[tetex]Browse \CTANref{tetex}
  \item[vtex]\CTANref{vtex-linux}
  \item[vtex \nothtml{\rmfamily}required common files]\CTANref{vtex-common}
  \end{ctanrefs}
\item[\acro{PC}; \MSDOS{} or \acro{OS/}2] Em\TeX{}, by Eberhard Mattes,
  includes \LaTeX{}, \BibTeX{}, previewers, and drivers, and is
  available  as a series of zip archives.  Documentation is
  available in both German and English.  Appropriate memory managers
  for using em\TeX{} with 386 (and better) processors and under
  Windows, are included in the distribution.  Em\TeX{} will operate
  under Windows, but Windows users are better advised to use a
  distribution tailored for the Windows environment.

  A version of em\TeX{}, packaged to use a
  % beware line break, two lines
  \nothtml{\acro{TDS} directory structure (}%
  \Qref{TDS directory structure}{Q-tds}\nothtml{)}, is separately
  available as an em\TeX{} `contribution'.
  \begin{ctanrefs}
  \item[emtex]\CTANref{emtex}
  \item[emtexTDS]\CTANref{emtextds}
  \end{ctanrefs}
\item[\acro{PC}; \MSDOS{}] The most recent offering is an \MSDOS{}
  port of the Web2C~7.0 implementation, using the \acro{GNU}
  \ProgName{djgpp} compiler.
  \begin{ctanrefs}
  \item[djgpp]\CTANref{djgpp}
  \end{ctanrefs}
\item[\acro{PC}; \acro{OS/}2] \acro{OS/}2 may also use a free version of the
  commercial \nothtml{V\TeX{} (see }%
  \Qref[question]{V\TeX{}}{Q-commercial}\nothtml{)}, which specialises
  in direct production of \acro{PDF} from \AllTeX{} input.
  \begin{ctanrefs}
  \item[vtex]\CTANref{vtex-os2}
  \item[vtex \nothtml{\rmfamily}required common files]\CTANref{vtex-common}
  \end{ctanrefs}
\item[\acro{PC}: Win32]
  fp\TeX{}, by Fabrice Popineau, is a version of te\TeX{} for Windows
  systems.  As such, it is particularly attractive to those who need
  to switch back and forth between Windows and Unix environments, and
  to administrators who need to maintain both (fp\TeX{} can use the
  same \texttt{texmf} tree as a te\TeX{} installation).  fp\TeX{}'s
  previewer (\ProgName{Windvi}) is based on \ProgName{xdvi}, and takes
  advantage of extra facilities in the Win32 environment.
  \ProgName{Windvi} is capable of printing directly, and a version of
  \ProgName{dvips} is also available.
  
  Mik\TeX{}, by Christian Schenk, is also a comprehensive
  distribution, developed separately from the te\TeX{} work.  It has
  its own previewer, \acro{YAP}, which is itself capable of printing,
  though the distribution also includes a port of \ProgName{dvips}.
  The current version is available for file-by-file download (the
  \acro{HTML} files in the directory offer hints
  on what you need to get going).  A prepackaged version of the whole
  directory is also available.
  
  A further (free) option arises from the
  \href{http://www.cygwin.com}{``CygWin'' bundle}, which presents a
  Unix-like environment over the Win32 interface; an X-windows server
  is available.  If you run CygWin on your Windows machine, you have
  the option of using te\TeX{}, too (you will need the X-server, to
  run \ProgName{xdvi}).  Of course, te\TeX{} components will look like
  Unix applications (but that's presumably what you wanted), but it's
  also reputedly somewhat slower than native Win32 implementations
  such as Mik\TeX{} or fp\TeX{}.  Te\TeX{} is available as part of the
  CygWin distribution (in the same way that a version is available
  with most Linux distributions, nowadays), and you may also build
  your own copy from the current sources.

  BaKoMa \TeX{}, by Basil Malyshev, is a comprehensive (shareware)
  distribution, which focuses on support of Acrobat.  The distribution
  comes with a bunch of Type~1 fonts packaged to work with BaKoMa
  \TeX{}, which further the focus.
  \begin{ctanrefs}
  \item[bakoma]\CTANref{bakoma-tex}
  \item[fptex]\CTANref{fptex}
  \item[miktex]Acquire \CTANref{miktex-setup}, and read
    \CTANref{miktex-install}
  \item[tetex]\CTANref{tetex}
  \end{ctanrefs}
\item[Windows \acro{NT}, other platforms] Ports of Mik\TeX{} for
  \acro{NT} on Power \acro{PC} and \acro{AXP} are available.  Neither
  version has been updated for version~1.2 (or later) of
  Mik\TeX{}~--- they may not be satisfactory.
  \begin{ctanrefs}
  \item[miktex for AXP]\CTANref{miktex-AXP}
  \item[miktex for Power PC]\CTANref{miktexppc}
  \end{ctanrefs}
\item[Mac] Oz\TeX{}, by Andrew Trevorrow, is a shareware version of
  \TeX{} for the Macintosh.  A \acro{DVI} previewer and \PS{}
  driver are also included.
% It should run on any Macintosh Plus, SE, II, or newer model, but
% will not work on a 128K or 512K Mac 

  \acro{UK}~\acro{TUG} prepays the shareware fee, so that its members may
  acquire the software without further payment.  Questions about
  Oz\TeX{} may be directed to \mailto|oztex@midway.uchicago.edu|

  Another partly shareware program is \acro{CM}ac\TeX{}, put together
  by Tom Kiffe. This is much closer 
  to the Unix \TeX{} setup (it uses \ProgName{dvips}, for instance).
  \acro{CM}ac\TeX{} includes a port of the latest version of
  \nothtml{Omega (}\Qref{Omega}{Q-omega}\nothtml{)}.

  Both Oz\TeX{} and \acro{CM}ac\TeX{} are additionally available on
  % beware line wrap
  \href{http://www.esm.psu.edu/mac-tex/versionsX.html}{Mac\acro{OS} \acro{X}},
  but \acro{OS}~\acro{X} users also have the option of a build of
  te\TeX{} by Gerben Wierda.  This is naturally usable from the
  command line, just like any other Unix-based system, but it can also
  be used Mac-style as the engine behind Richard Koch's (free)
  \TeX{}Shop, which is an integrated \TeX{} editor and previewer.

\htmlignore
\ifpdf
  A useful
  \href{http://www.esm.psu.edu/mac-tex/}{resource for Mac users}
  has a news and `help' section, as well as details of systems and
  tools.
\else
  A useful resource for Mac users is to be found at
  \URL{http://www.esm.psu.edu/mac-tex/}; it has a news and `help'
  section, as well as details of systems and tools.
\fi
\endhtmlignore
  A useful
  \href{http://www.esm.psu.edu/mac-tex/}{resource for Mac users}
  has a news and `help' section, as well as details of systems and
  tools.
\begin{htmlversion}
\end{htmlversion}
  \begin{ctanrefs}
  \item[cmactex]\CTANref{cmactex}
  \item[oztex]\CTANref{oztex}
  \item[MacOS X teTeX]\URL{ftp://ftp.nluug.nl/pub/comp/macosx/tex-gs/}
  \item[TeXShop]\URL{http://darkwing.uoregon.edu/~koch/texshop/texshop.html}
  \end{ctanrefs}
\item[Open\acro{VMS}] \TeX{} for Open\acro{VMS} is available.

% Standard tape distribution is through \acro{DECUS}
% (see \Qref[question]{sources of software}{Q-archives}).
  \checked{RF}{1994/10/11}
  \begin{ctanrefs}
  \item[OpenVMS]\CTANref{OpenVMSTeX}
  \end{ctanrefs}
\item[Atari] \TeX{} is available for the Atari \acro{ST}.

  If anonymous |ftp| is not available to you, send a message
  containing the line `|help|' to
  \mailto|atari@atari.archive.umich.edu|
  \begin{ctanrefs}
  \item[Atari TeX]\CTANref{atari}
  \end{ctanrefs}
\item[Amiga] Full implementations of \TeX{} 3.1 (Pas\TeX{}) and \MF{}
  2.7 are available.
  \begin{ctanrefs}
  \item[PasTeX]\CTANref{amiga}
  \end{ctanrefs}
\item[\acro{TOPS}-20] \TeX{} was originally written on a \acro{DEC}-10
  under \acro{WAITS},
  and so was easily ported to \acro{TOPS}-20. A distribution that runs on
  \acro{TOPS}-20 is available via anonymous |ftp| from \FTP|ftp.math.utah.edu|
  in \path|pub/tex/pub/web|
  \checked{RF}{2001/03/01}
\end{description}

\Question[Q-editors]{\TeX{}-friendly editors and shells}

There are good \TeX{}-writing environments and editors for most
operating systems; some are described below, but this is only a
personal selection:
\begin{description}
\item[Unix] Try
  \href{http://www.gnu.org/software/emacs/emacs.html}{\acro{GNU}~\ProgName{emacs}}
  or \href{http://www.xemacs.org/}{\ProgName{xemacs}}, and
  the \acro{AUC}-\TeX{}
  bundle (available from \acro{CTAN}).  \acro{AUC}-\TeX{} provides menu
  items and control sequences for common constructs, checks syntax,
  lays out markup nicely, lets you call \TeX{} and drivers from
  within the editor, and everything else like this that you can think
  of.  Complex, but very powerful.

  Many who fail to find the versions of \ProgName{emacs} attractive, prefer
  \href{http://vim.sourceforge.net}{\ProgName{vim}}, a highly configurable
  editor (also available for Windows and Macintosh systems).  Many
  plugins are available to support the needs of the \AllTeX{} user,
  including syntax highlighting, calling \TeX{} programs,
  auto-insertion and -completion of common \AllTeX{} structures, and
  browsing \LaTeX{} help.  The scripts \File|auctex.vim| and
  \File|bibtex.vim| seem to be the most common recommendations.

  The editor \href{http://nedit.org/}{\ProgName{NEdit}} is also free
  and programmable, and is available for Unix systems.  An
  \acro{AUC}-\TeX{}-alike set of extensions for \ProgName{NEdit} is available
  from \acro{CTAN}.

  \ProgName{LaTeX4Jed} provides much enhanced \LaTeX{} support for the
  \href{http://www.jedsoft.org/jed/}{\ProgName{jed}} editor.
  \ProgName{LaTeX4Jed} is similar to \acro{AUC}-\TeX{}: menus,
  shortcuts, templates, syntax highlighting, document outline,
  integrated debugging, symbol completion, full integration with
  external programs, and more. It was designed with both the beginner
  and the advanced LaTeX user in mind.
\item[\MSDOS{}] \TeX{}shell is a simple,
  easily-customisable environment, which can be used with the editor
  of your choice.

  Eddi4\TeX{} (shareware) is a specially-written \TeX{}
  editor which features intelligent colouring, bracket matching,
  syntax checking, online help and the ability to call \TeX{}
  programs from within the editor. It is highly customisable, and
  features a powerful macro language.

  You can also use \acro{GNU}~\ProgName{emacs} and \acro{AUC}-\TeX{}
  under \MSDOS{}.
\item[Windows '9x, NT, etc.] \ProgName{Winedt}, a shareware package,
  is highly spoken of.  It provides a shell for the use of \TeX{} and
  related programs, as well as a powerful and well-configured editor.

  The 4All\TeX{} \CDROM{}
  % beware line wrap)
  (see \Qref[question]{\TeX{} \CDROM{}s}{Q-CD}) contains another
  powerful Windows-based shell.

  Both \ProgName{emacs} and \ProgName{vim} are available in versions
  for Windows systems.
\item[\acro{OS/}2] Eddi4\TeX{} works under \acro{OS/}2; an alternative
  is
  \ProgName{epmtex}, which offers an \acro{OS/}2-specific shell.
\item[Macintosh] The commercial Textures provides an excellent integrated
  Macintosh environment with its own editor.  More powerful still (as an
  editor) is the shareware \ProgName{Alpha} which is
  extensible enough to let you perform almost any \TeX{}-related job. It
  works well with Oz\TeX{}.

  \ProgName{Vim} is available for use on Macintosh systems.
\end{description}
Atari, Amiga and \acro{N}e\acro{XT} users also have nice
environments. \LaTeX{} users looking for \ProgName{make}-like
facilities should try \ProgName{latexmk}.

There is another set of shell programs to help you manipulate
\BibTeX{} databases.
\begin{ctanrefs}
\item[alpha]\CTANref{alpha}
\item[auctex]\CTANref{auctex}
%\item[Eddi4TeX]\CTANref{e4t}
\item[epmtex]\CTANref{epmtex}
\item[latexmk]\CTANref{latexmk}
\item[LaTeX4Jed]\CTANref{latex4jed}
\item[Nedit LaTeX support]\CTANref{nedit-latex}
\item[TeXshell]\CTANref{texshell}
\item[TeXtelmExtel]\CTANref{TeXtelmExtel}
\item[winedt]\CTANref{winedt}
\end{ctanrefs}

\Question[Q-commercial]{Commercial \TeX{} implementations}
\keywords{windows,macintosh,commercial}

There are many commercial implementations of \TeX{}. The first
appeared not long after \TeX{} itself appeared.

What follows is probably an incomplete list.  Naturally, no warranty or
fitness for purpose is implied by the inclusion of any vendor in this
list.  The source of the information is given to provide some clues to
its currency.

In general, a commercial implementation will come `complete', that is,
with suitable previewers and printer drivers.  They normally also have
extensive documentation (\emph{i.e}., not just the \TeX{}book!) and some
sort of support service.  In some cases this is a toll free number
(probably applicable only within the \acro{USA} and or Canada), but others
also have email, and normal telephone and fax support.
\begin{description}
\item[\acro{PC}; True\TeX{}] Runs on all versions of Windows.
  \begin{quote}
    Richard J. Kinch\\
    TrueTeX Software\\
    6994 Pebble Beach Court\\
    Lake Worth \acro{FL} 33467\\
    \acro{USA}\\[.25\baselineskip]
    Tel: +1 561-966-8400\\
    Email: \mailto|kinch@truetex.com|\\
    Web: \URL{http://www.truetex.com/}
  \end{quote}
  Source: Mail from Richard Kinch, October 2001.
\item[\acro{PC}; \YandY{} \TeX{}] ``Bitmap free \TeX{} for Windows.''
  \begin{quote}
    \YandY{}, Inc.\\
    106 Indian Hill, \acro{MA} 01741-1747\\
    \acro{USA}\\[.25\baselineskip]
    Tel: 800-742-4059 (within North America)\\
    Tel: +1 978-371-3286\\
    Fax: +1 978-371-2004\\
    Email: \mailto|sales-help@YandY.com| and
    \nothtml{\\ \hphantom{Email: }}%
    \mailto|tech-help@YandY.com|\\
    Web: \URL{http://www.YandY.com/}
  \end{quote}
  Source: Confirmed with \YandY{}, February 2003
\item[pc\TeX{}] Long-established: pc\TeX{}32 is a Windows implementation.
  \begin{quote}
    Personal \TeX{} Inc\\
    12 Madrona Street\\
    Mill Valley, \acro{CA} 94941\\
    \acro{USA}\\[.25\baselineskip]
    Tel: 800-808-7906 (within the \acro{USA})\\
    Fax: +1 415-388-8865\\
    Email: \mailto|texsales@pctex.com| and
    \htmlignore
    \\ \hphantom{Email: }%
    \endhtmlignore
    \mailto|texsupp@pctex.com|\\
    Web: \URL{http://www.pctex.com/}
  \end{quote}
  Source: Mail from Personal \TeX{} Inc, September 1997
\item[\acro{PC}; V\TeX{}] \acro{DVI}, \acro{PDF} and \acro{HTML}
  backends, Visual Tools and Type 1 fonts
  \begin{quote}
    MicroPress Inc\\
    68-30 Harrow Street\\
    Forest Hills, \acro{NY} 11375\\
    \acro{USA}\\[.25\baselineskip]
    Tel: +1 718-575-1816\\
    Fax: +1 718-575-8038\\
    Email: \mailto|support@micropress-inc.com|\\
    Web: \URL{http://www.micropress-inc.com/}
  \end{quote}
  Source: Mail from MicroPress, Inc., July 1999
\item[\acro{PC}; Scientific Word] Scientific Word and Scientific Workplace
  offer a mechanism for near-\WYSIWYG{} input of \LaTeX{} documents; they
  ship with True\TeX{} from Kinch (see above).  Queries within the \acro{UK}
  and Ireland should be addressed to Scientific Word Ltd., others should be
  addressed directly to the publisher, MacKichan Software Inc.
  \begin{quote}
    Dr Christopher Mabb\\
    Scientific Word Ltd.\\
    49 Queen Street\\
    Peterhead\\
    Aberdeenshire, \acro{AB}42 1\acro{TU}\\
    \acro{UK}\\[0.25\baselineskip]
    Tel: 0845 766\,0340 (within the \acro{UK}) \\
    Tel: +44 1779 490500 \\
    Fax: 01779 490600 (within the \acro{UK}) \\
    Email: \mailto|christopher@sciword.demon.co.uk| \\
    Web: \URL{http://www.sciword.demon.co.uk}
  \end{quote}
  \begin{quote}
    MacKichan Software Inc.\\
    600 Ericksen Ave.\ \acro{NE}, Suite 300\\
    Bainbridge Island \acro{WA} 98110\\
    \acro{USA}\\[0.25\baselineskip]
    Tel: +1 206 780\,2799\\
    Fax: +1 206 780\,2857\\
    Email: \mailto|info@mackichan.com|\\
    Web: \URL{http://www.mackichan.com}
  \end{quote}
  Source: Mail from Christopher Mabb, May 1999
\item[Macintosh; Textures] ``A \TeX{} system `for the rest of
  us'\,''; also gives away a \MF{} implementation and some
  font manipulation tools.
  \begin{quote}
    Blue Sky Research\\
    534 SW Third Avenue\\
    Portland, \acro{OR} 97204\\
    \acro{USA}\\[.25\baselineskip]
    Tel: 800-622-8398 (within the \acro{USA})\\
    Tel: +1 503-222-9571\\
    Fax: +1 503-222-1643\\
    Email: \mailto|sales@bluesky.com|\\
    Web: \URL{http://www.bluesky.com/}
  \end{quote}
  Source: \TUGboat{} 15(1) (1994)
\item[Amiga\TeX{}] A full implementation for the Commodore Amiga,
  including full, on-screen and printing support for all \PS{}
  graphics and fonts, IFF raster graphics, automatic font generation,
  and all of the standard macros and utilities.
  \begin{quote}
    Radical Eye Software\\
    \acro{PO} Box 2081\\
    Stanford, \acro{CA} 94309\\
    \acro{USA}
  \end{quote}
  Source: Mail from Tom Rokicki, November 1994
\end{description}
\checked{mc}{1994/11/09}%
\checked{RF}{1994/11/24}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{\acro{DVI} Drivers and Previewers}

\Question[Q-dvips]{\acro{DVI} to \PS{} conversion programs}

The best public domain \acro{DVI} to \PS{} conversion program, which
runs under many operating systems, is Tom Rokicki's \ProgName{dvips}.
\ProgName{dvips} is written in \acro{C} and ports easily.  All current
development is in the context of Karl Berry's \ProgName{kpathsea}
library, and sources are available from the \TeX{}~live repository.

An \acro{VMS} versions is available as part of the \acro{CTAN}
distribution of \TeX{} for \acro{VMS}.

A precompiled version to work with em\TeX{} is available on \acro{CTAN}.

%Another good portable program is \ProgName{dvitops} by James Clark,
%which is also written in C and will compile under Unix, \MSDOS{}, \acro{VMS},
%and Primos; however, it does not support virtual fonts.  It is
%available from
%\CTANref{dvitops}

Macintosh users can use either the excellent drivers built into Oz\TeX{}
or Textures, or a port of \ProgName{dvips} in the \acro{CM}ac\TeX{}
package.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\MSDOS{} and \nothtml{\acro}{OS/}2]\CTANref{dvips-pc}
\item[\nothtml{\rmfamily}VMS distribution]\CTANref{OpenVMSTeX}
\end{ctanrefs}

\Question[Q-HPdrivers]{\acro{DVI} drivers for \acro{HP} LaserJet}

The em\TeX{} distribution (see \Qref[question]{\TeX{} systems}{Q-TeXsystems})
contains a driver for the LaserJet, \ProgName{dvihplj}.

Version 2.10 of the Beebe drivers supports the LaserJet. These drivers
will compile under Unix, \acro{VMS}, and on the Atari ST and
\acro{DEC}-20s.

For Unix systems, Karl Berry's \ProgName{dviljk} uses the same
path-searching library as \ProgName{web2c}.  \ProgName{dviljk} is no
longer distributed as a separate source, but the te\TeX{} distribution
holds a copy under the name \ProgName{dvilj}.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Beebe drivers]\CTANref{beebe}
\end{ctanrefs}

\Question[Q-otherprinters]{Output to ``other'' printers}

In the early years of \TeX{}, there were masses of \acro{DVI} drivers
for any (then) imaginable kind of printer, but the steam seems rather
to have gone out of the market for production of such drivers for
printer-specific formats.  There are several reasons for this, but the
primary one is that few formats offer the flexibility available
through \PS{}, and \ProgName{ghostscript} is \emph{so} good, and
has \emph{such} a wide range of printer drivers (perhaps this is where
the \acro{DVI} output driver writers have all gone?).

The general advice, then, is to \nothtml{generate \PS{} (}%
\Qref{generate \PS{}}{Q-dvips}\nothtml{)}, and to process
that with \ProgName{ghostscript} set to generate the format for the
printer you actually have.  If you are using a Unix system of some
sort, it's generally quite easy to insert \ProgName{ghostscript} into
the print spooling process.
\begin{ctanrefs}
\item[ghostscript]Browse \CTANref{ghostscript}
\end{ctanrefs}

\Question[Q-previewers]{\acro{DVI} previewers}

Em\TeX{} for \acro{PC}s running \MSDOS{} or \acro{OS/}2, Mik\TeX{} and
fp\TeX{} for \acro{PC}s running Windows and Oz\TeX{} for the Macintosh, all
come with previewers that can be used on those platforms. Em\TeX{}'s
previewer can also be run under Windows~3.1.

Commercial \acro{PC} \TeX{} packages (see
\Qref[question]{commercial vendors}{Q-commercial})
have good previewers for \acro{PC}s running Windows, or for Macintoshes.

For Unix systems, there is one `canonical' viewer, \ProgName{xdvi}.
\ProgName{Xdvik} is a version of \ProgName{xdvi} using the
\ProgName{web2c} libraries.  Unix \TeX{} distributions (such as
te\TeX{} or \acro{N}\TeX{}) include a version of \ProgName{xdvik}
using the same version of \ProgName{web2c} as the rest of the
distribution.

Alternatives to previewing include
\begin{itemize}
\item conversion to `similar' \acro{ASCII} text (see
  \Qref[question]{converting to \acro{ASCII}}{Q-toascii}) and using a
  conventional text viewer to look at that,
\item generating a \PS{} version of your document and viewing it
  with a \ProgName{Ghostscript}-based previewer (see
  \Qref[question]{previewing \PS{} files}{Q-PSpreview}), and
\item generating  \acro{PDF} output, and viewing that with
  \ProgName{Acrobat} \ProgName{Reader} or one of the substitutes for that.
\end{itemize}
\begin{ctanrefs}
\item[xdvi]\CTANref{xdvi}
\item[xdvik]\CTANref{xdvik}
\end{ctanrefs}

\Question[Q-dvi-bmp]{Generating bitmaps from \acro{DVI}}

In the last analysis, any \acro{DVI} driver or previewer is generating
bitmaps: bitmaps for placing tiny dots on paper via a laser- or
inkjet-printer, or bitmaps for filling some portion of your screen.
However, it's usually difficult to extract any of those bitmaps any
way other than by screen capture, and the resolution of \emph{that} is
commonly lamentable.

Why would one want separate bitmaps?  Most often, the requirement is for
something that can be included in \acro{HTML} generated from \AllTeX{}
source~--- not everything that you can write in \AllTeX{} can be
translated to \acro{HTML} (at least, portable \acro{HTML} that may be
viewed in `most' browsers), so the commonest avoiding action is to
generate a bitmap of the missing bit.  Examples are maths (a maths
extension to the |*|\acro{ML} family is available but not widely
used), and `exotic' typescripts (ones that you cannot guarantee your
readers will have available).  Other common examples are generation of
sample bitmaps, and generation for insertion into some other
application's display~--- to insert equations into Microsoft
PowerPoint, or to support the enhanced-\ProgName{emacs} setup called
\nothtml{\ProgName{preview}-\ProgName{latex} (}% beware line breaks
\Qref{\ProgName{preview}-\ProgName{latex}}{Q-WYGexpts}\nothtml{)}.

In the past, the commonest way of generating bitmaps was to generate a
\PS{} file of the \acro{DVI} and then use \ProgName{ghostscript} to
produce the required bitmap format (possibly by way of \acro{PNM}
format or something similar).  This is an undesirable procedure (it is
very slow, and requires two or three steps) but it has served for a
long time.

\AllTeX{} users may now take advantage of two bitmap `drivers'.  The
longest-established, \ProgName{dvi2bitmap}, will generate \acro{XBM} and
\acro{XPM} formats, the long-deprecated \acro{GIF} format (which is
now obsolescent, but is
finally, in Summer 2003, to be relieved of the patent protection of
the \acro{LZW} compression it uses), and also
the modern (\acro{ISO}-standardised) \acro{PNG} format.

\ProgName{Dvipng} was designed for speed, in environments that
generate large numbers of \acro{PNG} files: the \File|README| mentions
the requirements of \ProgName{preview}-\ProgName{latex}, and
\ProgName{dvipng} embodies various optimisations for its use in such
an environment.
\begin{ctanrefs}
\item[dvi2bitmap]\CTANref{dvi2bitmap}
\item[dvipng]\CTANref{dvipng}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Support Packages for \TeX{}}

\Question[Q-fig]{Fig, an \AllTeX{}-friendly drawing package}

\ProgName{(X)Fig} is a menu driven tool that allows you to
draw objects on the screen of an \acro{X} workstation; \ProgName{transfig}
is a set of tools which translate the code \ProgName{fig}.  The list
of export formats is very long, and includes \MF{} and \MP{},
Encapsulated \PS{} and \acro{PDF}, as well as combinations that wrap
a graphics format in a \LaTeX{} import file.

There's no explicit port of \ProgName{xfig} to windows (although it is
believed to work under \ProgName{cygwin} with their X-windows system).
However, the program
\href{http://tech-www.informatik.uni-hamburg.de/applets/javafig/}{\ProgName{jfig}}
is thought by many to be an acceptable substitute, written in Java.
\begin{ctanrefs}
\item[xfig]\CTANref{xfig}
\item[transfig]\CTANref{transfig}
\end{ctanrefs}

\Question[Q-texcad]{\TeX{}\acro{CAD}, a drawing package for \LaTeX{}}

\TeX{}\acro{CAD} is a program for the \acro{PC} which enables the user to draw diagrams
on screen using a mouse or arrow keys, with an on-screen menu of available 
picture-elements. Its output is code for the \LaTeX{}
\environment{picture} environment. 
Optionally, it can be set to include lines at all angles using 
the em\TeX{} driver-family
\htmlignore
|\special|s (\Qref{}{Q-specials}).
\endhtmlignore
\begin{htmlversion}
\Qref{\cs|special|s}{Q-specials}.
\end{htmlversion}
\TeX{}\acro{CAD} is part of the em\TeX{} distribution.

A Unix port of the program (\ProgName{xtexcad}) has been made.
\begin{ctanrefs}
\item[emtex]\CTANref{emtex}
\item[xtexcad]\CTANref{xtexcad}
\end{ctanrefs}

\Question[Q-spell]{Spelling checkers for work with \TeX{}}

For Unix, \ProgName{ispell} has long the program of choice; it is well
integrated with \ProgName{emacs}, and deals with some \TeX{} syntax.
However, it is increasingly challenged by \ProgName{aspell}, which was
designed as a successor, and certainly performs better on most
metrics; there remains some question as to its performance with
\AllTeX{} sources.  \ProgName{Aspell} appears as an option in most
\ProgName{Linux} distributions, but is not available on
\acro{CTAN}~--- see \URL{http://aspell.sourceforge.net/} for further
details.

For Windows, there is a good spell checker incorporated into the
Win\acro{EDT} and 4All\TeX{} \Qref*{shell/editor}{Q-editors}.  The
4All\TeX{} checker is also available as a separate package,
\ProgName{4spell}.

For the Macintosh, \ProgName{Excalibur} is the program of choice.  It
will run in native mode on both sorts of Macintosh.  The distribution
comes with dictionaries for several languages.

The \acro{VMS} Pascal program \ProgName{spell} makes special cases of
some important features of \LaTeX{} syntax.

For \MSDOS{}, there are several programs.  \ProgName{Amspell} can be
called from within an editor, and \ProgName{jspell} is an extended
version of \ProgName{ispell}.
\begin{ctanrefs}
\item[4spell]\CTANref{4spell}
\item[amspell]\CTANref{amspell}
\item[excalibur]\CTANref{Excalibur}
\item[ispell]Browse \CTANref{ispell}, but beware of any version with a
  number |4.x|~--- such versions represent a divergent version of the
  source which lacks many useful facilities of the |3.x| series.
\item[jspell]\CTANref{jspell}
\item[\nothtml{\bgroup\rmfamily}\acro{VMS}\nothtml{\egroup} spell]%
  \CTANref{vmspell}
\item[winedt]\CTANref{winedt}
\end{ctanrefs}

\Question[Q-wordcount]{How many words have you written?}

One often has to submit a document (e.g., a paper or a dissertation)
under some sort of constraint about its size.  Sensible people set a
constraint in terms of numbers of pages, but there are some that
persist in limiting the numbers of words you type.

A simple solution to the requirement can be achieved following a
simple observation: the powers that be are unlikely to count all the
words of a document submitted to them.  Therefore, a statistical
method can be employed: find how many words there are on a full page;
find how many full pages there are in the document (allowing for
displays of various sorts, this number will probably not be an
integer); multiply the two.  However, if the document to be submitted
is to determine the success of the rest of one's life, it takes a
brave person to thumb their nose at authority quite so
comprehensively\dots{}

The simplest method is to strip out the \AllTeX{} markup, and to count
what's left.  On a  Unix-like system, this may be done using
\ProgName{detex} and the built-in \ProgName{wc}:
\begin{verbatim}
  detex <filename> | wc -w
\end{verbatim}
The \ProgName{latexcount} script does the same sort of job, in one
``step''; being a \ProgName{perl} script, it is in principle rather
easily configured (see documentation inside the script).
\ProgName{Winedt} (see \Qref[question]{editors and shells}{Q-editors})
provides this functionality direct in the Windows environment.

Simply stripping \AllTeX{} markup isn't entirely reliable, however:
that markup itself may contribute typeset words, and this could be a
problem.  The \Package{wordcount} package
contains a Bourne shell (i.e., typically Unix) script for running a
\LaTeX{} file with a special piece of supporting \TeX{} code, and then
counting word indications in the log file.  This is probably as
accurate automatic counting as you can get.
\begin{ctanrefs}
\item[detex]\CTANref{detex}
\item[wordcount]\CTANref{wordcount}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Literate programming}

\Question[Q-lit]{What is Literate Programming?}

Literate programming is the combination of documentation and source
together in a fashion suited for reading by human beings. 
In general, literate programs combine source
and documentation in a single file.  Literate programming tools then
parse the file to produce either readable documentation or compilable
source.  The \acro{WEB} style of literate programming was created by
D.~E.~Knuth during the development of \TeX{}.

\htmlignore
The ``documented \LaTeX{}'' style of programming (\Qref{}{Q-dtx})
\endhtmlignore
\begin{htmlversion}
  The \Qref{``documented \LaTeX{}''}{Q-dtx} style of programming
\end{htmlversion}
is regarded by some as a form of literate programming, though it only
contains a subset of the constructs Knuth used.

Discussion of literate programming is conducted in the newsgroup
\Newsgroup|comp.programming.literate|, whose \acro{FAQ} is stored on
\acro{CTAN}.  Another good source of information is
\URL{http://www.literateprogramming.com/}
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Literate Programming \acro{FAQ}]%
  \CTANref{LitProg-FAQ}
\end{ctanrefs}

\Question[Q-webpkgs]{\acro{WEB} systems for various languages}

\TeX{} is written in the programming language \acro{WEB}; \acro{WEB}
is a tool to implement the concept of ``literate programming''.
Knuth's original implementation will be in any respectable
distribution of \TeX{}, but the sources of the two tools
(\ProgName{tangle} and \ProgName{weave}), together with a manual
outlining the programming techniques, may be had from \acro{CTAN}.

\acro{\ProgName{CWEB}}, by Silvio Levy, is a \acro{WEB} for \acro{C} programs.

Spidery \acro{WEB}, by Norman Ramsey, supports many 
languages including Ada, |awk|, and \acro{C}
and, while not in the public domain, is usable without charge.  It is
now superseded by \ProgName{noweb} (also by Norman Ramsay) which
incorporates the lessons learned in implementing spidery \acro{WEB},
and which is a simpler, equally powerful, tool.

\acro{\ProgName{FWEB}}, by John Krommes, is a version for Fortran,
Ratfor, and \acro{C}. 

\ProgName{Scheme}\acro{\ProgName{WEB}}, by John Ramsdell, is a Unix filter that
translates Scheme\acro{WEB} into \LaTeX{} source or Scheme source.

\acro{\ProgName{APLWEB}} is a version of \acro{WEB} for \acro{APL}.

\ProgName{FunnelWeb} is a version of \acro{WEB} that is language independent.

Other language independent versions of \acro{WEB} are \ProgName{nuweb} (which
is written in \acro{ANSI} \acro{C}).

\ProgName{Tweb} is a \acro{WEB} for Plain \TeX{} macro files, using
\ProgName{noweb}.
\begin{ctanrefs}
\item[aplweb]\CTANref{aplweb}
\item[cweb]\CTANref{cweb}
\item[funnelweb]\CTANref{funnelweb}
\item[fweb]\CTANref{fweb}
\item[noweb]\CTANref{noweb}
\item[nuweb]\CTANref{nuweb}
\item[schemeweb]\CTANref{schemeweb}
\item[spiderweb]\CTANref{spiderweb}
\item[tangle]\CTANref{web}
\item[tweb]\CTANref{tweb}
\item[weave]\CTANref{web}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Format conversions}

\Question[Q-toascii]{Conversion from \AllTeX{} to plain \acro{ASCII}}

The aim here is to emulate the Unix \ProgName{nroff}, which formats
text as best it can for the screen, from the same
input as the Unix typesetting program \ProgName{troff}.

Converting \acro{DVI} to plain text is the basis of many of these
techniques; sometimes the simple conversion provides a good enough
response.  Options are:
\begin{itemize}
\item \ProgName{dvi2tty} (one of the earliest)
\item \ProgName{crudetype}
\item \ProgName{catdvi}, which is also capable of generating Latin-1
  or \acro{UTF}-8 encoded output.  \ProgName{Catdvi} was conceived as
  a replacement for \ProgName{dvi2tty}, but can't (quite) be
  recommended as a complete replacement yet.
\end{itemize}

Ralph Droms provides a \Package{txt} bundle of things in support of
\acro{ASCII} generation,
but it doesn't do a good job with tables and mathematics.  An
alternative is the \Package{screen} package.

Another possibility is to
use the \LaTeX{}-to-\acro{ASCII} conversion program, \ProgName{l2a},
although this is really more of a de-\TeX{}ing program.

The canonical de-\TeX{}ing program is \ProgName{detex}, which removes
all comments and control sequences 
from its input before writing it to its output.  Its original purpose
was to prepare input for a dumb spelling checker, and it's only usable
for preparing useful \acro{ASCII} versions of a document in highly
restricted circumstances.

\ProgName{Tex2mail} is slightly more than a de-TeX{}er~--- it's a Perl
script that converts \TeX{} files into
plain text files, expanding various mathematical symbols
(sums, products, integrals, sub/superscripts, fractions, square
roots, \dots{}\@) into ``\acro{ASCII} art'' that spreads over
multiple lines if necessary. The result is more readable to human
beings than the flat-style \TeX{} code.

Another significant possibility is to use one of the
\nothtml{\acro{HTML}-generation solutions (}%
% beware line wrap
\Qref{\acro{HTML}-generation solutions}{Q-LaTeX2HTML}\nothtml{)},
and then to use a browser such as \ProgName{lynx} to dump the resulting
\acro{HTML} as plain text.
\begin{ctanrefs}
\item[catdvi]\CTANref{catdvi}
\item[crudetype]\CTANref{crudetype}
\item[detex]\CTANref{detex}
\item[dvi2tty]\CTANref{dvi2tty}
\item[l2a]\CTANref{l2a}
\item[screen.sty]\CTANref{screensty}
\item[tex2mail]\CTANref{tex2mail}
\item[txt]\CTANref{txtdist}
\end{ctanrefs}

\Question[Q-SGML2TeX]{Conversion from \acro{SGML} or \acro{HTML} to \protect\TeX{}}

\acro{SGML} is a very important system for document storage and interchange,
but it has no formatting features; its companion \acro{ISO} standard
\acro{DSSSL}
(see \URL{http://www.jclark.com/dsssl/}) is designed for writing
transformations and formatting,
but this has not yet been widely implemented. Some \acro{SGML} authoring
systems (e.g., SoftQuad \ProgName{Author/Editor}) have formatting
abilities, and
there are high-end specialist \acro{SGML} typesetting systems (e.g., Miles33's
\ProgName{Genera}).  However, the majority of \acro{SGML} users probably transform
the source to an existing typesetting system when they want to print. 
\TeX{} is a good candidate for this. There are three approaches to writing a
translator:
\begin{enumerate}
\item Write a free-standing translator in the traditional way, with
  tools like \ProgName{yacc} and \ProgName{lex}; this is hard, in
  practice, because of the complexity of \acro{SGML}.
\item Use a specialist language designed for \acro{SGML} transformations; the
  best known are probably \ProgName{Omnimark} and \ProgName{Balise}.
  They are expensive, but powerful, incorporating \acro{SGML} query and
  transformation abilities as well as simple translation.
\item Build a translator on top of an existing \acro{SGML} parser.  By far
  the best-known (and free!) parser is James Clark's
  \ProgName{nsgmls}, and this produces a much simpler output format,
  called \acro{ESIS}, which can be parsed quite straightforwardly (one also
  has the benefit of an \acro{SGML} parse against the \acro{DTD}). Two
  good public domain packages use this method:
  \begin{itemize}
    \item
\htmlignore
\ifpdf
      David Megginson's
      \href{http://www.perl.com/CPAN/modules/by-module/SGMLS}%
           {\ProgName{sgmlspm}}, written in Perl 5.
\else
      David Megginson's \ProgName{sgmlspm}, written in Perl 5,
      which is available from
      \URL{http://www.perl.com/CPAN/modules/by-module/SGMLS}
\fi
\endhtmlignore
\begin{htmlversion}
      David Megginson's
      \href{http://www.perl.com/CPAN/modules/by-module/SGMLS}{\ProgName{sgmlspm}},
      written in Perl 5.
\end{htmlversion}
%or  |home.sprynet.com/sprynet/dmeggins/SGMLSpm-1.03ii.tar.gz|
%was |www.uottawa.ca/~dmeggins/SGMLSpm/sgmlspm.html|
    \item
\htmlignore
\ifpdf
      Joachim Schrod and Christine Detig's
      \href{ftp://ftp.th-darmstadt.de/pub/text/sgml/stil}%
           {\ProgName{stil}}, written in Common Lisp.
\else
      Joachim Schrod and Christine Detig's \ProgName{stil}, written in
      Common Lisp, which is available from
      \URL{ftp://ftp.th-darmstadt.de/pub/text/sgml/stil}
\fi
\endhtmlignore
\begin{htmlversion}
      Joachim Schrod and Christine Detig's
      \href{ftp://ftp.th-darmstadt.de/pub/text/sgml/stil}{\ProgName{stil}},
      written in Common Lisp.
\end{htmlversion}
% checked RF 2001/03/19
  \end{itemize}
  Both of these allow the user to write `handlers' for every \acro{SGML}
  element, with plenty of access to attributes, entities, and
  information about the context within the document tree.

  If these packages don't meet your needs for an average \acro{SGML}
  typesetting job, you need the big commercial stuff.
\end{enumerate}

Since \acro{HTML} is simply an example of \acro{SGML}, we do not need a specific
system for \acro{HTML}.  However, Nathan Torkington developed
% (\Email|Nathan.Torkington@vuw.ac.nz|) 
\ProgName{html2latex} from the \acro{HTML} parser in \acro{NCSA}'s
Xmosaic package.
The program takes an \acro{HTML} file and generates a \LaTeX{} file from it.
The conversion code is subject to \acro{NCSA} restrictions, but the whole
source is available on \acro{CTAN}.

Michel Goossens and Janne Saarela published a very useful summary of
\acro{SGML}, and of public domain tools for writing and manipulating it, in
\TUGboat{} 16(2).
\begin{ctanrefs}
\item[html2latex \nothtml{\rmfamily}source]\CTANref{html2latex}
\end{ctanrefs}

\Question[Q-LaTeX2HTML]{Conversion from \AllTeX{} to \acro{HTML}}

\TeX{} and \LaTeX{} are well suited to producing electronically publishable
documents. However, it is important to realize the difference
between page layout and functional markup. \TeX{} is capable of
extremely detailed page layout; \acro{HTML} is not, because \acro{HTML} is a
functional markup language not a page layout language. \acro{HTML}'s exact
rendering is not specified by the document that is published but is, to
some degree, left to the discretion of the browser. If you require your
readers to see an exact replication of what your document looks like
to you, then you cannot use \acro{HTML} and you must use some other
publishing format such as \acro{PDF}. That is true for any \acro{HTML}
authoring tool.

\TeX{}'s excellent mathematical capabilities remain a challenge in the
business of conversion to \acro{HTML}.  There are only two generally
reliable techniques for generating mathematics on the web: creating
bitmaps of bits of typesetting that can't be translated, and using
symbols and table constructs.  Neither technique is entirely
satisfactory.  Bitmaps lead to a profusion of tiny files, are slow to
load, and are inaccessible to those with visual disabilities.  The
symbol fonts offer poor coverage of mathematics, and their use
requires configuration of the browser.  The future of mathematical
browsing may be brighter~--- see
% beware line break
\Qref[question]{future Web technologies}{Q-mathml}.

For today, possible packages are:
\begin{description}
\item[\ProgName{LaTeX2HTML}]a \ProgName{perl} script package that
  supports \LaTeX{} only, and generates mathematics (and other
  ``difficult'' things) using bitmaps.  The original version was
  written by Nikos Drakos for Unix systems, but the package now sports
  an illustrious list of co-authors and is also available for Windows
  systems.  Michel Goossens and Janne Saarela published a detailed
  discussion of \ProgName{LaTeX2HTML}, and how to tailor it, in
  \TUGboat{} 16(2).

  A mailing list for users may be found via
  \URL{http://tug.org/mailman/listinfo/latex2html}
\item[\ProgName{TtH}]a compiled program that supports either \LaTeX{}
  or plain \TeX{}, and uses the font/table technique for representing
  mathematics.  It is written by Ian Hutchinson, using
  \ProgName{flex}.  The distribution consists of a single \acro{C}
  source (or a compiled executable), which is easy to install and very
  fast-running.
\item[\ProgName{Tex4ht}]a compiled program that supports either
  \LaTeX{} or plain \TeX{}, by processing a \acro{DVI} file; it uses
  bitmaps for mathematics, but can also use other technologies where
  appropriate.  Written by Eitan Gurari, it parses the \acro{DVI}
  file generated when you run \AllTeX{} over your file with
  \ProgName{tex4ht}'s macros included.  As a result, it's pretty
  robust against the macros you include in your document, and it's
  also pretty fast.
\item[\ProgName{TeXpider}] a commercial program from
  % beware line breaks
  \nothtml{MicroPress (see }%
  \Qref[question]{Micropress}{Q-commercial}\latexhtml{),}{,} which is
  described on \URL{http://www.micropress-inc.com/webb/wbstart.htm};
  it uses bitmaps for equations.
\item[\ProgName{Hevea}] a compiled program that supports \LaTeX{}
  only, and uses the font/table technique for equations (indeed its
  entire approach is very similar to \ProgName{TtH}).  It is written
  in Objective \acro{CAML} by Luc Maranget.  \ProgName{Hevea} isn't
  archived on \acro{CTAN}; details (including download points) are
  available via \URL{http://pauillac.inria.fr/~maranget/hevea/}
\end{description}
An interesting set of samples, including conversion of the same text
by the four free programs listed above, is available at
\URL{http://www.mayer.dial.pipex.com/samples/example.htm}; a linked
page gives lists of pros and cons, by way of comparison.

The World Wide Web Consortium maintains a list of ``filters'' to
\acro{HTML}, with sections on \AllTeX{} and \BibTeX{}~--- see
\URL{http://www.w3.org/Tools/Word_proc_filters.html}
\begin{ctanrefs}
\item[latex2html]Browse \CTANref{latex2html}
\item[tex4ht]\CTANref{tex4ht}
\item[tth]\CTANref{tth}
\end{ctanrefs}

\Question[Q-fmtconv]{Other conversions to and from \AllTeX{}}

\begin{description}
\item[troff]\ProgName{troff-to-latex}, written by Kamal Al-Yahya at Stanford
  University (California, \acro{USA}), assists in the translation of a
  \ProgName{troff} document into \LaTeX{} format.  It recognises most
  |-ms| and |-man| macros, plus most \ProgName{eqn} and some
  \ProgName{tbl} preprocessor commands.  Anything fancier needs to be
  done by hand. Two style files are provided. There is also a man page
  (which converts very well to \LaTeX{}\dots{}).  The program is
  copyrighted but free.
  \ProgName{tr2latex} is an enhanced version of this
  \ProgName{troff-to-latex}.

% The \acro{DECUS} \TeX{} distribution (see
% \Qref[question]{sources of software}{Q-archives})
% also contains a program which converts \ProgName{troff} to \TeX{}.

%\item[Scribe] Mark James (\Email|jamesm@dialogic.com|) has a copy of
%  \ProgName{scribe2latex} he has been unable to test but which he will
%  let anyone interested have. The program was written by Van Jacobson
%  of Lawrence Berkeley Laboratory.%
%  \checked{RF}{1994/11/18}
  
\item[WordPerfect] \ProgName{wp2latex}
  has recently been much improved, and is now
  available either for \MSDOS{} or for Unix systems, thanks to its
  current maintainer Jaroslav Fojtik.
\item[\acro{PC}-Write]\ProgName{pcwritex.arc} is a
  print driver for \acro{PC}-Write that ``prints'' a \acro{PC}-Write
  V2.71 document to a \TeX{}-compatible disk file.  It was written by Peter
  Flynn at University College, Cork, Republic of Ireland.
\item[runoff] Peter Vanroose's \ProgName{rnototex}
  conversion program is written in \acro{VMS} Pascal.
  The sources are distributed with a \acro{VAX} executable.
\item[refer/tib] There are a few programs for converting bibliographic
  data between \BibTeX{} and \ProgName{refer}/\ProgName{tib} formats.
  The collection includes a shell script converter from \BibTeX{} to
  \ProgName{refer} format as well. The collection
  is not maintained.
\item[\acro{RTF}] \ProgName{Rtf2tex}, by Robert Lupton, is for
  converting Microsoft's Rich Text Format to \TeX{}.  There is also a
  convertor to \LaTeX{} by Erwin Wechtl, called \ProgName{rtf2latex}.
  The latest converter, by Ujwal Sathyam and Scott Prahl, is
  \ProgName{rtf2latex2e}; this system seems rather good already, and
  is still being improved.

  Translation \emph{to} \acro{RTF} may be done (for a somewhat
  constrained set of \LaTeX{} documents) by \TeX{}2\acro{RTF}, which
  can produce ordinary \acro{RTF}, Windows Help \acro{RTF} (as well as
  \acro{HTML}, \Qref{conversion to HTML}{Q-LaTeX2HTML}).
  \TeX{}2\acro{RTF} is supported on various Unix platforms and under
  Windows~3.1
\item[Microsoft Word] A rudimentary (free) program for converting
  MS-Word to \LaTeX{} is \ProgName{wd2latex}, which runs on \MSDOS{}.
  \ProgName{Word2}\emph{\TeX{}} and \emph{\TeX{}}\ProgName{2Word} are 
  shareware translators from % beware line break
  \href{http://www.chikrii.com/}{Chikrii Softlab}; users' reports are
  very positive.

  If cost is a constraint, the best bet is probably to use an
  intermediate format such as \acro{RTF} or \acro{HTML}.
  \ProgName{Word} outputs and reads both, so in principle this route
  may be useful.

  Another, unlikely, intermediate form is \acro{PDF}: Acrobat Reader
  for Windows (version 5.0 and later) will output rather feeble
  \acro{RTF} that \ProgName{Word} can read.
\item[Excel] \ProgName{Excel2Latex} converts an \ProgName{Excel} file
  into a \LaTeX{} \environment{tabular} environment; it comes as a
  |.xls| file which defines some \ProgName{Excel} macros to produce
  output in a new format.
\end{description}

% beware line breaks
\href{http://www.tug.org/utilities/texconv/index.html}{Wilfried Hennings' \acro{FAQ}},
which deals specifically with conversions between \TeX{}-based formats
and word processor formats, offers much detail as well as tables that
allow quick comparison of features.

A group at Ohio State University (\acro{USA}) is working on
a common document format based on \acro{SGML}, with the ambition that any
format could be
translated to or from this one.  \ProgName{FrameMaker} provides
``import filters'' to aid translation from alien formats
(presumably including \TeX{}) to \ProgName{FrameMaker}'s own.
\begin{ctanrefs}
\item[excel2latex]\CTANref{excel2latex}
\item[pcwritex.arc]\CTANref{pcwritex}
\item[refer and tib tools]\CTANref{refer-tools}
\item[rnototex]\CTANref{rnototex}
\item[rtf2latex]\CTANref{rtf2latex}
\item[rtf2latex2e]\CTANref{rtf2latex2e}
\item[rtf2tex]\CTANref{rtf2tex}
\item[tex2rtf]\CTANref{tex2rtf}
\item[tr2latex]\CTANref{tr2latex}
\item[troff-to-latex]\CTANref{troff-to-latex}
\item[wd2latex]\CTANref{wd2latex}
\item[wp2latex]\CTANref{wp2latex}
\item[\nothtml{\rmfamily}Word processor \acro{FAQ} (source)]%
  \CTANref{texcnvfaq}
\end{ctanrefs}

\Question[Q-readML]{Using \TeX{} to read \acro{SGML} or \acro{XML} directly}

This can nowadays be done, with a certain amount of clever macro
programming.  David Carlisle's \Package{xmltex} is the prime example;
it offers a practical solution to typesetting
\acro{XML} files.

One use of a \TeX{} that can typeset \acro{XML} files is as a backend
processor for \acro{XSL} formatting objects, serialized as \acro{XML}.
Sebastian Rahtz's Passive\TeX{} uses \Package{xmltex} to
achieve this end.
\begin{ctanrefs}
\item[xmltex]\CTANref{xmltex}
\item[passivetex]\CTANref{passivetex}
\end{ctanrefs}

\Question[Q-recovertex]{Retrieving \AllTeX{} from \acro{DVI}, etc.}

The job just can't be done automatically: \acro{DVI}, \PS{} and
\acro{PDF} are ``final'' formats, supposedly not susceptible to
further editing~--- information about where things came from has been
discarded.  So if you've lost your \AllTeX{} source (or never
had the source of a document you need to work on) you've a serious job
on your hands.  In many circumstances, the best strategy is to retype
the whole document, but this strategy is to be tempered by
consideration of the size of the document and the potential typists'
skills.

If automatic assistance is necessary, it's unlikely that any more than
text retrieval is going to be possible; the \AllTeX{} markup that
creates the typographic effects of the document needs to be recreated
by editing.

If the file you have is in \acro{DVI} format, many of the techniques
for \nothtml{converting \AllTeX{} to \acro{ASCII} (}%
\Qref{converting \AllTeX{} to \acro{ASCII}}{Q-toascii}\nothtml{)} are
applicable.  Consider \ProgName{dvi2tty}, \ProgName{crudetype} and
\ProgName{catdvi}.  Remember that there are likely to be problems
finding included material (such as included \PS{} figures, that
don't appear in the \acro{DVI} file itself), and mathematics is
unlikely to convert easily.

To retrieve text from \PS{} files, the
\ProgName{ps2ascii} tool (part of the  \ProgName{ghostscript}
distribution) is available.  One could try applying this tool to
\PS{} derived from an \acro{PDF} file using \ProgName{pdf2ps} (also
from the \ProgName{ghostscript} distribution), or \ProgName{Acrobat}
\ProgName{Reader} itself; an alternative is \ProgName{pdftotext},
which is distributed with \ProgName{xpdf}.

Another avenue available to those with a \acro{PDF} file they want to
process is offered by Adobe \ProgName{Acrobat} (version 5 or later):
you can tag the \acro{PDF} file into an estructured document, output
thence to well-formed \acro{XHTML}, and import the results into
Microsoft \ProgName{Word} (2000 or later).  From there, one may
convert to \AllTeX{} using one of the techniques discussed in
% beware line break
\htmlonly{``}\Qref[question]{converting to and from \AllTeX{}}{Q-fmtconv}\htmlonly{''}.

The result will typically (at best) be poorly marked-up.  Problems may
also arise from the oddity of typical \TeX{} font encodings (notably
those of the maths fonts), which \ProgName{Acrobat} doesn't know how
to map to its standard Unicode representation.
\begin{ctanrefs}
\item[catdvi]\CTANref{catdvi}
\item[crudetype]\CTANref{crudetype}
\item[dvi2tty]\CTANref{dvi2tty}
\item[ghostscript]Browse \CTANref{ghostscript}
\item[xpdf]Browse \CTANref{xpdf}
\end{ctanrefs}

\Question[Q-LaTeXtoPlain]{Translating \LaTeX{} to Plain \TeX{}}

Unfortunately, no ``general'', simple, automatic process is likely to
succeed at this task.  See 
% beware (lots of) line breaks
\nothtml{``How does \LaTeX{} relate to Plain \TeX{}'' (}%
\htmlonly{``}\Qref{How does \LaTeX{} relate to Plain \TeX{}}{Q-LaTeXandPlain}\latexhtml{)}{''}
for further details.

Translating a document designed to work with \LaTeX{} into one
designed to work with Plain \TeX{} is likely to amount to carefully
including (or otherwise re-implementing) all those parts of \LaTeX{},
beyond the provisions of Plain \TeX{}, which the document uses.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Fonts}

\subsection{\MF{} fonts}

\Question[Q-useMF]{Getting \MF{} to do what you want}

\MF{} allows you to create your own fonts, and most \TeX{} users
will never need to use it. \MF{}, unlike \TeX{}, requires some
customisation: each output device for which you will be generating
fonts needs a mode associated with it. Modes are defined using the
|mode_def| convention described on page~94 of \emph{The \MF{}book}
(see \Qref[question]{\TeX{}-related books}{Q-books}). You will need
a file, which conventionally called \File|local.mf|, containing all the
|mode_def|s you will be using. If \File|local.mf| doesn't already
exist, Karl Berry's collection of modes (\File|modes.mf|)
is a good starting point 
(it can be used as a `\File|local.mf|' without modification in a `big
enough' implementation of \MF{}). Lists of
settings for various output devices are also published periodically in
\textsl{TUGboat} (see \Qref[question]{\acro{TUG}}{Q-TUG*}). Now create
a |plain| base
file using \ProgName{inimf}, |plain.mf|, and |local.mf|:
\begin{htmlversion}
\begin{verbatim}
   % inimf
   This is METAFONT...
   **plain # you type plain
   (output)
   *input local # you type this
   (output)
   *dump # you type this
   Beginning to dump on file plain...
   (output)
\end{verbatim}
\end{htmlversion}
\htmlignore
\par\vspace{\topsep}
%\begin{tabular}{@{}l@{}l@{}}
%|% inimf|\\
%This is METAFONT\dots{}\\{}
%**|plain|& you type `|plain|'\\{}
%(output)\\{}
%*|input local|& you type this\\{}
%(output)\\{}
%*|dump|& you type this\\{}
%Beginning to dump on file plain\dots{}\\{}
%(output)\\{}
%\end{tabular}\par
\begin{list}{}{}\item\relax
  |% inimf|\\
  This is METAFONT\dots{}\\{}
  \fullline{**\texttt{plain}\hss you type `\texttt{plain}'}
  (\emph{output})\\{}
  \fullline{*\texttt{input local}\hss you type this}
  (\emph{output})\\{}
  \fullline{*\texttt{dump}\hss you type this}
  Beginning to dump on file plain\dots{}\\{}
  (\emph{output})
\end{list}\par
\endhtmlignore
This will create a base file named \File|plain.base| (or something
similar; for example, it will be
\htmlignore
\acro{\File|PLAIN.BAS|}
\endhtmlignore
\begin{htmlversion}
  \File|PLAIN.BAS|
\end{htmlversion}
on \MSDOS{} systems) which should be moved to the directory containing
the base files on your system (note that some systems have two or more
such directories, one for each `size' of \MF{} used).

Now you need to make sure \MF{} loads this new base when it starts up. If
\MF{} loads the |plain| base by default on your system, then you're
ready to go. Under Unix (using the default \ProgName{web2c}
distribution%
\begin{footnoteenv}
  The \ProgName{command_name} is symbolically linked to
  \ProgName{virmf}, and \ProgName{virmf} loads \File|command_name.base|
\end{footnoteenv})
this does indeed happen, but we could for instance define a command
\ProgName{mf} which executes |virmf &plain| loading the |plain| base
file.

The usual way to create a font with |plain| \MF{} is to start 
it with the line
\htmlignore
\bgroup
\par\vskip\topsep
\hangindent3em\hangafter1\raggedright\parindent10pt\relax
|\mode=<mode name>;| |mag=<magnification>;| |input <font file name>|%
\par\vskip\topsep
\egroup
\noindent in
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
\mode=<mode name>; mag=<magnification>; input <font file name>
\end{verbatim}
in
\end{htmlversion}
response to the `**' prompt or on the \MF{} command line. (If
|<mode name>| is unknown or omitted, the mode defaults to `proof' and
\MF{} will produce an output file called
% beware!! -- argument of \File naturally breaks across line end
\File|<font file name>.2602gf|)
The |<magnification>| is a floating point number or
`magstep' (magsteps are defined in \emph{The \MF{}book} and
\emph{The \TeX{}book}).
If |mag=<magnification>| is omitted, then the default
is 1 (magstep 0).  For example, to generate cmr10 at 12pt for an epson
printer you would type
\begin{verbatim}
  mf \mode=epson; mag=magstep 1; input cmr10
\end{verbatim}
Note that under Unix the |\| and |;| characters must usually be quoted or
escaped, so this would typically look something like
\begin{verbatim}
  mf '\mode=epson; mag=magstep 1; input cmr10'
\end{verbatim}

If you don't have \ProgName{inimf} or need a special mode that isn't
in the base, you can put its commands in a file (\emph{e.g.},
\File|ln03.mf|) and invoke it on the fly with the |\smode| command.
For example, to create \File|cmr10.300gf| for an \acro{LN}03 printer, using
the file
\begin{verbatim}
   % This is ln03.mf as of 1990/02/27
   % mode_def courtesy of John Sauter
   proofing:=0;
   fontmaking:=1;
   tracingtitles:=0;
   pixels_per_inch:=300;
   blacker:=0.65;
   fillin:=-0.1;
   o_correction:=.5;
\end{verbatim}
(note the absence of the |mode_def| and |enddef| commands), you would
type
\begin{verbatim}
   mf \smode="ln03"; input cmr10
\end{verbatim}
This technique isn't one you should regularly use, but it may
prove useful if you acquire a new printer and want to experiment with
parameters, or for some other reason are regularly editing the
parameters you're using.  Once you've settled on an appropriate set of
parameters, you should use them to rebuild the base file that you use.

Other sources of help are mentioned in % beware line break
\Qref[question]{\MF{} and \MP{} Tutorials}{Q-mfptutorials}.
\begin{ctanrefs}
\item[modes.mf]\CTANref{modes-file}
\end{ctanrefs}

\Question[Q-keepfonts]{Which font files should be kept}

\MF{} produces from its run three files, a metrics (\acro{TFM}) file, a
generic font (\acro{GF}) file, and a log file; all of these files have the
same base name as does the input (\emph{e.g.}, if the input file was
\File|cmr10.mf|, the outputs will be \File|cmr10.tfm|,
\File|cmr10.nnngf|%
\begin{footnoteenv}
  Note that the file name may be transmuted by such operating systems
  as \MSDOS{}, which don't permit long file names
\end{footnoteenv}
and \File|cmr10.log|).

For \TeX{} to use the font, you need a \acro{TFM} file, so you need
to keep that.  However, you are likely to generate the same font
at more than one magnification, and each time you do so you'll
(incidentally) generate another \acro{TFM} file; these files are
all the same, so you only need to keep one of them.

To preview or to produce printed output, the \acro{DVI} processor will need a
font raster file; this is what the \acro{GF} file provides.  However, while
there used (once upon a time) to be \acro{DVI} processors that could use
\acro{GF} files, modern processors use packed raster (\acro{PK}) files.
Therefore, you need to generate a \acro{PK} file from the \acro{GF} file; the
program \ProgName{gftopk} does this for you, and once you've done that you
may throw the \acro{GF} file away.

The log file should never need to be used, unless there was some sort
of problem in the \MF{} run, and need not be ordinarily kept.

\Question[Q-getbitmap]{Acquiring bitmap fonts}

When \acro{CTAN} was established, most people would start using \TeX{}
with a 300 dots-per-inch (dpi) laser printer, and sets of Computer
Modern bitmap fonts for this resolution are available on \acro{CTAN}
(there are separate sets for write-black and write-white printers.)

At that time, there were regular requests that \acro{CTAN} should hold
a wider range of resolutions, but they were resisted for two reasons:
\begin{enumerate}
\item When \MF{} creates a bitmap font, it needs to know the
  characteristics of the device; who knows what 600 or 1270~dpi device
  you have?  (Of course, this objection applies equally well to
  300~dpi printers.)
\item Bitmap fonts get \emph{big} at high resolutions. Who knows what
  fonts at what sizes people are going to need?
\end{enumerate}
Fortunately, \AllTeX{} distribution technology has put a stop to these
arguments: most (if not all) current distributions generate bitmap
fonts as needed, and cache them for later re-use.  The impatient
user, who is determined that all bitmap fonts should be created once
and for all, may be supported by scripts such as \ProgName{allcm}
(distributed with te\TeX{}, at least; otherwise such a person should
consult \Qref[question]{"the use of \MF{}"}{Q-useMF}).

If your output is to a \PS{}-capable device, it may be worth
switching to Type~1 versions of the \acro{CM} fonts.  Two free
versions are currently available; the older (\Package{bakoma}) is
somewhat less well produced than the \Package{bluesky} fonts, which were
originally professionally produced and sold, but were then donated to
the public domain by their originators \YandY{} and Bluesky Research,
in association with the \acro{AMS}.  Unfortunately, the coverage of
the sets is slightly different, but the present author hasn't found
the need to use \Package{bakoma} since \Package{bluesky} became
available.  In recent years, several other `\MF{}' fonts have become
available in Type~1 format; it's common never to find the need of
generating bitmap fonts for any purpose other than previewing (see
% beware of line wrap
\Qref[question]{``previewing documents with Type~1 fonts''}{Q-PSpreview}).

The commercial font suppliers continue just to keep ahead of the free
software movement, and provide Type~1 versions of the \acro{EC} fonts,
\acro{CM}-style Cyrillic fonts, as well as a range of mathematical
fonts to replace those in the \acro{CM} family (see
\Qref[question]{``choice of scalable fonts''}{Q-psfchoice}).
\begin{ctanrefs}
\item[bakoma]\CTANref{bakoma}
\item[bluesky]Browse \CTANref{bluesky}
\item[cm fonts \nothtml{\rmfamily}(write-black printers)]\CTANref{pk300}
\item[cm fonts \nothtml{\rmfamily}(write-white printers)]\CTANref{pk300w}
\end{ctanrefs}

\subsection{Adobe Type~1 (``\PS{}'') fonts}

\Question[Q-usepsfont]{Using \PS{} fonts with \protect\TeX{}}

In order to use \PS{} fonts, \TeX{} needs
\emph{metric} (called \acro{TFM}) files. Several sets of metrics are
available from the archives; for mechanisms for generating new ones,
see \Qref[question]{metrics for \PS{} fonts}{Q-metrics}.  You
also need the fonts themselves; \PS{} printers come with a set of
fonts built in, but to extend your repertoire you almost invariably
need to buy from one of the many commercial font vendors (see, for
example, \Qref[question]{``choice of fonts''}{Q-psfchoice}).

If you use \LaTeXe{}, the best way to get \PS{} fonts into your
document is to use the \acro{PSNFSS} package maintained by Walter
Schmidt; it's supported by
the \LaTeX{}3 project team, so bug reports can and should be submitted. 
\acro{PSNFSS} gives you a set of packages for changing the default
roman, sans-serif and typewriter fonts; \emph{e.g}., \File|times.sty| will set
up Times Roman, Helvetica and Courier in place of Computer Modern,
while \File|avant.sty| just changes the sans-serif family to
AvantGarde. To go with these packages, you will need the font metric
files (watch out for encoding problems!~--- see
\Qref[question]{metrics for \PS{} fonts}{Q-metrics})
and font description (\texttt{.fd}) files for each font family you
want to use.  For convenience,
metrics for the common `35' \PS{} fonts found in most \PS{} printers
are provided with \acro{PSNFSS}, packaged as the ``Laserwriter set''.

For older versions of \LaTeX{} there are various schemes, of which the
simplest to use is probably the \acro{PS}\LaTeX{} macros distributed with
\ProgName{dvips}.

For Plain \TeX{}, you load whatever fonts you like; if the encoding of
the fonts is not the same as Computer Modern it will be up to you to
redefine various macros and accents, or you can use the font
re-encoding mechanisms available in many drivers and in
\ProgName{ps2pk} and \ProgName{afm2tfm}.

Victor Eijkhout's\nothtml{ Lollipop package (}%
\Qref{Lollipop package}{Q-lollipop}\nothtml{)}
supports declaration of font families and styles in a similar way to
\LaTeX{}'s \acro{NFSS}, and so is easy to use with \PS{} fonts.

Some common problems encountered are discussed elsewhere
(see \Qref[question]{problems with \acro{PS} fonts}{Q-psfontprob}).
\begin{ctanrefs}
\item[Laserwriter set of 35 fonts]\CTANref{lw35nfss-zip}
\item[lollipop]\CTANref{lollipop}
\item[psnfss]\CTANref{psnfss}
\end{ctanrefs}

\Question[Q-PSpreview]{Previewing files using Type 1 fonts}

Until recently, free \TeX{} previewers have only been capable of
displaying bitmap \acro{PK} fonts.  (\YandY{}'s commercial previewer
\nothtml{\acro{DVIW}indo~--- }% beware line break
\Qref{\acro{DVIW}indo}{Q-commercial}\nothtml{~---}
has long used \ProgName{Adobe} \ProgName{Type} \ProgName{Manager} to
display Type~1 fonts directly, and the most recent releases of
\ProgName{xdvi} sport a Type~1 font renderer.)  Other previewers of
the current generation offer automatic generation of the
requisite \acro{PK} files (using \ProgName{gsftopk}, or similar, behind
the scenes).  If your previewer isn't capable of this, you have three
options:
\begin{enumerate}
\item Convert the \acro{DVI} file to \PS{} and use a
  \PS{} previewer.  Some systems offer this capability as
  standard, but most people will need to use a separate previewer such
  as \ProgName{ghostscript} or \ProgName{ghostscript}-based viewers
  such as \ProgName{ghostview} or shareware offering \ProgName{GSview}.
\item Under Windows on a \acro{PC}, or on a Macintosh, let Adobe Type Manager
  display the fonts. Textures (Macintosh) works like this, and under
  Windows you can use \YandY{}'s \ProgName{dviwindo} for bitmap-free
  previewing.
\htmlignore
  (See \Qref[question]{}{Q-commercial} for details of these
  suppliers.)
\endhtmlignore
\begin{htmlversion}
    (See \Qref{commercial suppliers}{Q-commercial} for details.)
\end{htmlversion}
\item If you have the \PS{} fonts in Type~1 format,
  use \ProgName{ps2pk} or \ProgName{gsftopk}
  (designed for use with the \ProgName{ghostscript} fonts) to make
  \acro{PK} bitmap fonts which your previewer 
  will understand. This can produce excellent results, also suitable
  for printing with non-\PS{} devices. Check the legalities of
  this if you have purchased the fonts. The very commonest \PS{}
  fonts such as Times and Courier come in Type~1 format on disk with
  Adobe Type Manager (often bundled with Windows, and part of \acro{OS/}2).
\end{enumerate}
\begin{ctanrefs}
\item[ghostscript]Browse \CTANref{ghostscript}
\item[ghostview]Browse \CTANref{ghostview}
\item[gsftopk]\CTANref{gsftopk}
\item[GSview]Browse \CTANref{gsview}
\item[ps2pk]\CTANref{ps2pk}
\item[xdvi]\CTANref{xdvi}
\end{ctanrefs}

\Question[Q-metrics]{\protect\TeX{} font metric files for \PS{} fonts}

Reputable font vendors such as Adobe supply metric files for each
font, in \acro{AFM} (Adobe Font Metric) form; these can be converted
to \acro{TFM} (\TeX{} Font Metric) form. Most modern distributions have
prebuilt metrics which will be more than enough for many people; but you may
need to do the conversion yourself if you have special needs or
acquire a new font. One important question is the \emph{encoding} of
(Latin character) fonts; while we all more or less agree about the
position of about 96 characters in fonts (the basic \acro{ASCII} set), the
rest of the (typically) 256 vary. The most obvious problems are with
floating accents and special characters such as the `pounds sterling'
sign. There are three ways of dealing with this: either you change the
\TeX{} macros which reference the characters (not much fun, and
error-prone); or you change the encoding of the font (easier than you
might think); or you use
\nothtml{virtual fonts (}% beware line wrap
\Qref{virtual fonts}{Q-virtualfonts}\nothtml{)}
to \emph{pretend} to
\TeX{} that the encoding is the same as it is used to.
\LaTeXe{} has facilities for dealing with fonts in different
encodings; read the \nothtml{\emph{\LaTeX{} Companion} (}% beware line wrap
\Qref{\emph{\LaTeX{} Companion}}{Q-books}\nothtml{)} for more details. 
In practice, if you do much non-English (but Latin script)
typesetting, you are strongly recommended to use the \texttt{fontenc}
package with option `\texttt{T1}' to select
\nothtml{`Cork' (}\Qref{`Cork'}{Q-ECfonts}\nothtml{)} encoding.
A useful alternative is \YandY{}'s ``private'' \acro{LY}1 encoding,
which is designed to sit well with ``Adobe standard'' encoded fonts.
Basic support of \acro{LY1} is available on \acro{CTAN}: note that the
``relation with Adobe's encoding'' means that there are no
virtual fonts in the \acro{LY}1 world.

Alan Jeffrey's \ProgName{fontinst} package is an
\acro{AFM} to \acro{TFM} converter written in \TeX{}; it is used to
generate the
files used by \LaTeXe{}'s \acro{PSNFSS} package 
to support use of \PS{} fonts. It is a sophisticated package, not
for the faint-hearted, but is powerful enough to cope with most needs.
Much of its power relies on the use of
\nothtml{virtual fonts (}\Qref{virtual fonts}{Q-virtualfonts}\nothtml{)}.

For slightly simpler problems, Rokicki's \ProgName{afm2tfm},
distributed with \ProgName{dvips}, is fast and
efficient; note that the metrics and styles that come with
\ProgName{dvips} are \emph{not} currently \LaTeXe{} compatible.

For the Macintosh, there is a program called \ProgName{EdMetrics} which does
the job (and more).  \ProgName{EdMetrics} comes with the (commercial)
Textures distribution, but is itself free software, and is available
on \acro{CTAN}.

Windows users can buy
\nothtml{\YandY{}'s (}\Qref{\YandY{}'s}{Q-commercial}\nothtml{)}
Font Manipulation Tools package which includes a powerful
\ProgName{afmtotfm} program among many other goodies.
\begin{ctanrefs}
\item[dvips]\CTANref{dvips}
\item[EdMetrics]\CTANref{edmetrics}
\item[fontinst]\CTANref{fontinst}
\item[LY1 support]\CTANref{ly1}
\end{ctanrefs}

\Question[Q-psfontprob]{Deploying Type 1 fonts}

For the \LaTeX{} user trying to use the
\nothtml{\acro{PSNFSS} (}\Qref{\acro{PSNFSS}}{Q-usepsfont}\nothtml{)}
package, three questions may arise.

First, you have to declare to the \acro{DVI} driver that you are using
\PS{} fonts; in the case of \ProgName{dvips}, this means adding
lines to the |psfonts.map| file, so that \ProgName{dvips} will know
where the proper fonts are, and won't try to find \acro{PK} 
files.  If the font isn't built into the printer, you have to acquire
it (which may mean that you need to purchase the font files).

Second, your previewer must know what to do with the fonts: see
\Qref[question]{previewing type 1 fonts}{Q-PSpreview}.

Third, the stretch and shrink between words is a function of the
font metric; it is not specified in \acro{AFM} files, so different converters
choose different values. The \PS{} metrics that come with \acro{PSNFSS} 
used to produce quite tight setting, but they were revised in mid 1995
to produce a compromise between American and European practice. 
Sophisticated users may not find even the new the values to their taste, and
want to override them. Even the casual user may find  more
hyphenation or overfull boxes than Computer Modern produces; but \acro{CM}
is extremely generous. 

\Question[Q-psfchoice]{Choice of scalable outline fonts}

If you are interested in text alone, you can use any of over 20,000
fonts(!) in Adobe Type~1 format (called `\PS{} fonts' in the
\TeX{} world and `\acro{ATM} fonts' in the DTP world), or any of several
hundred fonts in TrueType format.  That is, provided of course, that
your previewer and printer driver support scalable outline fonts.

\TeX{} itself \emph{only} cares about metrics, not the actual
character programs.  You just need to create a \TeX{} metric file
\acro{TFM} using some tool such as \ProgName{afm2tfm} (possibly in
combination with \ProgName{vptovf}), \ProgName{afmtotfm}
(from \YandY{}, see
%beware line wrap
\Qref[question]{commercial implementations}{Q-commercial})
or \ProgName{fontinst}.  For the previewer or printer driver you need the
actual outline font files themselves (|pfa| for Display \PS{}, |pfb|
for \acro{ATM} on \acro{IBM} \acro{PC}, Mac outline font files on Macintosh).

If you also need mathematics, then you are severely limited by the
demands that \TeX{} makes of maths fonts (for details, see the paper by B.K.P. 
Horn in \TUGboat{} 14(3)).
For maths, then, there are relatively few choices (though the list is
at last growing).  There are several font families available that are
based on Knuth's original designs, and some that complement other
commercial text font designs; one set (MicroPress's `informal math')
stands alone.
\begin{booklist}
\item[Computer Modern](75 fonts~--- optical scaling) Donald E. Knuth\\
  The \acro{CM} fonts were originally designed in \MF{}, but are also
  now available in scalable outline form.  There are commercial as
  well as public domain versions, and there are both Adobe Type~1 and
  TrueType versions.  A set of outline versions of the fonts was
  developed as a commercial venture by \YandY{} and Blue Sky Research;
  they have since assigned the copyright to the \acro{AMS}, and the
  fonts are now freely available from \acro{CTAN}.  Their quality is
  such that they have become the \emph{de facto} standard for Type~1
  versions of the fonts.
\item[\acro{AMS} fonts](52 fonts, optical scaling) The \acro{AMS}\\
  This set of fonts offers adjuncts to the \acro{CM} set, including
  two sets of symbol fonts (|msam| and |msbm|) and Euler text fonts.
  These are not a self-standing family, but merit discussion here (not
  least because several other families mimic the symbol fonts).
  Freely-available Type~1 versions of the fonts are available on
  \acro{CTAN}.  The \Package{eulervm} package permits use
  of the Euler maths alphabet in conjunction with text fonts that do
  not provide maths alphabets of their own (for instance, Adobe
  Palatino or Minion).
\item[Computer Modern Bright](62 fonts~--- optical scaling) Walter
  Schmidt\\
  \acro{CM} Bright is a family of sans serif fonts, based on Knuth's
  \acro{CM} fonts.  It comprises the fonts necessary for mathematical
  typesetting, including \acro{AMS} symbols, as well as text and text
  symbol fonts of various shapes.  The collection comes with its own
  set of files for use with \LaTeX{}.  The \acro{CM} Bright fonts are
  supplied in Type~1 format by MicroPress, Inc.; free versions are
  available on \acro{CTAN}~--- the \Package{hfbright} set for use with
  text using \acro{OT}1 encoding and the \Package{cm-super} set for
  use with \acro{T}1.

  \nothtml{\bgroup\raggedwithindent}
  For further details of Micropress' offering (including samples) see\\
  \URL{http://www.micropress-inc.com/fonts/brmath/brmain.htm}
  \nothtml{\par\egroup}
\item[Concrete Math](25 fonts~--- optical scaling) Ulrik Vieth\\
  The Concrete Math font set was derived from the Concrete Roman
  typefaces designed by Knuth.  The set provides a collection of math
  italics, math symbol, and math extension fonts, and fonts of
  \acro{AMS} symbols that fit with the Concrete set, so that Concrete
  may be used as a complete replacement for Computer Modern.  Since
  Concrete is considerably darker than \acro{CM}, the family may
  particularly attractive for use in low-resolution printing or in
  applications such as posters or transparencies.  Concrete Math
  fonts, as well as Concrete Roman fonts, are supplied in Type 1
  format by MicroPress, Inc.

  \nothtml{\bgroup\raggedwithindent}
  For further information (including samples) see\\
  \URL{http://www.micropress-inc.com/fonts/ccmath/ccmain.htm}
  \nothtml{\par\egroup}
\item[BA Math](13 fonts) MicroPress Inc.\\
  BA Math is a family of serif fonts, inspired by the elegant
  and graphically perfect font design of John Baskerville.  BA
  Math comprises the fonts necessary for mathematical typesetting
  (maths italic, math symbols and extensions) in normal and bold
  weights.  The family also includes all \acro{OT}1 and \acro{T}1
  encoded text fonts of various shapes, as well as fonts with most
  useful glyphs of the \acro{TS}1 encoding.  Macros for using the
  fonts with Plain~\TeX{}, \LaTeXo{} and current \LaTeX{} are
  provided.

  \nothtml{\bgroup\raggedwithindent}
  For further details (including samples) see\\
  \URL{http://www.micropress-inc.com/fonts/bamath/bamain.htm}
  \nothtml{\par\egroup}
\item[HV Math](14 fonts) MicroPress Inc.\\
  HV Math is a family of sans serif fonts, inspired by the
  Helvetica (\acro{TM}) typeface.  HV Math comprises the fonts
  necessary for mathematical typesetting (maths italic, maths symbols
  and extensions) in normal and bold weights.  The family also
  includes all \acro{OT}1 and \acro{T}1 encoded text fonts of various
  shapes, as well as fonts with most useful glyphs of the \acro{TS}1
  encoding.  Macros for using the fonts with Plain~\TeX{}, \LaTeXo{}
  and current \LaTeX{} are provided.  Bitmapped copies of the fonts
  are available free, on \acro{CTAN}.

  \nothtml{\bgroup\raggedwithindent}
  For further details (and samples) see\\
  \URL{http://www.micropress-inc.com/fonts/hvmath/hvmain.htm}
  \nothtml{\par\egroup}
\item[Informal Math](7 outline fonts) MicroPress Inc.\\
  Informal Math is a family of fanciful fonts loosely based on the
  Adobe's Tekton (\acro{TM}) family, fonts which imitate handwritten
  text.  Informal Math comprises the fonts necessary for
  mathematical typesetting (maths italic, maths symbols and extensions)
  in normal weight, as well as \acro{OT}1 encoded text fonts in
  upright and oblique shapes.  Macros for using the fonts with
  Plain~\TeX{}, \LaTeXo{} and current \LaTeX{} are provided.

  \nothtml{\bgroup\raggedwithindent}
  For further details (including samples) see\\
  \URL{http://www.micropress-inc.com/fonts/ifmath/ifmain.htm}
  \nothtml{\par\egroup}
\item[Lucida Bright \emph{with} Lucida New Math](25 fonts) Chuck Bigelow and
  Kris Holmes\\
  Lucida is a family of related fonts including seriffed, sans serif,
  sans serif fixed width, calligraphic, blackletter, fax, Kris Holmes'
  connected handwriting font, \emph{etc}; they're not as `spindly' as
  Computer Modern, with a large x-height, and include a larger set of
  maths symbols, operators, relations and delimiters than \acro{CM}
  (over 800 instead of 384: among others, it also includes the
  \acro{AMS} |msam| and |msbm| symbol sets).  `Lucida Bright Expert'
  (14 fonts) adds seriffed fixed width, another handwriting font,
  smallcaps, bold maths, upright `maths italic', \emph{etc}., to the
  set.  The distribution includes support for use with Plain \TeX{}
  and \LaTeXo{}.  Support under \LaTeXe{} is provided in \htmlignore
  \acro{PSNFSS} (\Qref{}{Q-usepsfont}) \endhtmlignore
\begin{htmlversion}
  \Qref{\acro{PSNFSS}}{Q-usepsfont}
\end{htmlversion}
  thanks to Sebastian Rahtz and David Carlisle.

  \nothtml{\bgroup\raggedwithindent}
  For a sample, see \URL{http://www.YandY.com/download/chironlb.pdf}
  \nothtml{\par\egroup}
\item[MathTime 1.1](3 fonts) Publish or Perish (Michael Spivak)\\
  The set contains maths italic, symbol, and extension fonts, designed
  to work well with the Times-Roman family, which is resident on many
  printers, and which is supplied with some \acro{PC} versions.  In
  addition you may want to complement this basic set with Adobe's
  Times Smallcap, and perhaps the set of Adobe `Math Pi' fonts, which
  include blackboard bold, blackletter, and script faces.

  \nothtml{\bgroup\raggedwithindent}
  For a sample, see \URL{http://www.YandY.com/download/chironmt.pdf}
  \nothtml{\par\egroup}
\item[MathTime Plus](12 fonts) Publish or Perish (Michael Spivak)\\
  Adds bold and heavy versions of the basic math fonts, as well as
  upright math ``italic''.  There are also Greek letters for use in
  typesetting terms commonly used in physics, as well as regular and
  bold script faces.  Both MathTime distributions include support for
  use with Plain \TeX{} and \LaTeXo{} (including code to link in
  Adobe Math Pi~2 and Math Pi~6).  Support under \LaTeXe{} is provided
  in
\htmlignore
  \acro{PSNFSS} (\Qref{}{Q-usepsfont})
\endhtmlignore
\begin{htmlversion}
  \Qref{\acro{PSNFSS}}{Q-usepsfont}
\end{htmlversion}
  thanks to Frank Mittelbach and David Carlisle.

  \nothtml{\bgroup\raggedwithindent}
  For a sample, see \URL{http://www.YandY.com/download/mathplus.pdf}
  \nothtml{\par\egroup}
\item[TM Math](14 fonts) MicroPress Inc.\\
  TM Math is a family of serif fonts, inspired by the Times
  (\acro{TM}) typeface.  TM Math comprises the fonts necessary for
  mathematical typesetting (maths italic, maths symbols and extensions)
  in normal and bold weights. The family also includes all \acro{OT}1
  and \acro{T}1 encoded text fonts of various shapes, as well as fonts
  with most useful glyphs of the \acro{TS}1 encoding.  Macros for
  using the fonts with Plain~\TeX{}, \LaTeXo{} and current \LaTeX{}
  are provided.  Bitmapped copies of the fonts are available free, on
  \acro{CTAN}.

  \nothtml{\bgroup\raggedwithindent}
  For further details (and samples) see\\
  \URL{http://www.micropress-inc.com/fonts/tmmath/tmmain.htm} 
  \nothtml{\par\egroup}
\item[Belleek](3 fonts) Richard Kinch\\
  Belleek is the upshot of Kinch's thoughts on how \MF{} might be used
  in the future: they were published simultaneously as \MF{} source,
  as Type~1 fonts, and as TrueType fonts.  The fonts act as ``drop-in''
  replacements for the basic MathTime set (as an example of ``what might
  be done'').

  The paper outlining Kinch's thoughts, proceeding from considerations
  of the `intellectual' superiority of \MF{} to evaluations of why its
  adoption is so limited and what might be done about the problem, is
  to be found at \URL{http://truetex.com/belleek.pdf} (the paper is a
  good read, but exhibits the problems discussed in
  % beware line wrap
  \htmlonly{``}\Qref[question]{getting good \acro{PDF}}{Q-dvips-pdf}\htmlonly{''}~---
  don't try to read it on-screen in Acrobat reader).
% somewhere in the first paragraph of th PA Math item, there's a
% character emitted by something that produces the diagnostic
% "Missing character: There is no   in font ptmr7t!"
% is something emitting \char32?
\item[PA Math] PA Math is a family of serif fonts
  loosely based on the Palatino (\acro{TM}) typeface.  PA Math
  comprises the fonts necessary for mathematical typesetting (maths
  italics, maths, calligraphic and oldstyle symbols, and extensions)
  in normal and bold weights. The family also includes all \acro{OT}1,
  \acro{T}1 encoded text fonts of various shapes, as well as fonts
  with the most useful glyphs of the \acro{TS}1 encoding.  Macros for
  using the fonts with Plain~\TeX{}, \LaTeXo{} and current \LaTeX{}
  are provided.

  \nothtml{\bgroup\raggedwithindent}
  For further details (and samples) see\\
  \URL{http://www.micropress-inc.com/fonts/pamath/pamain.htm} 
  \nothtml{\par\egroup}
\item[\texttt{mathpazo} version 1.003](5 fonts) by Diego Puga\\
  The Pazo Math fonts are a family of type~1 fonts suitable for
  typesetting maths in combination with the Palatino family of text
  fonts.  Four of the five fonts of the distribution are maths
  alphabets, in upright and italic shapes, medium and bold weights;
  the fifth font contains a small selection of ``blackboard bold''
  characters (chosen for their mathematical significance).  Support
  under \LaTeXe{} is available in \nothtml{\acro{PSNFSS} (}%
  \Qref{\acro{PSNFSS}}{Q-usepsfont}\nothtml{)}; the fonts are
  licensed under the \acro{GPL}, with legalese permitting the use of
  the fonts in published documents.
\item[\texttt{pxfonts} set version 1.0](26 fonts) by Young Ryu\\
  The \texttt{pxfonts} set consists of
  \begin{itemize}
  \item virtual text fonts using Adobe Palatino (or the \acro{URW}
    replacement used by \ProgName{ghostscript}) with modified plus,
    equal and slash symbols;
  \item maths alphabets using times;
  \item maths fonts of all symbols in the computer modern maths fonts
    (|cmsy|, |cmmi|, |cmex| and the Greek letters of |cmr|)
  \item maths fonts of all symbols corresponding to the \acro{AMS}
    fonts (|msam| and |msbm|);
  \item additional maths fonts of various symbols.
  \end{itemize}
  The text fonts are available in \acro{OT}1, \acro{T}1 and \acro{LY}1
  encodings, and \acro{TS} encoded symbols are also available.  The
  sans serif and monospaced fonts supplied with the \texttt{txfonts}
  set (see below) may be used with \texttt{pxfonts}; the
  \texttt{txfonts} set should be installed whenever \texttt{pxfonts}
  are.  \LaTeX{}, \ProgName{dvips} and \PDFTeX{} support files are
  included.  The
\htmlignore
\ifpdf
  \href{http://www.tex.ac.uk/tex-archive/fonts/pxfonts/doc/pxfontsdocA4.pdf}%
       {documentation}
\else
  documentation (%
  \URL{http://www.tex.ac.uk/tex-archive/fonts/pxfonts/doc/pxfontsdocA4.pdf})
\fi
\endhtmlignore
\begin{htmlversion}
  \href{http://www.tex.ac.uk/tex-archive/fonts/pxfonts/doc/pxfontsdocA4.pdf}{documentation}
\end{htmlversion}
  is readily available.

  The fonts are licensed under the \acro{GPL}; use in published
  documents is permitted.
\item[\texttt{txfonts} set version 3.1](42 fonts) by Young Ryu\\
  The \texttt{txfonts} set consists of
  \begin{itemize}
  \item virtual text fonts using Adobe Times (or the \acro{URW}
    replacement used by \ProgName{ghostscript}) with modified plus,
    equal and slash symbols;
  \item matching sets of sans serif and monospace (`typewriter')
    fonts (the sans serif set is based on Adobe Helvetica);
  \item maths alphabets using times;
  \item maths fonts of all symbols in the computer modern maths fonts
    (|cmsy|, |cmmi|, |cmex| and the Greek letters of |cmr|)
  \item maths fonts of all symbols corresponding to the \acro{AMS}
    fonts (|msam| and |msbm|);
  \item additional maths fonts of various symbols.
  \end{itemize}
  The text fonts are available in \acro{OT}1, \acro{T}1 and \acro{LY}1
  encodings, and \acro{TS} encoded symbols are also available.
  \LaTeX{}, \ProgName{dvips} and \PDFTeX{} support files are included.
\htmlignore
\ifpdf
  The
  \href{http://www.tex.ac.uk/tex-archive/fonts/txfonts/doc/txfontsdocA4.pdf}%
       {documentation}
\else
  The documentation (%
  \URL{http://www.tex.ac.uk/tex-archive/fonts/txfonts/doc/txfontsdocA4.pdf})
\fi
\endhtmlignore
\begin{htmlversion}
  The
  \href{http://www.tex.ac.uk/tex-archive/fonts/txfonts/doc/txfontsdocA4.pdf}{documentation}
\end{htmlversion}
  is readily available.

  The fonts are licensed under the \acro{GPL}; use in published
  documents is permitted.
\item[Adobe Lucida, LucidaSans \emph{and} LucidaMath](12 fonts)\\
  Lucida and LucidaMath are generally considered to be a bit heavy.
  The three maths fonts contain only the glyphs in the \acro{CM} maths
  italic, symbol, and extension fonts.  Support for using LucidaMath
  with \TeX{} is not very good; you will need to do some work
  reencoding fonts \emph{etc}.  (In some sense this set is the
  ancestor of the LucidaBright plus LucidaNewMath font set.)
\item[Proprietary fonts]Various sources.\\
  Since having a high quality font set in scalable outline form that
  works with \TeX{} can give a publisher a real competitive advantage,
  there are some publishers that have paid (a lot) to have such font
  sets made for them.  Unfortunately, these sets are not available on
  the open market, despite the likelihood that they're more complete
  than those that are.
\item[Mathptmx]Alan Jeffrey, Walter Schmidt and others.\\
  This set contains maths italic, symbol, extension, and roman virtual
  fonts, built from Adobe Times, Symbol, Zapf Chancery, and the
  Computer Modern fonts.  The resulting mixture is not  entirely
  acceptable, but can pass in many circumstances.  The real advantage
  is that the mathptm fonts are (effectively) free, and the resulting
  \PS{} files can be freely exchanged.  Support under \LaTeXe{}
  is available in \nothtml{\acro{PSNFSS} (}% beware line break
  \Qref{\acro{PSNFSS}}{Q-usepsfont}\nothtml{)}.
\end{booklist}
The very limited selection of commercial maths font sets is a direct result of
the fact that a maths font has to be explicitly designed for use with
\TeX{} and as a result it is likely to lose some of its appeal in
other markets. Furthermore, the \TeX{} market for commercial fonts is
minute (in comparison, for example, to Microsoft TrueType font pack~1,
which sold something like 10 million copies in a few weeks after 
release of Windows 3.1!).

Text fonts in Type~1 format are available from many vendors including
Adobe, Monotype and Bitstream.  Avoid cheap rip-offs: not only are you
rewarding unethical behaviour, destroying the cottage industry of
innovative type design, but you are \emph{also} very likely to get junk.
The fonts may not render well (or at all under \acro{ATM}), may not have the
`standard' complement of 228 glyphs, or may not include metric files
(needed to make \acro{TFM} files).

TrueType remains the ``native'' format for Windows.  Some \TeX{}
implementations such as \nothtml{True\TeX{} (}%
% beware line break
\Qref{True\TeX{}}{Q-commercial}\nothtml{)} use TrueType versions of
Computer Modern and Times Maths fonts to render \TeX{} documents in
Windows without the need for additional system software like
\acro{ATM}.

When choosing fonts, your own system environment may not be the only one of
interest.  If you will be sending your finished documents to others for
further use, you should consider whether a given font format will introduce
compatibility problems.  Publishers may require TrueType exclusively because
their systems are Windows-based, or Type~1 exclusively, because their systems
are based on the early popularity of that format in the publishing industry.
Many service bureaus don't care as long as you present them with a finished
print file (\PS{} or \acro{PDF}) for their output device.
\begin{ctanrefs}
\item[CM \nothtml{\normalfont}family collection]%
  Browse \CTANref{cm-AMStype1}
\item[AMS \nothtml{\normalfont}font collection]%
  Browse \CTANref{ams-AMStype1}
\item[Belleek \nothtml{\normalfont}fonts]%
  \CTANref{belleek}
\item[CM-super \nothtml{\normalfont}collection]\CTANref{cm-super}
\item[eulervm.sty \nothtml{\normalfont}and supporting metrics]%
  \CTANref{eulervm}
\item[hfbright \nothtml{\normalfont}collection]\CTANref{hfbright}
\item[hvmath \nothtml{\normalfont\itshape}(free bitmapped version)]%
  \CTANref{hvmath}
\item[pxfonts]\CTANref{pxfonts}
\item[tmmath \nothtml{\normalfont\itshape}(free bitmapped version)]%
  \CTANref{tmmath}
\item[txfonts]\CTANref{txfonts}
\end{ctanrefs}

\Question[Q-charshift]{Weird characters in \ProgName{dvips} output}
\keywords{fi ligature pound pounds sterling elephants}

You've innocently generated output, using \ProgName{dvips}, and there
are weird transpositions in it: for example, the |fi| ligature has
appeared as a {\nothtml{\fontencoding{T1}}\textsterling{}} symbol.
This is an unwanted side-effect of the
precautions\nothtml{ about generating \PS{} for \acro{PDF}} % beware line break
outlined in \Qref[question]{generating \PS{} for PDF}{Q-dvips-pdf}.
The |-G1| switch discussed in that question is appropriate for
Knuth's text fonts, but doesn't work with text fonts that don't follow
Knuth's patterns (such as fonts supplied by Adobe).

If the problem arises, suppress the |-G1| switch: if you were using it
explicitly, \emph{don't}; if you were using |-Ppdf|, add |-G0| to
suppress the implicit switch in the pseudo-printer file.

The problem has been corrected in \ProgName{dvips} v~5.90 (the
version distributed with the \TeX{}-Live~7 \CDROM{} and in other
recent \TeX{} distributions).

\subsection{Particular font families}

\Question[Q-concrete]{Using the ``Concrete'' fonts}

The Concrete Roman fonts were designed by Don Knuth for a book called
``Concrete Mathematics'', which he wrote with Graham and Patashnik
(\emph{the} Patashnik, of \BibTeX{} fame).  Knuth
only designed text fonts, since the book used the Euler fonts for
mathematics.  The book was typeset using Plain \TeX{}, of course, with
additional macros that may be viewed in a file \File|gkpmac.tex|,
which is available on \acro{CTAN}.  A few years later, Ulrik Vieth
designed the Concrete Math fonts.  The packages \Package{beton},
\Package{concmath}, and \Package{ccfonts} are \LaTeX{} packages that
change the default text fonts from Computer Modern to Concrete.
Packages \Package{beton} and \Package{ccfonts} also slightly increase
the default value of \cs|baselineskip| to account for the rather
heavier weight of the Concrete fonts.  Packages
\Package{concmath}, and \Package{ccfonts} also change the default math
fonts from Computer Modern to Concrete and use the Concrete versions
of the \acro{AMS} fonts (this last behaviour is optional in the case
of the \Package{concmath} package).

There are no bold Concrete fonts, but it is generally accepted that
the Computer Modern Sans Serif demibold condensed fonts are an
adequate substitute.  If you are using \Package{concmath} or
\Package{ccfonts} and you want to follow this suggestion, then use the
package with \pkgoption{boldsans} class option (in spite of the fact
that the \Package{concmath} documentation calls it
\pkgoption{sansbold} class option). If you are using \Package{beton},
add \cmdinvoke{renewcommand}{\cs|bfdefault|}{sbc} to the preamble of
your document.

Type~1 versions of the fonts are available.  For the OT1 encoding,
they are available from \nothtml{MicroPress (}% beware line break
\Qref{MicroPress}{Q-psfchoice}\nothtml{)}.  The
\nothtml{CM-Super fonts (}% beware line break
\Qref{CM-Super fonts}{Q-textrace}\nothtml{)} contain Type~1 versions
of the Concrete fonts in the T1 encoding.
\begin{ctanrefs}
\item[beton.sty]\CTANref{beton}
\item[ccfonts.sty]\CTANref{ccfonts}
\item[\nothtml{\rmfamily}CM-Super fonts]\CTANref{cm-super}
\item[concmath.sty]\CTANref{concmath}
\item[\nothtml{\rmfamily}Concmath fonts]\CTANref{concmath-f}
\item[\nothtml{\rmfamily}Concrete fonts]\CTANref{concrete}
\item[gkpmac.tex]\CTANref{gkpmac}
\end{ctanrefs}

\Question[Q-uselmfonts]{Using the Latin Modern fonts}

The new (Summer 2003) \Package{lm} fonts are an exciting addition to
the armoury of the \AllTeX{} user: high quality outlines of fonts that
were, until recently difficult to obtain, all in a free and
relatively compact package.  However, the spartan information file
that comes with the fonts remarks ``It is presumed that a potential
user knows what to do with all these files''.  This answer aims to
fill in the requirements: the job is really not terribly difficult.

The font (and related) files appear on \acro{CTAN} as a set of
single-entry \Qref*{\acro{TDS} trees}{Q-tds}~---
\File{fonts}, \File{dvips}, \File{tex} and \File{doc}.  The \File{doc}
subtree really need not be copied (it's really a pair of sample
files), but copy the other three into your existing Local |$TEXMF|
tree, and \nothtml{update the filename database (}% beware line break
\Qref{update the filename database}{Q-instpackages}\nothtml{)}.

Now, incorporate the fonts in the set searched by \PDFLaTeX{},
\ProgName{dvips}, \ProgName{dvipdfm}, your previewers and
Type~1-to-\acro{PK} conversion programs, by
\begin{itemize}
\item On a te\TeX{} system earlier than version~2.0, edit the file
  \File|$TEXMF/dvips/config/updmap| and insert an absolute path for
  the \File|lm.map| just after the line that starts
  |extra_modules="| (and before the closing quotes).
\item On a te\TeX{} version~2.0 (or later), execute the command
\begin{verbatim}
  updmap --enable Map lm.map
\end{verbatim}
\item On a Mik\TeX{} system earlier than version~2.2, the ``Refresh
  filename database'' operation, which you performed after installing
  files, also updates the system's ``\PS{} resources database''.
\item On a Mik\TeX{} system, version~2.2 or later, update
  \File|updmap.cfg| which is described in Mik\TeX{} % beware line break
  \href{http://www.miktex.org/2.2/mkfntmap.html}{online documentation}.
  Then execute the \ProgName{MkFntMap} utility, and the job is done.
\end{itemize}

To use the fonts in a \LaTeX{} program, you should
\cmdinvoke{usepackage}{lmodern}: this will make the fonts the default
for all three \LaTeX{} font families (``roman'', ``sans-serif'' and
``typewriter'').  You also need \cmdinvoke{usepackage}[T1]{fontenc}
for text, and \cmdinvoke{usepackage}{textcomp} if you want to use any
of the \acro{TS}1-encoding symbols.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Latin Modern fonts]\CTANref{lm}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Hypertext and \acro{PDF}}

\Question[Q-hyper]{Making hypertext documents from \TeX{}}

If you want on-line hypertext with a \AllTeX{} source, probably on the
World Wide Web, there are four technologies to consider:
\begin{enumerate}
\item Direct \nothtml{\AllTeX{} conversion to \acro{HTML} (}%
  \Qref{\AllTeX{} conversion to \acro{HTML}}{Q-LaTeX2HTML}\nothtml{)};
% beware line break
\item Use \Qref*{\Package{Texinfo}}{Q-texinfo},
  and use the \ProgName{info} viewer, or convert the \Package{texinfo}
  to \acro{HTML};
\item Use Adobe Acrobat, which will preserve your typesetting
  perfectly (see
  \Qref[question]{Making Acrobat documents from \LaTeX{}}{Q-acrobat});
\item The hyper\TeX{} conventions (standardised \cs|special|
  commands); there are supporting macro packages for Plain \TeX{} and
  \LaTeX{}).
\end{enumerate}

The Hyper\TeX{} project extended the functionality of all the
\LaTeX{} cross-referencing commands (including the table of contents)
to produce \cs|special| commands which are parsed by \acro{DVI} processors
conforming to the Hyper\TeX{} guidelines;
it provides general hypertext links, including those
to external documents.

The Hyper\TeX{} specification says that conformant viewers/translators
must recognize the following set of \cs|special| commands:
\begin{description}
\item[href:] |html:<a href = "href_string">|
\item[name:] |html:<a name = "name_string">|
\item[end:] |html:</a>|
\item[image:] |html:<img src = "href_string">|
\item[base\_name:] |html:<base href = "href_string">|
\end{description}

The \emph{href}, \emph{name} and \emph{end} commands are used to do
the basic hypertext operations of establishing links between sections
of documents. 

Further details are available on \URL{http://arXiv.org/hypertex/}; there
are two commonly-used implementations of the specification, a
modified \ProgName{xdvi} and (recent releases of)
\ProgName{dvips}. Output from the latter may be used in recent
releases of \ProgName{ghostscript} or Acrobat Distiller.

\Question[Q-acrobat]{Making Acrobat documents from \LaTeX{}}

There are three general routes to Acrobat output: Adobe's original
`distillation' route (via \PS{} output), conversion of a
\acro{DVI} file, and the use of a direct \acro{PDF} generator such as
\PDFTeX{} (see \Qref[question]{the \PDFTeX{} project}{Q-pdftex}) or
MicroPress's V\TeX{} (see % beware line breaks
\Qref[questions]{commercial \TeX{} implementations}{Q-commercial}
and \Qref[\htmlonly]{`free' \TeX{} implementations)}{Q-TeXsystems}).

For simple documents (with no hyper-references), you can either
\begin{itemize}
\item process the document in the normal way, produce \PS{}
  output and distill it;
\item (on a Windows or Macintosh machine with the appropriate Adobe
  tools installed) pass the output through the
  \acro{PDF}writer in place of a printer driver (this route is a dead
  end: the \acro{PDF}writer cannot create hyperlinks);
\item process the document in the normal way and generate \acro{PDF}
  direct from the \acro{DVI} with \ProgName{dvipdfm}; or
\item process the document direct to \acro{PDF} with \PDFTeX{} or
  V\TeX{}.  \PDFTeX{} has
  the advantage of availability for a wide range of platforms, V\TeX{}
  (available commercially for Windows, or free of charge for Linux or
  \acro{OS/}2) has wider graphics capability, dealing with
  encapsulated \PS{} and some in-line \PS{}.
\end{itemize}

To translate all the \LaTeX{} cross-referencing into Acrobat
links, you need a \LaTeX{} package to suitably redefine
the internal commands.  There are two of these for \LaTeX{}, both
capable of conforming to the Hyper\TeX{} specification 
(see \Qref[question]{Making hypertext documents from \TeX{}}{Q-hyper}):
Sebastian Rahtz's \Package{hyperref}, and Michael Mehlich's
\Package{hyper}.  \Package{Hyperref}
uses a configuration file to determine how it will generate hypertext;
it can operate using \PDFTeX{} primitives, the hyper\TeX{}
\cs|special|s, or \acro{DVI} driver-specific \cs|special| commands.
Both \ProgName{dvips} and \YandY{}'s \acro{\ProgName{DVIPSONE}}
translate the \acro{DVI} with these \cs|special| commands into
\PS{} acceptable to Distiller, and \ProgName{dvipdfm} has \cs|special|
commands of its own.

There is no free implementation of all of \ProgName{Adobe}
\ProgName{Distiller}'s
functionality, but recent versions of \ProgName{ghostscript}
provide pretty reliable distillation (but beware of the problems
discussed in
% beware line break
\Qref[question]{\ProgName{dvips} output for distillation}{Q-dvips-pdf}).
In fact, \ProgName{Distiller} itself is now remarkably cheap (for
academics at least).

For viewing (and printing) the resulting files, Adobe's
\ProgName{Acrobat} \ProgName{Reader} is available for a fair range of
platforms; for those for which Adobe's reader is unavailable, remotely
current versions of \ProgName{ghostscript} combined with
\ProgName{ghostview} or \ProgName{GSview} can display and print
\acro{PDF} files.

In many circumstances, \ProgName{ghostscript} combined with a viewer
application is actually preferable to Acrobat Reader.  For example, on
Windows Acrobat Reader locks the |.pdf| file it's displaying: this
makes the traditional (and highly effective) \AllTeX{} development
cycle of ``Edit\arrowhyph{}Process\arrowhyph{}Preview'' become
incredibly clumsy~--- \ProgName{GSview} doesn't make the same
mistake.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Acrobat Reader]browse
  \URL{ftp://ftp.adobe.com/pub/adobe/acrobatreader}
\item[dvipdfm]\CTANref{dvipdfm}
\item[ghostscript]Browse \CTANref{ghostscript}
\item[ghostview]Browse \CTANref{ghostview}
\item[GSview]Browse \CTANref{gsview}
\item[hyper.sty]\CTANref{hyper}
\item[hyperref.sty]\CTANref{hyperref}
\end{ctanrefs}

\Question[Q-dvips-pdf]{Quality of \acro{PDF} from \PS{}}
\keywords{blurry fuzzy crippled}

Any reasonable \PS{}, including any output of \ProgName{dvips}, may be
converted to \acro{PDF}, using (for example) a sufficiently recent
version of \ProgName{ghostscript}, Frank Siegert's (shareware)
\href{http://www.pstill.com/}{\ProgName{PStill}}, or Adobe's (commercial)
\ProgName{Distiller}.

But, although the job may (almost always) be done, the results are
often not acceptable: the most frequent problem is bad presentation of
the character glyphs that make up the document.  The following answers
offer solutions to this (and other) problems of bad presentation.
Issues covered are:
\begin{itemize}
% beware line breaks (two lines)
\item \nothtml{Wrong type of fonts used (}%
  \Qref{Wrong type of fonts used}{Q-fuzzy-type3}\nothtml{)}, which is
  the commonest cause of fuzzy text.
% beware line breaks (two lines)
\item \nothtml{\ProgName{ghostscript} too old (}%
  \Qref{\ProgName{ghostscript} too old}{Q-fuzzy-gs}\nothtml{)},
  which can also result in fuzzy text.
\item \nothtml{Switching to font encoding T1 (}%
  \Qref{Switching to font encoding T1}{Q-fuzzy-T1}\nothtml{)}, which
  is yet another possible cause of fuzzy text.
\item Another problem~--- missing characters~--- arises from an
  % beware line breaks
  \nothtml{aged version of \ProgName{Adobe}~\ProgName{Distiller} (}%
  \Qref{aged version of \ProgName{Adobe}~\ProgName{Distiller}}{Q-distill-prob}\nothtml{)}.
\item Finally, there's the common confusion that arises from using the
  \ProgName{dvips} configuration file \texttt{-Ppdf}, the
  \nothtml{weird characters (}%
  \Qref{weird characters}{Q-charshift}\nothtml{)}.
\end{itemize}
It should be noted that \ProgName{Adobe} % \ProgName{Acrobat} no longer
                                         % part of the name
\ProgName{Reader}~6 (released in mid-2003) does not exhibit the
``fuzziness'' that so many of the answers below address.  This is of
course good news: however, it will inevitably be a long time before
every user in the world has this (or later) versions, so the remedies
below are going to remain for some time to come.

\Question[Q-fuzzy-type3]{The wrong type of fonts in \acro{PDF}}
\keywords{crippled blurry}

This is far the commonest problem: the symptom is that text in the
document looks ``fuzzy''.

Most people use \ProgName{Adobe} \ProgName{Acrobat} \ProgName{Reader}
to view their \acro{PDF}: \ProgName{Reader} is distributed free of
charge, and is widely available, for all its faults.  One of those
faults is its failure to deal with bitmap fonts (at least, in all
versions earlier than the recently released version~6).

So we don't want bitmap fonts in our \PS{}: with them, characters show
up in \ProgName{Reader}'s display as blurred blobs which are often not
recognisable as the original letter, and are often not properly placed
on the line.  Nevertheless, even now, most \TeX{} systems have
\ProgName{dvips} configured to use
\nothtml{\texttt{.pk} files (}% beware line breaks
\Qref{\texttt{.pk} files}{Q-pk}\nothtml{)} in its output.  Even
\PDFTeX{} will use \texttt{.pk} files if it can see no alternative for
a font in the document it is processing.

Our remedy is to use
% perniciously dangerous line wraps await editors here ;-)
\latexhtml{``Adobe Type~1'' (}{``}\Qref{Adobe Type~1}{Q-adobetypen}\latexhtml{)}{''}
versions of the fonts we need.  Since Adobe are in the
business of selling Type~1 fonts, \ProgName{Reader} was of course made
to deal with them really rather well, from the very beginning.

Of course, if your document uses nothing but fonts that came from
Adobe in the first place~--- fonts such as \FontName|Times| that
appear in pretty much every \PS{} printer, or such as Adobe
\FontName|Sabon| that you pay extra for~--- then there's no problem.

But most people use \FontName|Computer| \FontName|Modern| to start
with, and even those relative sophisticates who use something as
exotic as \ProgName{Sabon} often find themselves using odd characters
from \acro{CM} without really intending to do so.  Fortunately, rather
good versions of the \acro{CM} fonts are available from the \acro{AMS}
% beware line break
(who have them courtesy of \nothtml{Blue Sky Research and \YandY{}~---}
\Qref{Blue Sky Research and \YandY{}}{Q-commercial}).

Most modern systems have the fonts installed ready to use; and any
system installed less than 3~years ago has a \ProgName{dvips}
configuration file `\texttt{pdf}' that signals the use of the
\acro{CM} fonts, and also sets a few other parameters to improve
\ProgName{dvips}' output.  Use this configuration as:
\begin{verbatim}
  dvips -Ppdf myfile -o myfile.ps
\end{verbatim}
This may produce a warning message about failing to find the
configuration file:
\begin{verbatim}
  dvips: warning: no config file for `pdf'
\end{verbatim}
or something similar, or about failing to find a font file:
\begin{verbatim}
  dvips: ! Couldn't find header file cmr10.pfb
\end{verbatim}
Either of these failures signals that your
system doesn't have the fonts in the first place.

A way of using the fonts that doesn't involve the sophistication of
the \texttt{-Ppdf} mechanism is simply to load maps:
\begin{verbatim}
  dvips -Pcmz -Pamz myfile -o myfile.ps
\end{verbatim}
You may encounter the same warning messages as listed above.

If your system does not have the fonts, it won't have the
configuration file either; however, it might have the configuration
file without the fonts.  In either case, you need to
\nothtml{install the fonts (}% beware line breaks
\Qref{install the fonts}{Q-inst1cm}\nothtml{)}.

\Question[Q-fuzzy-gs]{Fuzzy fonts because \ProgName{Ghostscript} too old}
\keywords{crippled blurry}

So you've done everything the \acro{FAQ} has told you that you need,
correct fonts properly installed and appearing in the \ProgName{dvips}
output, but \emph{still} you get fuzzy character output after
distilling with \ProgName{ghostscript}.

The problem could arise from too old a version of
\ProgName{ghostscript}, which you may be using directly, or via a
script such as \ProgName{ps2pdf} (distributed with
\ProgName{ghostscript} itself), \ProgName{dvipdf}, or similar.
Though \ProgName{ghostscript} was capable of distillation from
version~5.50, that version could only produce bitmap Type~3 output of
any font other than the fundamental 35~fonts (\FontName|Times|,
\FontName|Helvetica|, etc.).  Later versions added `complete'
distillation, but it wasn't until version~6.50 that one could rely on
it for everyday work.

So, if your \acro{PDF}  output still looks fuzzy in \ProgName{Acrobat}
\ProgName{Reader}, upgrade \ProgName{ghostscript}.  The new version
should be at least version~6.50, of course, but it's usually good
policy to go to the most recent version (version~8.00 at the time of
writing~--- late April 2003).

\Question[Q-fuzzy-T1]{Fonts go fuzzy when you switch to T1}
\keywords{crippled blurry}

You've been having problems with hyphenation, and someone has
suggested that you should use ``\cmdinvoke{usepackage}[T1]{fontenc}''
to help sort them out.  Suddenly you find that your final \acro{PDF}
has become fuzzy.  The problem may arise whether you are using \PS{}
output and then distilling it, or you are using \PDFTeX{} for the
whole job.

In fact, this is the same problem as most others about the
\nothtml{quality of \acro{PDF} (}% beware line break
\Qref{quality of \acro{PDF}}{Q-dvips-pdf}\nothtml{)}: you've abandoned
your previous setup using Type~1 versions of the \acro{CM} fonts, and
\ProgName{dvips} has inserted Type~3 versions of the \acro{EC} fonts
into your document output.  (See % beware line break
\htmlonly{``}\Qref[question]{Adobe font types}{Q-adobetypen}\htmlonly{''}
for details of these font types; also, note that the font \emph{encoding}~T1
has nothing directly to do with the font \emph{type}~Type~1).

However, as noted in % beware line break
\htmlonly{``}\Qref[question]{8-bit Type~1 fonts}{Q-type1T1}\htmlonly{''},
Type~1 versions of \acro{CM}-like fonts in T1 (or equivalent) encoding
are now available, both as ``real'' fonts, and as virtual font sets.
One solution, therefore, is to use one of these alternatives.

The alternative is to switch font family altogether, to something like
\FontName|Times| (as a no-thought default) or one of the many more pleasing
Adobe-encoded fonts.  The default action of \Package{fontinst}, when
creating metrics for such a font, is to create settings for both OT1
and T1 encodings, so there's little change in what goes on (at the
user level) even if you have switched to T1~encoding when using the
fonts.

\Question[Q-distill-prob]{Characters missing from \acro{PDF} output}

If you're using \ProgName{Acrobat} \ProgName{Distiller} to create your
\acro{PDF} output, you may find
characters missing.  This may manifest
itself as messed-up maths equations (missing
``\latexhtml{\ensuremath{-}}{-}'' signs, for example), or bits missing
from large symbols.  Early versions of \ProgName{Distiller} used to
ignore character positions 0--31 and 128--159 of every font: Adobe's
fonts never use such positions, so why should \ProgName{Distiller}?

Well, the answer to this question is ``because Adobe don't produce all
the world's fonts''~--- fonts like \FontName|Computer|
\FontName|Modern| were around before Adobe came on the scene, and
\emph{they} use positions 0--31.  Adobe don't react to complaints like
that in the previous sentence, but they do release new versions of
their programs; and \ProgName{Distiller}, since at least version~4.0,
\emph{has} recognised the font positions it used to shun.

Meanwhile, \TeX{} users with old versions of \ProgName{Distiller} need
to deal with their fonts.  \ProgName{Dvips} comes to our aid: the
switch \texttt{-G1} (``remap characters''), which moves the offending
characters out of the way.  The \acro{PDF} configuration file
(\texttt{-Ppdf}), recommended % beware line break
\latexhtml{above}{in ``\Qref{the wrong type of fonts}{Q-fuzzy-type3}''},
includes the switch.

The switch is not without its problems; pre-2003 versions of
\ProgName{dvips} will apply it to Adobe fonts as well, causing
\nothtml{havoc (}\Qref{havoc}{Q-charshift}\nothtml{)}, but fortunately
that problem is usually soluble.  However, a document using both
\acro{CM} and Adobe-specified fonts is stuck.  The only real solution
is either to upgrade \ProgName{dvips}, or to spend money to upgrade
\ProgName{Distiller}.

\Question[Q-type1T1]{Finding `8-bit' Type~1 fonts}
\keywords{eight}

Elsewhere, answers to these \acro{FAQ}s recommend that you use an
`8-bit' font to % beware line break
permit \nothtml{accentuation of inflected languages (}%
\Qref{accentuation of inflected languages}{Q-hyphenaccents}%
\nothtml{)}, and also recommend the use of Type~1 fonts to ensure that
you get \nothtml{good quality \acro{PDF} (}%
\Qref{good quality \acro{PDF}}{Q-fuzzy-type3}\nothtml{)}.  Until
recently, these recommendations were contradictory: one could not just
``switch'' from the free \acro{CM} fonts to free Cork- (or similarly)
encoded Type~1 fonts.  The first approach that started to help this
direct sort of switch, was the development of virtual fonts that make
a good approach to the Cork encoding (see below).  Now, however, we
finally see ``true'' Type~1 fonts: as always, we have an embarrassment
of riches with both the \Package{cm-super} and the \Package{Latin}
\Package{Modern} series available to users.

\Package{CM-super} is an
auto-traced set which encompasses all of the \acro{T}1 and \acro{TS}1
encodings as well as the \acro{T}2* series (the family of encodings
that cover languages based on Cyrillic alphabets).  These fonts are
pretty easy to install (the installation instructions are clear), but
they are huge: don't try to install them if you're short of disc
space.

\Package{CM-LGC} is a similar ``super-font'' set, but of much more
modest size; it covers \acro{T}1, \acro{TS}1 and \acro{T}2{A}
encodings (as does \Package{CM-super}, and also covers the \acro{LGR}
encoding (for typesetting Greek, based on Claudio Beccari's \MF{}
sources).  \Package{CM-LGC} manages to be small by going to the
opposite extreme from \Package{CM-super}, which includes fonts at all
the sizes supported by the original \acro{EC} (a huge range);
\Package{CM-LGC} has one font per font shape, getting other sizes by
scaling.  There is an inevitable loss of quality inherent in this
approach, but for the disc-space-challenged machine, \Package{CM-LGC}
is an obvious choice.

\Package{Latin} \Package{Modern} is produced using a
program \ProgName{MetaType1} which, as its name implies, brings the
power of the \MF{} paradigm to the production of Type~1 fonts.  The
\Package{Latin} \Package{Modern} set comes with \acro{T}1, \acro{TS}1
\acro{LY}1 encoded variants (as well as a variant using the Polish
\acro{QX} encoding); for the glyph set it covers, its outlines seem
rather cleaner than those of \Package{CM-super}.  \Package{Latin}
\Package{Modern} is more modest in its disc space demands than is
\Package{CM-super}, while not being nearly as stark in its range of
design sizes as is \Package{CM-LGC}~---  \Package{Latin}
\Package{Modern}'s fonts are offered in the same set of sizes as the
original \Package{CM} fonts.  It's hard to argue with the choice:
Knuth's range of sizes has stood the test of time, and is one of the
bases on which the excellence of the \TeX{} system rests.

\Qref*{Virtual fonts}{Q-virtualfonts} help us deal with the problem,
since they allow us to map ``bits of \acro{DVI} file'' to single
characters in the virtual font; so we can create an ``\'e'' character
by recreating the \acro{DVI} commands that would result from the code
``|\'||e|''.  However, since this involves two characters being
selected from a font, the arrangement is sufficient to fool
\ProgName{Acrobat} \ProgName{Reader}: you can't use the program's
facilities for searching for text that contains inflected characters,
and if you \emph{cut} text from a window that contains such a
character, you'll find something unexpected (typically the accent and
the `base' characters separated by a space) when you \ProgName{paste}
the result.  However, if you can live with this difficulty, virtual
fonts are a useful, straightforward solution to the problem.

There are two virtual-font offerings of \acro{CM}-based 8-bit
fonts~--- the \Package{ae} (``almost \acro{EC}'') and
\Package{zefonts} sets; the \Package{zefonts} set has wider coverage
(though the \Package{ae} set may be extended to offer guillemets by
use of the \Package{aeguill} package).  Neither offers characters such
as |eth| and |thorn| (used in, for example, in Icelandic), but the
\Package{aecompl} package works with the \Package{ae} fonts to provide
the missing characters from the \acro{EC} fonts (i.e., as bitmaps).

Commercial \acro{CM}-like 8-bit fonts are remarkably cheap,
but cost more than this author could ordinarily expend\dots{}  \YandY{}
offer their ``European Modern'' set: an extension of the \acro{CM}
fonts that may used either with \acro{T}1 or \acro{LY}1 encoding;
these are fonts from the same stable that gave us the free
\acro{AMS}/Blue Sky Research/\YandY{} fonts, sensitively extended
(though they don't cover the more eccentric areas of the \acro{T}1
encoding, and don't come in the same welter of design sizes that the
\acro{EC} fonts offer).  Micropress offer the complete \acro{EC} set
in Type~1 format, as part of their range of outline versions of fonts
that were originally distributed in \MF{} format.  See
\Qref[question]{``commercial distributions''}{Q-commercial}.

The shareware \nothtml{BaKoMa \TeX{} distribution (}%
\Qref{BaKoMa \TeX{} distribution}{Q-TeXsystems}\nothtml{)} offers a
set of Type~1 \acro{EC} fonts, as an extra shareware option.  (As far
as the present author can tell, these fonts are \emph{only} available
to users of BaKoMa \TeX{}: they are stored in an archive format that
seems not to be publicly available.)

Finally, you can use one of the myriad text fonts available in Type~1
format (with appropriate \acro{PSNFSS} metrics for \acro{T}1 encoding,
or metrics for some other 8-bit encoding such as \acro{LY}1).  However,
if you use someone else's text font (even something as simple as
Adobe's Times family) you have to find a matching family of
mathematical fonts, which is a non-trivial undertaking~---
\htmlonly{see }\Qref{``choice of scalable fonts''}{Q-psfchoice}.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}ae fonts]\CTANref{ae}
\item[aecompl.sty]Distributed with \CTANref{ae}
\item[aeguill.sty]\CTANref{aeguill}
\item[\nothtml{\rmfamily}BaKoMa fonts]Browse \CTANref{bakoma-texfonts}
\item[\nothtml{\rmfamily}CM-LGC fonts]\CTANref{cm-lgc}
\item[\nothtml{\rmfamily}CM-super fonts]\CTANref{cm-super} (beware:
  very large download)
\item[\nothtml{\rmfamily}Latin Modern fonts]\CTANref{lm}
\item[\nothtml{\rmfamily}zefonts]\CTANref{zefonts}
\end{ctanrefs}

\Question[Q-pkfix]{Replacing Type 3 fonts in \PS{}}

One often comes across a \PS{} file generated by
\ProgName{dvips} which contains embedded \acro{PK} fonts; if you try
to generate \acro{PDF} from such a file, the quality will be poor.

Of course, the proper solution is to regenerate the \PS{} file,
but if neither the sources nor the \acro{DVI} file are available, one
must needs resort to some sort of patching to replace the bitmap fonts
in the file by outline fonts.

The program \ProgName{pkfix} (by Heiko Oberdiek) will do this
patching, for files created by ``not too old versions'' of
\ProgName{dvips}: it finds the fonts to be replaced by examining the
\PS{} comments \ProgName{dvips} has put in the file.  For each
font, \ProgName{pkfix} puts appropriate \TeX{} commands in a file,
which it then processes and runs through \ProgName{dvips} (with switch
|-Ppdf|) to acquire an appropriate copy of the font; these copies are
then patched back into the original file.

Another program, available free from \nothtml{\YandY{} (}% beware line break
\Qref{\YandY{}}{Q-commercial}\nothtml{)} for Windows users who also
have Adobe \ProgName{Acrobat} \ProgName{Distiller} available, is
\href{http://www.yandy.com/download/dvipsstrip.exe}{\ProgName{dvipsstrip}}.
\ProgName{Dvipsstrip} simply removes
the fonts: the idea is that you then reinstate them in the course of a
run through \ProgName{distiller} (which only works if
\ProgName{distiller} `knows' about the fonts: it can be instructed via
its \texttt{Settings}\arrowhyph{}\texttt{Font Locations} tool).

Yet another option is Frank Siegert's (shareware)
\href{http://www.pstill.com}{PStill}, which is capable of processing
the \PS{} it is distilling, and one option is to replace bitmap fonts
in the file with Type~1 versions.
\begin{ctanrefs}
\item[pkfix]\CTANref{pkfix}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Graphics}

\Question[Q-impgraph]{How to import graphics into \AllTeX{} documents}

Knuth, when designing the current version of \TeX{} back in the early
1980s, could discern no ``standard'' way of expressing graphics in
documents.  He reasoned that this state could not persist for ever,
but that it would be foolish for him to define \TeX{} primitives that
allowed the import of graphical image definitions.  He therefore
deferred the specification of the use of graphics to the writers of
\acro{DVI} drivers; \TeX{} documents would control the drivers by
means of \nothtml{\cs|special| commands (}% beware line breaks
\Qref{\cs|special| commands}{Q-specials}\nothtml{)}.

There is therefore a straightforward way for anyone to import graphics
into their document: read the specification of the \cs|special|
commands your driver uses, and `just' code them.  This is the
hair-shirt approach: it definitely works, but it's not for everyone.

Over the years, therefore, ``graphics inclusion'' packages have sprung
up; most were designed for inclusion of
\nothtml{Encapsulated \PS{} graphics (}% beware line break
\Qref{Encapsulated \PS{} graphics}{Q-eps}\nothtml{)}\nobreakspace---
which has become the \emph{lingua franca} of graphics inclusion over
the last decade or so.

Notable examples are the \Package{epsf} package (distributed with
\ProgName{dvips}) and the \Package{psfig} package.  (Both of these
packages were designed to work well with both Plain \TeX{} and
\LaTeXo{}; they are both still available.)  All such packages were
tied to a particular \acro{DVI} driver (\ProgName{dvips}, in
the above two cases), but their code could be configured for others.

The obvious next step was to make the code configurable dynamically.
The \LaTeX{} standard \Package{graphics} package and its derivatives
made this step: it is strongly preferred for all current work.  It can
also be used (with the help of the \Package{miniltx} ``\LaTeX{}
emulator'' and the \Package{graphicx.tex} front-end) in documents
written in Plain \TeX{}.

The \Package{graphics} package takes a variety of ``driver
options''~--- package options that select code to generate the
commands appropriate to the \acro{DVI} driver in use.  In most cases,
your \AllTeX{} distribution will provide a \File|graphics.cfg| file
that will select the correct driver for what you're doing (for
example, a distribution that provides both \LaTeX{} and \PDFLaTeX{}
will usually provide a configuration file that determins whether
\PDFLaTeX{} is running, and selects the definitions for it if so).

The \Package{graphics} package provides a toolkit of commands (insert
graphics, scale a box, rotate a box), which may be composed to provide
most facilities you need; the basic command, \cs|includegraphics|,
takes one optional argument, which specifies  the bounding box of the
graphics to be included.

The \Package{graphicx} package uses the facilities of of
\Package{graphics} behind a rather more sophisticated command syntax
to provide a very powerful version of the \cs|includegraphics|
command.  \Package{graphicx}'s version can combine scaling and
rotation, viewporting and clipping, and many other things.  While this
is all a convenience (at some cost of syntax), it is also capable of
producing noticeably more efficient \PS{}, and some of its
combinations are simply not possible with the \Package{graphics}
package version.

The \Package{epsfig} package provides the same facilities as
\Package{graphicx}, but via a \cs|psfig| command (also known as
\cs|epsfig|), capable of emulating
the behaviour (if not the bugs) the old \Package{psfig} package.
\Package{Epsfig} also supplies homely support for former users of the
\Package{epsf} package.  There is no rational reason to stick with the
old packages, which have never been entirely satisfactory in the
\LaTeX{} context. (One irrational reason to leave them behind is that
their replacement's name tends not to imply that it's exclusively
related to \PS{} graphics.)

A wide variety of detailed techniques and tricks have been developed
over the years, and Keith Reckdahl's \Package{epslatex} outlines them
in compendious detail: this highly recommendable document is available
from \acro{CTAN}.  An invaluable review of the practicalities of
exchanging graphics between sites,
% beware multiple line break problems
\begin{htmlversion}
``\href{http://silas.psfc.mit.edu/elec_fig/elec_figures.pdf}{Graphics for Inclusion in Electronic Documents}''
\end{htmlversion}
\htmlignore
\begin{pdfversion}
``\href{http://silas.psfc.mit.edu/elec_fig/elec_figures.pdf}%
       {Graphics for Inclusion in Electronic Documents}''
\end{pdfversion}
\begin{dviversion}
\href{http://silas.psfc.mit.edu/elec_fig/elec_figures.pdf}%
     {``Graphics for Inclusion in Electronic Documents''}
\end{dviversion}
\endhtmlignore
has been written by Ian Hutchinson; the document isn't on \acro{CTAN},
but may also be
% beware line breaks
\href{http://silas.psfc.mit.edu/elec_fig/}{browsed on the Web}.
\begin{ctanrefs}
\item[epsf.tex]\CTANref{epsf}
\item[epsfig.sty]Part of the \CTANref{graphics} bundle
\item[epslatex.pdf]\CTANref{epslatex}; the document is also available
  in \PS{} format as \CTANref{epslatex_ps}
\item[graphics.sty]\CTANref{graphics}
\item[graphicx.sty]Part of the \CTANref{graphics} bundle
\item[miniltx.tex]\CTANref{graphics-plain}
\item[psfig.sty]\CTANref{psfig}
\end{ctanrefs}

\Question[Q-dvipsgraphics]{Imported graphics in \ProgName{dvips}}

\ProgName{Dvips}, as originally conceived, can only import a single
graphics format: \nothtml{encapsulated \PS{} (|.eps| files, }%
\Qref{encapsulated \PS{}}{Q-eps}\htmlonly{ (|.eps| files}).
\ProgName{Dvips} also deals with the slightly eccentric |.eps| that is
created by \nothtml{\MP{} (}\Qref{\MP{}}{Q-MP}\nothtml{)}.

Apart from the fact that a depressing proportion of drawing
applications produce corrupt \acro{EPS} when asked for such output,
this is pretty satisfactory for vector graphics work.

To include bitmap graphics, you need some means of converting them to
\PS{}; in fact many standard image manipulators (such as
\ProgName{ImageMagick}'s \ProgName{convert}) make a good job of
creating \acro{EPS} files.  (Though \ProgName{Unix} users should
beware of \ProgName{xv}'s claims: it has a tendency to downsample your
bitmap to your screen resolution.)

Special purpose applications \ProgName{jpeg2ps} (which converts
\acro{JPEG} files using \PS{} level 2 functionality) and
\ProgName{bmeps} (which converts both \acro{JPEG} and \acro{PNG}
files) are also considered ``good bets''.  \ProgName{Bmeps} comes with
patches to produce your own version of \ProgName{dvips} that can cope
with \acro{JPEG} and \acro{PNG} direct, using \ProgName{bmeps}'s
conversion library.
\begin{ctanrefs}
\item[bmeps]\CTANref{bmeps}
\item[jpeg2ps]\CTANref{jpeg2ps}
\end{ctanrefs}

\Question[Q-pdftexgraphics]{Imported graphics in \PDFLaTeX{}}

\PDFTeX{} itself has a rather wide range of formats that it can
``natively'' incorporate into its output \acro{PDF} stream:
\acro{JPEG} (|.jpg| files) for photographs and similar images,
\acro{PNG} files for artificial bitmap images, and \acro{PDF} for
vector drawings.  In addition, old versions of \PDFTeX{} (prior to
version~1.10a) supported \acro{TIFF} (|.tif| files) format as an
alternative to \acro{PNG} files.

In addition, the standard \PDFLaTeX{} \Package{graphics} package setup
causes Hans Hagen's \File|supp-pdf| macros to be loaded: these macros
are capable of translating the output of \MP{} to \acro{PDF} ``on the
fly''; thus \MP{} output (|.mps| files) may also be included in
\PDFLaTeX{} documents.

The commonest problem users encounter, when switching from \TeX{}, is
that there is no straightforward way to include \acro{EPS} files:
since \PDFTeX{} is its own ``driver'', and since it contains no means
of converting \PS{} to \acro{PDF}, there's no direct way the job can
be done.

The simple solution is to convert the \acro{EPS} to an appropriate
\acro{PDF} file.  The \ProgName{epstopdf} program will do this: it's
available either as a Windows executable or as a \ProgName{Perl}
script to run on Unix and other similar systems.  A \LaTeX{} package,
\Package{epstopdf}, can be used to generate the requisite \acro{PDF}
files ``on the fly''; this is convenient, but requires that you
suppress one of \TeX{}'s security checks: don't use it in files from
sources you don't entirely trust.

An alternative (and, I find, deeply satisfying) solution is to use
\ProgName{purifyeps}, a \ProgName{perl} script which uses the good
offices of \ProgName{pstoedit} and of \MP{} to convert your
Encapsulated \PS{} to ``Encapsulated \PS{} that comes out of \MP{}'',
and can therefore be included directly.
\begin{ctanrefs}
\item[epstopdf]Browse \CTANref{epstopdf}
\item[epstopdf.sty]Distributed with Heiko Oberdiek's packages
  \CTANref{oberdiek}
\item[pstoedit]\CTANref{pstoedit}
\item[purifyeps]\CTANref{purifyeps}
\end{ctanrefs}

\Question[Q-graphicspath]{Importing graphics from ``somewhere else''}

By default, graphics commands like \cs|includegraphics| look
``wherever \TeX{} files are found'' for the graphic file they're being
asked to use.  This can reduce your flexibility if you choose to hold
your graphics files in a common directory, away from your \AllTeX{}
sources.

The simplest solution is to patch \TeX{}'s path, by changing the
default path.  On most systems, the default path is taken from the
environment variable |TEXINPUTS|, if it's present; you can adapt that
to take in the path it already has, by setting the variable to
\begin{verbatim}
  TEXINPUTS=.:<graphics path(s)>:
\end{verbatim}
on a Unix system; on a Windows system the separator will be ``|;|''
rather than ``|:|''.  The ``|.|'' is there to ensure that the current
directory is searched first; the trailing ``|:|'' says ``patch in the
value of |TEXINPUTS| from your configuration file, here''.

This method has the merit of efficiency (\AllTeX{} does \emph{all} of
the searches, which is quick), but it's always clumsy and may prove
inconvenient to use in Windows setups (at least).

The alternative is to use the \Package{graphics} package command
\cs|graphicspath|; this command is of course also available to users
of the \Package{graphicx} and the \Package{epsfig} packages.  The
syntax of \cs|graphicspath|'s one argument is slightly odd: it's a
sequence of paths (typically relative paths), each of which is
enclosed in braces.  A slightly odd sample, given in the
\Package{graphics} bundle documentation, is:
\begin{verbatim}
  \graphicspath{{eps/}{tiff/}}
\end{verbatim}
however, if the security checks on your \AllTeX{} system allow, the
path may be anything you choose (rather than strictly relative, like
those above).

Be aware that \cs|graphicspath| does not affect the operations of
graphics macros other than those from the graphics bundle~--- in
particular, those of the outdated \Package{epsf} and
\Package{psfig} packages are immune.

The disadvantage of the \cs|graphicspath| method is inefficiency.  The
package will call \AllTeX{} once for each entry in the list, which is
itself slows things.  More seriously, \TeX{} remembers the file name,
thus effectively losing memory, every time it's
asked to look up a file, so a document that uses a huge number of
graphical inputs could be embarrassed by lack of memory.

If your document is split into a variety of directories, and each
directory has its associated graphics, the \Package{import} package
may well be the thing for you; see the discussion % beware line break
\latexhtml{of ``bits of document in other directories'' (}{in the question ``}%
\Qref{bits of document in other directories}{Q-docotherdir}%
\latexhtml{)}{''}.
\begin{ctanrefs}
\item[graphics \nothtml{\rmfamily}bundle]\CTANref{graphics}
\item[import.sty]\CTANref{import}
\end{ctanrefs}

\Question[Q-graph-pspdf]{Portable imported graphics}

A regular need is a document to be distributed in more than
one format: commonly both \PS{} and \acro{PDF}.  The
following advice is based on a post by one with much experience of
dealing with the problem of dealing with \acro{EPS} graphics in this
case.
\begin{itemize}
\item Don't specify a driver when loading loading whichever version of
  the \Package{graphics} package you use.  The scheme relies on the
  distribution's ability to decide which driver is going to be used:
  the choice is between \ProgName{dvips} and \PDFTeX{}, in this case.
  Be sure to exclude options \pkgoption{dvips}, \pkgoption{pdftex} and
  \pkgoption{dvipdfm} (\ProgName{dvipdfm} is not used in this scheme,
  but the aspirant \acro{PDF}-maker may be using it for his output,
  before switching to the scheme).
\item Use \cmdinvoke{includegraphics}[...]{filename} without
  specifying the extension (i.e., neither |.eps| nor |.pdf|).
\item For every |.eps| file you will be including, produce a |.pdf|
  version, as described in % beware line break
  \Qref[question]{Graphics in \PDFLaTeX{}}{Q-pdftexgraphics}.  Having
  done this, you will have two copies of each graphic (a |.eps| and a
  |.pdf| file) in your directory.
\item Use \PDFLaTeX{} (rather than
  \LaTeX{}--\ProgName{dvips}--distillation or
  \LaTeX{}--\ProgName{dvipdfm}) to produce your \acro{PDF} output.
\end{itemize}
\ProgName{Dvipdfm}'s charms are less than attractive here: the
document itself needs to be altered from its default
(\ProgName{dvips}) state, before \ProgName{dvipdfm} will process it.

\Question[Q-grmaxwidth]{Limit the width of imported graphics}

Suppose you have graphics which may or may not be able to fit within
the width of the page; if they will fit, you want to set them at their
natural size, but otherwise you want to scale the whole picture so
that it fits within the page width.

You do this by delving into the innards of the graphics package (which
of course needs a little \LaTeX{} internals programming):
\begin{verbatim}
\makeatletter
\def\maxwidth{%
  \ifdim\Gin@nat@width>\linewidth
    \linewidth
  \else
    \Gin@nat@width
  \fi
}
\makeatother
\end{verbatim}
This defines a ``variable'' width which has the properties you want.
Replace \cs|linewidth| if you have a different constraint on the width
of the graphic.

Use the command as follows:
\begin{verbatim}
\includegraphics[width=\maxwidth]{figure}
\end{verbatim}

\Question[Q-topgraph]{Top-aligning imported graphics}

When \TeX{} sets a line of anything, it ensures that the base-line of
each object in the line is at the same level as the base-line of the
final object.  (Apart, of course, from \cs|raisebox| commands\dots{})

Most imported graphics have their base-line set at the bottom of the
picture.  When using packages such as \Package{subfigure}, one often
wants to align figures by their tops.  The following odd little bit of
code does this:
\begin{verbatim}
\vtop{%
  \vskip0pt
  \hbox{%
    \includegraphics{figure}%
  }%
}
\end{verbatim}
The \cs|vtop| primitive sets the base-line of the resulting object to
that of the first ``line'' in it; the \cs|vskip| creates the illusion
of an empty line, so \cs|vtop| makes the very top of the box into the
base-line.

In cases where the graphics are to be aligned with text, there is a
case for making the base-line one ex-height below the top of the box,
as in:
\begin{verbatim}
\vtop{%
  \vskip-1ex
  \hbox{%
    \includegraphics{figure}%
  }%
}
\end{verbatim}
The fact is, \emph{you} may choose where the base-line ends up.  This
answer merely shows you sensible choices you might make.

\Question[Q-mpprologues]{Making \MP{} output display in \ProgName{ghostscript}}

\MP{} ordinarily expects its output to be included in some context
where the `standard' \MF{} fonts (that you've specified) are already
defined~--- for example, as a figure in \TeX{} document.  If you're
debugging your \MP{} code, you may want to view it in
\ProgName{ghostscript} (or some other \PS{} previewer).  However,
the \PS{} `engine' in \ProgName{ghostscript} \emph{doesn't}
ordinarily have the fonts loaded, and you'll eperience an error such
as
\begin{verbatim}
  Error: /undefined in cmmi10
\end{verbatim}
There is provision in \MP{} for avoiding this problem: issue the
command |prologues := 2;| at the start of the |.mp| file.

Unfortunately, the \PS{} that \MP{} inserts in its output,
following this command, is incompatible with ordinary use of the
\PS{} in inclusions into \AllTeX{} documents, so it's best to
make the |prologues| command optional.  Furthermore, \MP{} takes a
very simple-minded approach to font encoding: since \TeX{} font
encodings regularly confuse sophisticated minds, this can prove
troublesome.  If you're suffering such problems (the symptom is that
characters disappear, or are wrongly presented) the only solution is
to view the `original' metapost output after processing through
\LaTeX{} and \ProgName{dvips}.

Conditional compilation may be done either
by inputting \File|MyFigure.mp| indirectly from a simple wrapper
\File|MyFigureDisplay.mp|:
\begin{verbatim}
  prologues := 2;
  input MyFigure
\end{verbatim}
or by issuing a shell command such as
\begin{verbatim}
  mp '\prologues:=2; input MyFigure'
\end{verbatim}
(which will work without the quote marks if you're not using a Unix
shell).

A suitable \LaTeX{} route would involve processing
\File|MyFigure.tex|, which contains:
\begin{verbatim}
  \documentclass{article}
  \usepackage{graphicx}
  \begin{document}
  \thispagestyle{empty}
  \includegraphics{MyFigure.1}
  \end{document}
\end{verbatim}
Processing the resulting \acro{DVI} file with the \ProgName{dvips}
command
\begin{verbatim}
  dvips -E -o MyFigure.eps MyFigure
\end{verbatim}
would then give a satisfactory Encapsulated \PS{} file.  This
procedure may be automated using the \ProgName{Perl} script
\ProgName{mps2eps}, thus saving a certain amount of tedium.

The Plain~\TeX{} user may use an adaptation of a jiffy of Knuth's, by
Dan Luecking.  Dan's version \Package{mpsproof.tex} will work under
\TeX{} to produce a \acro{DVI} file for use with \ProgName{dvips}, or
under \PDFTeX{} to produce a \acro{PDF} file, direct.  The output is
set up to look like a proof sheet.
\begin{ctanrefs}
\item[mps2eps]\CTANref{mps2eps}
\item[mpsproof.tex]\CTANref{mpsproof}
\end{ctanrefs}

\Question[Q-drawing]{Drawing with \TeX{}}

There are many packages to do pictures in \AllTeX{} itself (rather than
importing graphics created externally), ranging from simple use of
\LaTeX{} \environment{picture} environment, through enhancements like
\ProgName{epic}, to 
sophisticated (but slow) drawing with \PiCTeX{}. Depending on your type
of drawing, and setup, four systems should be at the top of your list
to look at:
\begin{enumerate}
\item \Package{pstricks}; this gives you access to all the power of
  \PS{} from \TeX{} itself, by sophisticated use of
  \cs|special|s. You need a decent \acro{DVI} to \PS{} driver
  (like \ProgName{dvips}), but the results are worth it.  The
  well-documented package gives you not only low-level drawing
  commands (and full colour) like lines, circles, shapes at arbitrary
  coordinates, but also high-level macros for framing text, drawing
  trees and matrices, 3\acro{D} effects, and more.  \PDFTeX{} users
  may use \Package{pdftricks}, which (like \Package{epstopdf}~--- see
  \Qref[question]{\PDFLaTeX{} graphics}{Q-pdftexgraphics}) generates
  \acro{PDF} files on the fly from \Package{pstricks} commands.
\item \MP{}; you liked \MF{}, but never got to grips with font files?
  Try \nothtml{\MP{} (}\Qref{\MP{}}{Q-MP}\nothtml{)}~---
  all the power of \MF{}, but it generates \PS{} figures; \MP{}
  is nowadays part of most serious \AllTeX{} distributions.  Knuth
  uses it for all his work\dots{}
\item \ProgName{Mfpic}; you liked \MF{}, but can't understand the
  language?  The package makes up \MF{} or \MP{} code for you
  within using familiar-looking \TeX{} macros.  Not \emph{quite} the
  full power of \MF{}, but a friendlier interface.
\item You liked \PiCTeX{} but don't have enough memory or time?  Look
  at Eitan Gurari's \Package{dratex}, which is as powerful as most
  other \TeX{} drawing packages, but is an entirely new
  implementation, which is not as hard on memory, is much more
  readable (and is fully documented).
\end{enumerate}
\begin{ctanrefs}
\item[dratex]\CTANref{dratex}
\item[mfpic]\CTANref{mfpic}
\item[pdftricks]\CTANref{pdftricks}
\item[pstricks]\CTANref{pstricks}
\end{ctanrefs}

\Question[Q-drawFeyn]{Drawing Feynman diagrams in \LaTeX{}}

Michael Levine's \Package{feynman} bundle for drawing the diagrams in
\LaTeXo{} is still available.

Thorsten Ohl's \Package{feynmf} is designed for use with current
\LaTeX{}, and works in
combination with \MF{} (or, in its \Package{feynmp} incarnation, with
\MP{}).  The \ProgName{feynmf} or
\ProgName{feynmp} package reads a description of the diagram written
in \TeX{}, and writes out code.  \MF{} (or \MP{}) can then produce a
font (or \PS{} file) for use in a subsequent \LaTeX{} run.  For
new users, who have access to \MP{}, the \PS{} version is
probably the better route, for document portability and other reasons.
% checked rf 2001/03/22

Jos Vermaseren's \Package{axodraw} is mentioned as an alternative in
the documentation of \Package{feynmf}, but it is written entirely in
terms of \ProgName{dvips} \cs|special| commands, and is thus rather
imperfectly portable.

An alternative approach is implemented by Norman Gray's \Package{feyn}
package.  Rather than creating complete diagrams as postscript images,
\Package{feyn} provides a font (in a variety of sizes) containing
fragments, which you can compose to produce complete diagrams.  It
offers fairly simple diagrams which look good in equations, rather
than complicated ones more suitable for display in figures.
\begin{ctanrefs}
\item[axodraw]\CTANref{axodraw}
\item[feyn \nothtml{\rmfamily}font bundle]\CTANref{feyn}
\item[feynman bundle]\CTANref{feynman}
\item[feynmf/feynmp bundle]\CTANref{feynmf}
\end{ctanrefs}

\Question[Q-labelfig]{Labelling graphics}

``Technical'' graphics (such as graphs and diagrams) are often
labelled with quite complex mathematical expressions: there are few
drawing or graphing tools that can do such things (the honourable
exception being \MP{}, which allows you to program the labels, in
\AllTeX{}, in the middle of specifying your graphic).

Labels on graphics produced by all those \emph{other} tools is where
the \Package{psfrag} package can help.  Place an unique
text in your graphic, using the normal text features of your tool, and
you can ask \Package{psfrag} to replace the text with arbitrary
\AllTeX{} material.  \Package{Psfrag}'s ``operative'' command is
\cmdinvoke{psfrag}{\emph{PS text}}{\emph{Repl text}}, which instructs
the system to replace the original (``\texttt{PS}'') text with the
\TeX{}-typeset replacement text.  Optional
arguments permit adjustment of position, scale and rotation; full
details may be found in \File|pfgguide| in the distribution.
(Unfortunately, \Package{psfrag} can't be used with \PDFLaTeX{},
though one might hope that it would be susceptible to the same sort of
treatment as is used in the \Package{pdftricks} package.)

Another pleasing package is \Package{overpic}, which overlays a
\environment{picture} environment on a graphic included by use of
\cs|includegraphics|.  This treatment lends itself to ready placement
of texts and the like on top of a graphic.  The package can draw a
grid for planning your ``attack''; the distribution comes with simple
examples.

And the confident user may, of course, do the whole job in a picture
environment which itself includes the graphic.  I would recommend
\Package{overpic}, but it's plainly little more than a convenience
over what is achievable with the do-it-yourself approach.
\begin{ctanrefs}
\item[overpic.sty]\CTANref{overpic}
\item[psfrag.sty]\CTANref{psfrag}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Bibliographies and citations}

\subsection{Creating bibliographies}

\Question[Q-custbib]{Creating a bibliography style}

It \emph{is} possible to write your own: the standard bibliography
styles are distributed in a commented form, and there is a description
of the language (see
% beware line-wrap
\Qref[question]{BibTeX documentation}{Q-BibTeXing}).
However, it must be admitted that the language in which \BibTeX{}
styles are written is pretty obscure, and one would not recommend
anyone who's not a confident programmer to write their own, though
minor changes to an existing style may be within the grasp of many.

If your style isn't too `far out', you can probably generate it by
using the facilities of the \Package{custom-bib} bundle.  This
contains a file \File|makebst.tex|, which runs you through a text menu
to produce a file of instructions, with which you can generate your
own |.bst| file.  This technique doesn't deal with entirely new styles
of document (the present author needed ``standards committee papers''
and ``\acro{ISO} standards'' for his dissertation; another
commonly-required type is the Web page~--- see
% beware line-wrap
\Qref[question]{URLs in bibliographies}{Q-citeURL}).
\begin{ctanrefs}
\item[\nothtml{\normalfont}\BibTeX{} documentation]\CTANref{bibtex-doc}
\item[makebst.tex]Distributed with \CTANref{custom-bib}
\end{ctanrefs}

\Question[Q-capbibtex]{Capitalisation in \BibTeX{}}

The standard \BibTeX{} bibliography styles impose fixed ideas about
the capitalisation of titles of things in the bibliography.  While
this is not unreasonable by \BibTeX{}'s lights (the rules come from
the \emph{Chicago Manual of Style}) it can be troublesome, since
\BibTeX{} fails to recognise special uses (such as acronyms, chemical
formulae, etc.).

The solution is to enclose the letter or letters, whose capitalisation
\BibTeX{} should not touch, in braces, as:
\begin{verbatim}
  title = {The {THE} operating system},
\end{verbatim}
Sometimes you find \BibTeX{} changing the case of a single letter
inappropriately.  No matter: the technique can be applied to single
letters, as in:
\begin{verbatim}
  title = {Te{X}niques and tips},
\end{verbatim}

If your document design specification requires a different style of
capitalisation, you should acquire a bibliography style that doesn't
enforce \BibTeX{}'s default rules.  It is definitely \emph{not} a good
idea to enclose an entire title in braces, as in
\begin{verbatim}
  title = {{TeXniques and tips}},
\end{verbatim}
though that does ensure that the capitalisation is not changed.  Your
\BibTeX{} database should be a general-purpose thing, not something
tuned to the requirements of a particular document, or to the way you
are thinking today.

There's more on the subject in the
% beware line wrap
\nothtml{\BibTeX{} documentation (}%
\Qref{\BibTeX{} documentation}{Q-BibTeXing}\nothtml{)}.

\Question[Q-bibaccent]{Accents in bibliographies}

\BibTeX{} not only has a tendency (by default) to mess about with the
\nothtml{case of letters in your bibliography (}% beware line wraps
\Qref{case of letters in your bibliography}{Q-capbibtex}\nothtml{)},
also makes a hash of accent commands:
\begin{htmlversion}
``\texttt{ma\~nana}'' comes out as ``ma nana'' (!).  The solution is
similar: enclose the troublesome sequence in braces, as
``|{|\texttt{\~n}|}|'', in this example.
\end{htmlversion}
\htmlignore
``|ma\~nana|'' comes out as ``ma nana'' (!).  The solution is similar:
enclose the troublesome sequence in braces, as ``|{\~n}|'', in this
example.
\endhtmlignore

\Question[Q-bibstrtl]{`String too long' in \BibTeX{}}

The \BibTeX{} diagnostic ``Warning--you've exceeded 1000, the
|global-string-size|, for entry |foo|'' usually arises from a very
large abstract or annotation included in the database.  The diagnostic
usually arises because of an infelicity in the coding of
\File|abstract.bst|, or styles derived from it.  (One doesn't
ordinarily output annotations in other styles.)

The solution is to make a copy of the style file (or get a clean copy
from \acro{CTAN}~--- \CTANref{abstract-bst}), and rename it (e.g., on a
long file-name system to \File|abstract-long.bst|).  Now edit it: find
function |output.nonnull| and
\begin{itemize}
\item change its first line (line 60 in the version on \acro{CTAN})
  from |"{ 's :="| to |"{ swap$"|, and
\item delete its last line, which just says |"s"| (line 84 in the
  version on \acro{CTAN}).
\end{itemize}
Finally, change your \cs|bibliographystyle| command to refer to the
name of the new file.

This technique applies equally to any bibliography style: the same
change can be made to any similar |output.nonnull| function.

%is not one that you can hope
%to avoid by altering the \BibTeX{} style in a simple way~--- \BibTeX{}
%itself needs recompiling to increase its limit on string sizes (which is
%often not practical, and is never desirable).  You must therefore 
%address the problem by changing your bibliography database.

If you're reluctant to make this sort of change, the only way forward
is to take the entry out of the database, so that you don't encounter
\BibTeX{}'s limit, but you may need to retain the entry because it
will be included in the typeset document.  In such cases, put the body
of the entry in a separate file:
\begin{verbatim}
  @article{long.boring,
    author =    "Fred Verbose",
    ...
    abstract =  "{\input{abstracts/long.tex}}"
  }
\end{verbatim}
In this way, you arrange that all \BibTeX{} has to deal with is the
file name, though it will tell \TeX{} (when appropriate) to include
all the long text.

\Question[Q-manyauthor]{\BibTeX{} doesn't understand lists of names}

\BibTeX{} has a strict syntax for lists of authors' (or editors')
names in the \BibTeX{} data file; if you write the list of names in a
``natural''-seeming way, the chances are you will confuse \BibTeX{},
and the output produced will be quite different from what you had
hoped.

Names should be expressed in one of the forms
\begin{verbatim}
  First Last
  Last, First
  Last, Suffix, First
\end{verbatim}
and lists of names should be separated with ``|and|''.
For example:
\begin{verbatim}
AUTHOR = {Fred Q. Bloggs, John P. Doe \&
          Robin Fairbairns}
\end{verbatim}
falls foul of two of the above rules: a syntactically significant
comma appears in an incorrect place, and \cs|&| is being used as a
name separator.  The output of the above might be something like:
\begin{verbatim}
John P. Doe \& Robin Fairbairns Fred Q. Bloggs
\end{verbatim}
because ``John P. Doe \& Robin Fairbairns'' has become the `first name',
while ``Fred Q. Bloggs'' has become the `last name' of a single
person.  The example should have been written:
\begin{verbatim}
AUTHOR = {Fred Q. Bloggs and John P. Doe and
          Robin Fairbairns}
\end{verbatim}

Some bibliography styles implement clever acrobatics with very long
author lists.  You can force truncation by using the pseudo-name
``|others|'', which will usually translate to something like
``\emph{et al}'' in the typeset output.  So, if Mr.~Bloggs wanted to
distract attention from his co-authors, he would write:
\begin{verbatim}
AUTHOR = {Fred Q. Bloggs and others}
\end{verbatim}

\Question[Q-citeURL]{\acro{URL}s in \BibTeX{} bibliographies}

There is no citation type for \acro{URL}s, \emph{per se}, in the
standard \BibTeX{} styles, though Oren Patashnik (the author of
\BibTeX{}) is believed to beconsidering developing one such for use
with the long-awaited \BibTeX{} version~1.0.

The actual information that need be available in a citation of an
\acro{URL} is discussed at some length in the publicly available
on-line 
\htmlignore
\ifpdf
\href{http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm}%
     {extracts of \acro{ISO}~690--2};
\else
extracts of \acro{ISO}~690--2, available via
\URL{http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm};
\fi
\endhtmlignore
\begin{htmlversion}
\href{http://www.nlc-bnc.ca/iso/tc46sc9/standard/690-2e.htm}{extracts of \acro{ISO}\nobreakspace690--2};
\end{htmlversion}
the techniques below do \emph{not} satisfy all the requirements of
\acro{ISO}~690--2, but they offer a solution that is at least
available to users of today's tools.

Until the new version of \BibTeX{} arrives, the simplest technique is
to use the  |howpublished| field of the standard styles' |@misc|
function.  Of course, the strictures
\nothtml{about typesetting \acro{URL}s (}%
\htmlonly{about }\Qref{typesetting \acro{URL}s}{Q-setURL}%
\nothtml{)} still apply, so the entry will look like:
\begin{verbatim}
  @misc{...,
    ...,
    howpublished = "\url{http://...}"
  }
\end{verbatim}

A possible alternative approach is to use \BibTeX{} styles other than
the standard ones, that already have \acro{URL} entry types.
Pre-eminent are the \Package{natbib} styles (\Package{plainnat},
\Package{unsrtnat} and \Package{abbrevnat}).  These styles are
extensions of the standard styles, principally for use with
\Package{natbib} itself, but they've acquired \acro{URL}s and other
``modern'' entries along the way.  The same author's
\Package{custom-bib} is also capable of generating styles that honour
\acro{URL} entries.

Another candidate is the \Package{harvard} package (if its citation
styles are otherwise satisfactory for you).  \Package{Harvard}
bibliography styles all include a ``|url|'' field in their
specification; however, the typesetting offered is somewhat feeble
(though it does recognise and use \ProgName{LaTeX2HTML} macros if they
are available, to create hyperlinks).

You can also acquire new \BibTeX{} styles by use of Norman Gray's
\Package{urlbst} system, which is based on a \ProgName{perl} script
that edits an existing \BibTeX{} style file to produce a new
style. The new style thus generated has a |webpage| entry type, and
also offers support for |url| and |lastchecked| fields in the other entry
types.  The \ProgName{perl} script comes with a set of converted
versions of the standard bibliography styles.  Documentation is
distributed as \LaTeX{} source.

Another possibility is that some conventionally-published paper,
technical report (or even book) is also available on the Web.  In such
cases, a useful technique is something like:
\begin{verbatim}
  @techreport{...,
    ...,
    note = "Also available as \url{http://...}"
  }
\end{verbatim}

There is good reason to use the \Package{url} or \Package{hyperref}
packages in this context, since (by default) the \cs|url| command
ignores spaces in its argument.  \BibTeX{} has a habit of splitting
lines it considers excessively long, and if there are no space
characters for it to use as `natural' breakpoints, \BibTeX{} will
insert a comment (`\texttt{\textpercent}') character~\dots{}\@ which
is an acceptable character in an \acro{URL}, so that \cs|url| will
typeset it.  If you're using \Package{url}, the way around the problem
is to insert odd spaces inside the \acro{URL} itself in the |.bib|
file, to enable \BibTeX{} to make reasonable decisions about breaking
the line.  Note that the version of \cs|url| that comes with recent
versions of the \Package{hyperref} package doesn't suffer from the
`\texttt{\textpercent}-end of line' problem: \Package{hyperref}
spots the problem, and suppresses the unwanted characters.
\begin{ctanrefs}
\item[custom-bib \nothtml{\rmfamily}bundle]\CTANref{custom-bib}
\item[harvard.sty]\CTANref{harvard}
\item[hyperref.sty]\CTANref{hyperref}
\item[natbib \nothtml{\rmfamily}styles]\CTANref{natbib}
\item[url.sty]\CTANref{url}
\item[urlbst]\CTANref{urlbst}
\end{ctanrefs}

\Question[Q-bibplain]{Using \BibTeX{} with Plain \TeX{}}

The file \File|btxmac.tex| (which is part of the \Eplain{} system)
contains macros and documentation for using \BibTeX{} with Plain
\TeX{}, either directly or with \nothtml{\Eplain{}
  (}\Qref{\Eplain{}}{Q-eplain}\latexhtml{).}{.}  See
\Qref[question]{the use of \BibTeX{}}{Q-BibTeXing} for more
information about \BibTeX{} itself.
\begin{ctanrefs}
\item[btxmac.tex]\CTANref{btxmactex}
\item[eplain \nothtml{\rmfamily}system]\CTANref{eplain}
\end{ctanrefs}

\Question[Q-makebib]{Reconstructing \texttt{.bib} files}

Perhaps you've lost the |.bib| file you generated your document from,
or have been sent a document without one.  Or even, you've realised
the error of building a substantial document without the benefit of
\BibTeX{}\dots{}

The \ProgName{perl} script, \Package{tex2bib} makes a reasonable job
of regenerating |.bib| files from \environment{thebibliography}
environments, provided that the original (whether automatically or
manually generated) doesn't deviate too far from the ``standard''
styles.

You are well-advised to check the output of the script.  While it will
not usually destroy information, it can quite reasonably mislabel it.

Documentation of the script is to be found in its ``readme'' file.
\begin{ctanrefs}
\item[tex2bib]\CTANref{tex2bib}
\end{ctanrefs}

\Question[Q-bibprefixsort]{\BibTeX{} sorting and name prefixes}

\BibTeX{} recognises a bewildering array of name prefixes (mostly
those deriving from European language names); it ignores the prefixes
when sorting the bibliography~--- you want ``Ludwig van Beethoven''
sorted under ``Beethoven'', not under ``van''.  (Lamport made a witty
deliberate mistake with Beethoven's name, in the first edition of his
\LaTeX{} manual.)

However, a recurring issue is the desire to quote Lord Rayleigh's
publications (``Lord'' isn't an acceptable prefix), or names from
languages that weren't considered when \BibTeX{} was designed such as
``al-Wakil'' (transcribed from the Arabic).  What's needed is a
separate ``sort key'', but \BibTeX{} only allows such a thing in
citations of items that have no author or editor.

The solution is to embed the sort key in the author's name, but to
prevent it from being typeset.  Patashnik recommends a command
\csx{noopsort} (no-output-sortkey), which is defined and used as
follows:
\begin{verbatim}
  @PREAMBLE{ {\providecommand{\noopsort}[1]{}} }
  ...
  @ARTICLE{Rayleigh1,
  AUTHOR = "\noopsort{Rayleigh}{Lord Rayleigh}",
  ...
\end{verbatim}

\subsection{Creating citations}

\Question[Q-chapbib]{Separate bibliographies per chapter?}

A separate bibliography for each `chapter' of a document can be provided
with the package \Package{chapterbib} (which comes with a bunch of
other good bibliographic things).  The package allows you a
different bibliography for each \cs|include|d file (i.e., despite the
package's name, the availability of bibliographies is related to the
component source files of the document rather than to the chapters that
logically structure the document).

The package \Package{bibunits} ties bibliographies to logical units
within the document: the package will deal with chapters and sections
(as defined by \LaTeX{} itself) and also defines a \environment{bibunit}
environment so that users can select their own structuring.
\begin{ctanrefs}
\item[chapterbib.sty]\CTANref{cite}
\item[bibunits.sty]\CTANref{bibunits}
\end{ctanrefs}

\Question[Q-multbib]{Multiple bibliographies?}

If you're thinking of multiple bibliographies tied to some part of
your document (such as the chapters within the document), please see
\Qref[question]{bibliographies per chapter}{Q-chapbib}.

For more than one bibliography, there are three options.

The \Package{multibbl} package offers a very simple interface: you use
a command \cs|newbibliography| to define a bibliography ``tag''.  The package
redefines the other bibliography commands so that each time you use any one
of them, you give it the tag for the bibliography where you want the
citations to appear.  The \cs|bibliography| command itself also takes
a further extra argument that says what title to use for the resulting
section or chapter (i.e., it patches
\nothtml{\cs|refname| and \cs|bibname|~---}
\Qref{\cs|refname| and \cs|bibname|}{Q-fixnam}\nothtml{~---} in a
\Package{babel}-safe way).  So one might write:
\htmlignore
\begin{dviversion}
\begin{quote}
\begin{verbatim}
\usepackage{multibbl}
\newbibliography{bk}
\bibliographystyle{bk}{alpha}
\newbibliography{art}
\bibliographystyle{art}{plain}
...
\cite[pp.~23--25]{bk}{milne:pooh-corner}
...
\cite{art}{einstein:1905}
...
\bibliography{bk}{book-bib}%
             {References to books}
\bibliography{art}{art-bib}%
             {References to articles}
\end{verbatim}
\end{quote}
\end{dviversion}
\begin{pdfversion}
\begin{quote}
\begin{verbatim}
\usepackage{multibbl}
\newbibliography{bk}
\bibliographystyle{bk}{alpha}
\newbibliography{art}
\bibliographystyle{art}{plain}
...
\cite[pp.~23--25]{bk}{milne:pooh-corner}
...
\cite{art}{einstein:1905}
...
\bibliography{bk}{book-bib}{References to books}
\bibliography{art}{art-bib}{References to articles}
\end{verbatim}
\end{quote}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{quote}
\begin{verbatim}
\usepackage{multibbl}
\newbibliography{bk}
\bibliographystyle{bk}{alpha}
\newbibliography{art}
\bibliographystyle{art}{plain}
...
\cite[pp.~23--25]{bk}{milne:pooh-corner}
...
\cite{art}{einstein:1905}
...
\bibliography{bk}{book-bib}{References from books}
\bibliography{art}{art-bib}{References from articles}
\end{verbatim}
\end{quote}
\end{htmlversion}
(Note that the optional argument of \cs|cite| appears \emph{before} the
new tag argument, and that the \cs|bibliography| commands may list
more than one |.bib| file~--- indeed all \cs|bibliography| commands
may list the same set of files.)

The \cs|bibliography| data goes into files whose names are
\meta{tag-name}\emph{.aux}, so you will need to run
\begin{quote}
\begin{verbatim}
bibtex bk
bibtex art
\end{verbatim}
\end{quote}
after the first run of \LaTeX{}, to get the citations in the correct
place.

The \Package{multibib} package allows you to define a series of
``additional topics'', each of which comes with its own series of
bibliography commands.  So one might write:
\begin{quote}
\begin{verbatim}
\usepackage{multibib}
\newcites{bk,art}%
         {References from books,%
          References from articles}
\bibliographystylebk{alpha}
\bibliographystyleart{plain}
...
\citebk[pp.~23--25]{milne:pooh-corner}
...
\citeart{einstein:1905}
...
\bibliographybk{book-bib}
\bibliographyart{art-bib}
\end{verbatim}
\end{quote}
Again, as for \Package{multibbl}, any \cs|bibliography...| command may
scan any list of |.bib| files.

\BibTeX{} processing with \Package{multibib} is much like that with
\Package{multibbl}; with the above example, one needs:
\begin{quote}
\begin{verbatim}
bibtex bk
bibtex art
\end{verbatim}
\end{quote}
Note that, unlike \Package{multibbl}, \Package{multibib} allows a
simple, unmodified bibliography (as well as the ``topic'' ones).  

The \Package{bibtopic} package allows you separately to cite several
different bibliographies.  At the appropriate place in your document,
you put a sequence of \environment{btSect} environments (each of which
specifies a bibliography database to scan) to typeset the separate
bibliographies.  Thus, one might have a file \File{diss.tex} containing:
\begin{quote}
\begin{verbatim}
\usepackage{bibtopic}
\bibliographystyle{alpha}
...
\cite[pp.~23--25]{milne:pooh-corner}
...
\cite{einstein:1905}
...
\begin{btSect}{book-bib}
\section{References from books}
\btPrintCited
\end{btSect}
\begin{btSect}[plain]{art-bib}
\section{References from articles}
\btPrintCited
\end{btSect}
\end{verbatim}
\end{quote}
Note the different way of specifying a bibliographystyle: if you want
a different style for a particular bibliography, you may give it as an
optional argument to the \environment{btSect} environment.

Processing with \BibTeX{}, in this case, uses |.aux| files whose names
are derived from the name of the base document.  So in this example
you need to say:
\begin{quote}
\begin{verbatim}
bibtex diss1
bibtex diss2
\end{verbatim}
\end{quote}

There is also a command \cs|btPrintNotCited|, which gives the rest of
the content of the database (if nothing has been cited from the
database, this is equivalent to \LaTeX{} standard \cs|nocite{*}|).

However, the \emph{real} difference from \Package{miltibbl} and
\Package{mltibib} is that selection of what appears in each
bibliography section is determined in \Package{bibtopic} by what's in
the |.bib| files.
\begin{ctanrefs}
\item[bibtopic.sty]\CTANref{bibtopic}
\item[multibbl.sty]\CTANref{multibbl}
\item[multibib.sty]\CTANref{multibib}
\end{ctanrefs}


\Question[Q-bibinline]{Putting bibliography entries in text}

This is a common requirement for journals and other publications in
the humanities.  Sometimes the requirement is for the entry to appear
in the running text of the document, while other styles require that
the entry appear in a footnote.

Options for entries in running text are
\begin{itemize}
\item The package \Package{bibentry}, which puts slight restrictions
  on the format of entry that your |.bst| file generates, but is
  otherwise undemanding of the bibliography style.
\item The package \Package{inlinebib}, which requires that you use its
  \File|inlinebib.bst|
\item The package \Package{jurabib}, which was originally targetted at
  German law documents, and has comprehensive facilities for the
  manipulation of citations.  The package comes with four bibliography
  styles that you may use: \File|jurabib.bst|, \File|jhuman.bst| and
  two Chicago-like ones.
\end{itemize}

Options for entries in footnotes are
\begin{itemize}
\item The package \Package{footbib}, and
\item The package \Package{jurabib}, again.
\end{itemize}
\begin{ctanrefs}
\item[bibentry.sty]\emph{Distributed with} \CTANref{natbib}
\item[footbib.sty]\CTANref{footbib}
\item[inlinebib.sty]\CTANref{inlinebib}
\item[jurabib.sty]\CTANref{jurabib}
\end{ctanrefs}

\Question[Q-citesort]{Sorting and compressing citations}

If you give \LaTeX{}
\cmdinvoke{cite}{fred,joe,harry,min}, its default commands could give
something like ``[2,6,4,3]'';
this looks awful.  One can of course get the things in order by
rearranging the keys in the \cs|cite| command, but who wants to do
that sort of thing for no more improvement than ``[2,3,4,6]''?

The \Package{cite} package sorts the numbers and detects consecutive
sequences, so creating ``[2--4,6]''.  The \Package{natbib} package,
with the \texttt{numbers} and \texttt{sort\&compress} options, will
do the same when working with its own numeric bibliography styles
(\File|plainnat.bst| and \File|unsrtnat.bst|).

If you might need to make hyperreferences to your citations,
\Package{cite} isn't adequate.  If you add the \Package{hypernat}
package:
\begin{verbatim}
  \usepackage[...]{hyperref}
  \usepackage[numbers,sort&compress]{natbib}
  \usepackage{hypernat}
  ...
  \bibliographystyle{plainnat}
\end{verbatim}
the \Package{natbib} and \Package{hyperref} packages will interwork.
\begin{ctanrefs}
\item[cite.sty]\CTANref{cite}
\item[hypernat.sty]\CTANref{hypernat}
\item[hyperref.sty]\CTANref{hyperref}
\item[plainnat.bst]Distributed with \CTANref{natbib}
\item[unsrtnat.bst]Distributed with \CTANref{natbib}
\end{ctanrefs}

\Question[Q-mcite]{Multiple citations}

A convention sometimes used in physics journals is to ``collapse'' a group of
related citations into a single entry in the bibliography.  \BibTeX{},
by default, can't cope with this arrangement, but the \Package{mcite}
package deals with the problem.

The package overloads the \cs|cite| command to recognise a
``\texttt{*}'' at the start of a key, so that citations of the form
\begin{quote}
\begin{verbatim}
\cite{paper1,*paper2}
\end{verbatim}
\end{quote}
appear in the document as a single citation, and appear arranged
appropriately in the bibliography itself.  You're not limited to
collapsing just two references.  You can mix ``collapsed'' references
with ``ordinary'' ones, as in
\begin{quote}
\begin{verbatim}
\cite{paper0,paper1,*paper2,paper3}
\end{verbatim}
\end{quote}
Which will appear in the document as 3~citations ``[4,7,11]''
(say)~--- citation `4' will refer to paper~0, `7' will refer to a
combined entry for paper~1 and paper~2, and `11' will refer to
paper~3.

You need to make a small change to the bibliography style (|.bst|) file you
use; the \Package{mcite} package documentation tells you how to do that.
\begin{ctanrefs}
\item[mcite.sty]\CTANref{mcite}
\end{ctanrefs}

\Question[Q-backref]{References from the bibliography to the citation}

A link (or at least a page reference), from the bibliography to the
citing command, is often useful in large documents.

Two packages support this requirement, \Package{backref} and
\Package{citeref}.  \Package{Backref} is part of the
\Package{hyperref} bundle, and supports hyperlinks back to the citing
command.  \Package{Citeref} is the older, and seems to rely on rather
simpler (and therefore possibly more stable) code.  Neither collapses
lists of pages (``|5, 6, 7|'' comes out as such, rather than as
``|5--7|''), but neither package repeats the reference to a page that
holds multiple citations.  (The failure to collapse lists is of course
forgiveable in the case of the \Package{hyperref}-related
\Package{backref}, since the concept of multiple hyperlinks from the
same anchor is less than appealing.)
\begin{ctanrefs}
\item[backref.sty]Distributed with \CTANref{hyperref}
\item[citeref.sty]\CTANref{citeref}
\end{ctanrefs}

\subsection{Manipulating whole bibliographies}

\Question[Q-nocite*]{Listing all your \BibTeX{} entries}

\LaTeX{} and \BibTeX{} co-operate to offer special treatment of this
requirement.  The command \cmdinvoke{nocite}{*} is specially treated,
and causes \BibTeX{} to generate bibliography entries for every entry
in each |.bib| file listed in your \cs|bibliography| statement, so
that after a \LaTeX{}--\BibTeX{}--\LaTeX{} sequence, you have a
document with the whole thing listed.

Note that \LaTeX{} \emph{doesn't} produce
% beware line breaks
``\texttt{Citation ... undefined}'' or
``\texttt{There were undefined references}'' warnings in respect of
\cmdinvoke{nocite}{*}.  This isn't a problem if you're running
\LaTeX{} ``by hand'' (you \emph{know} exactly how many times you have
to run things), but the lack might confuse automatic processors that
scan the log file to determine whether another run is necessary.

\Question[Q-htmlbib]{Making \acro{HTML} of your Bibliography}

A neat solution is offered by the \Package{noTeX} bibliography style.
This style produces a |.bbl| file which is in fact a series of
\acro{HTML} `|P|' elements of class |noTeX|, and which may therefore
be included in an \acro{HTML} file.  Provision is made for customising
your bibliography so that its content when processed by
\Package{noTeX} is different from that presented when it is processed
in the ordinary way by \AllTeX{}.

A more conventional translator is the \ProgName{awk} script
\ProgName{bbl2html}, which translates the |.bbl| file you've generated:
a sample of the script's output may be viewed on the web, at
\URL{http://rikblok.cjb.net/lib/refs.html}
\begin{ctanrefs}
\item[bbl2html.awk]\CTANref{bbl2html}
\item[noTeX.bst]\CTANref{noTeX}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Installing \AllTeX{} files}

\Question[Q-instpackages]{Installing a new package}

The first step in installing a new package for your \LaTeX{} system
is usually to \nothtml{find where it is (}% beware line wrap
\Qref{find where it is}{Q-findpkg}\nothtml{)}
and then to get it, usually from \acro{CTAN}
% beware line break...
(see \Qref[question]{finding files at CTAN}{Q-siteindex}).  Note that
Mik\TeX{} 2.1 offers a \nothtml{simpler procedure (}% beware line break
\Qref{simpler procedure}{Q-miktexinst}\nothtml{)} than that described
here, for packages it knows about.

Ordinarily, you should download the whole distribution directory; the
only occasion when this is not necessary is when you are getting
something from one of the \AllTeX{} contributed ``\File|misc|''
directories on \acro{CTAN}; these directories contain collections of
single files, which are supposedly complete in themselves.

A small package \meta{smallpack} might be just a single |.sty| file
(typically \File|smallpack.sty|) with the usage instructions either
included as comments in the file or in a seperate user manual or
\File|README| file.  More often a package \Package{pack} will come as
a pair of files, \File|pack.ins| and \File|pack.dtx|, written to be
used with the \LaTeX{} \Package{doc} system.  The package code must be
extracted from these files.  If there is a \File|README| file as part
of the package distribution, read it!

In the \Package{doc} system, the user manual and documented package
code is in the |.dtx| file, and the |.ins| file contains \LaTeX{}
instructions on what code should be extracted from the |.dtx| file. To
unpack a \Package{doc} package \meta{pack}, do the following:
\begin{itemize}
\item Run latex on \Package{pack.ins}. This will generate one or more
  files (normally a \Package{pack.sty} file but there may be others
  depending on the particular package).
\item Run latex on \Package{pack.dtx} as a start to getting the user
  manual and possibly a commented version of the package code.
\item Run latex again on \Package{pack.dtx}, which should resolve any
  references and generate a Table of Contents if it was called for.
\item \LaTeX{} may have said ``|No file pack.ind|''; this is the
  source for the command index; if you want the index, process the raw
  material with:\\
  |  makeindex -s gind.ist pack|\\
  and run \LaTeX{} again.
\item Print and read \File|pack.dvi|
\end{itemize}
Sometimes a user manual is supplied seperately from the \File|.dtx|
file. Process this \emph{after} doing the above, just in case the user
manual uses the package it is describing.

Almost the final stage of the installation is to put the package
file(s) \emph{`where \LaTeX{} can find them'}. Where the magic place
is, and how you put the files there depends on your particular
\LaTeX{} system and how it is set up (see
% beware line-breaking, next three lines
\Qref[question]{the \TeX{} directory structure standard}{Q-tds} for
general principles,
\Qref[question]{where to put files}{Q-wherefiles} for specific advice).

The final stage is to tell \LaTeX{} that there is a new file, or
files, that it should be able to go and find. Most free \LaTeX{} systems
maintain a database of the names and locations of latex-related files
to enable faster searching.  In these systems the database must be
updated, using the script or program provided with the distribution
for this purpose.
\begin{description}
\item[te\TeX{}, fp\TeX{}] Run: \\
   |texhash| 
\item[web2c] On a current \Package{web2c} distribution, |texhash|
   ought to work; if it doesn't, run: \\
   |mktexlsr| 
\item[Mik\TeX{}] On a \Package{MikTeX} distribution earlier than v2.0, do: \\
  \texttt{Start}\arrowhyph{}%
  \texttt{Programs}\arrowhyph{}%
  \texttt{MikTeX}\arrowhyph{}%
  \texttt{Maintenance}\arrowhyph{}%
  \texttt{Refresh filename database}
% this sequence confirmed ok for miktex 1.20, 2000/09/14, by Michael
% Dewey of Nottingham University 

  or get a DOS window and run:\\
  \texttt{initexmf -\relax-update-fndb}

  On a \Package{MikTeX} distribution v2.0 or later, do:\\
  \texttt{Start}\arrowhyph{}%
  \texttt{Programs}\arrowhyph{}%
  \texttt{MikTeX 2}\arrowhyph{}%
  \texttt{MikTeX Options}, and press the
  % beware line break
  \texttt{Update filename database} button.
\end{description}

Remember that a |\usepackage{pack}| command must be put in the preamble
of each document in which you want to use the \Package{pack} package.

\Question[Q-wherefiles]{Where to put new files}

Where precisely you put files that you have downloaded does
depend on what \TeX{} distribution you have. However,
assuming that you have one of the modern \acro{TDS}-compliant
distributions (such as te\TeX{}, fp\TeX{} or mik\TeX{}) there are
some general rules that you can follow:

% we're sort-of emulating an enumerated list here, but avoiding the
% indentation normally associated with it.  we can't afford the
% indentation, since the columns (in 2-column mode) are so narrow.
\htmlignore
\vspace{2pt}
\noindent
\endhtmlignore
(1) Always install new files in a local \File|texmf|
tree. The root directory will be named something like:
\begin{verbatim}
 teTeX:          /usr/share/texmf-local/ or
                 /usr/local/share/texmf/
 fpTeX:          c:\fptex\texmf.local\
 mikTeX:         c:\localtexmf\
\end{verbatim}
(In fact, a te\TeX{} system can be asked to tell you what its local
root is; on a Unix system, the command to use is:
\begin{verbatim}
  kpsewhich -expand-var \$TEXMFLOCAL
\end{verbatim}
the output being the actual path.)

Let's write |$TEXMF| for this root, whatever it is for your system.

\htmlignore
\vspace{2pt}
\noindent
\endhtmlignore
(2) In your local texmf tree, imitate the directory structure in your
main tree. Here's some examples of where files of given extensions should
go:
\begin{verbatim}
.sty, .cls or .fd: $TEXMF/tex/latex/<package>/
.dvi, .ps or .pdf: $TEXMF/doc/latex/<package>/
.mf:   $TEXMF/fonts/source/<supplier>/<font>/
.tfm:  $TEXMF/fonts/tfm/<supplier>/<font>/
.vf:   $TEXMF/fonts/vf/<supplier>/<font>/
.afm:  $TEXMF/fonts/afm/<supplier>/<font>/
.pfb:  $TEXMF/fonts/type1/<supplier>/<font>/
.ttf:  $TEXMF/fonts/truetype/<supplier>/<font>/
\end{verbatim}
Where of course \meta{package}, \meta{font} and \meta{supplier} depend
upon what's appropriate for the individual file.  Note, however, that
\meta{font} may stand for a single font or an entire family: for
example, files for all of Knuth's Computer Modern font family are to
be found in |.../public/cm|, with various prefixes as appropriate.

\Question[Q-miktexinst]{Installing Mik\TeX{} ``known packages''}

Mik\TeX{} 2.1 maintains a database of packages it ``knows about'',
together with (coded) installation instructions that enable it to
install with with minimal user intervention.

If Mik\TeX{} does know about a package you need installed, it's worth
using the system.

First, open the Mik\TeX{} packages window: click on
  \texttt{Start}\arrowhyph{}%
  \texttt{Programs}\arrowhyph{}%
  \texttt{MikTeX}\arrowhyph{}%
  \texttt{MikTeX Options}, and select the
  \texttt{Packages} tab.
  
On the tab, there is an Explorer-style display of packages.
Right-click on the root of the tree, ``\texttt{MikTeX Packages}'',
and select ``\texttt{Search}'': enter the name of the package you're
interested in, and press the ``\texttt{Search}'' button.  If
Mik\TeX{} knows about your package, it will open up the tree to show
you a tick box for you package: check that box.

If Mik\TeX{} \emph{doesn't} know about the package you're interested
in, you have to use the \nothtml{long-winded procedure (}%
\Qref{long-winded procedure}{Q-instpackages}\nothtml{)} outlined
elsewhere in this \acro{FAQ}.

If necessary, repeat to select other packages, and then press
``\texttt{OK}''; Mik\TeX{} tells you how many packages you have
selected~--- if you're happy, press ``\texttt{OK}'' again.
Mik\TeX{} will go off, download the package (as a
|.cab| file), if necessary, install the files of the package, and then
refresh the filename database so that the files will be found.

\Question[Q-tempinst]{``Temporary'' installation of \AllTeX{} files}

Operating systems and applications need to know where to find files:
many files that they need are ``just named''~--- the user doesn't
necessarily know \emph{where} they are, but knows to ask for them.
The commonest case, of course, is the commands whose names you type to
a shell (yes, even Windows' ``\MSDOS{} prompt'') are using a shell to read what
you type: many of the commands simply involve loading and executing a
file, and the |PATH| variable tells the shell where to find those files.

Modern \TeX{} implementations come with a bunch of search paths
built in to them.  In most circumstances these paths are adequate, but
one sometimes needs to extend them to pick up files in strange
places: for example, we may wish to try a new bundle of packages
before \nothtml{installing them `properly' (}%
% beware line break
\Qref{installing them `properly'}{Q-instpackages}\nothtml{)}.  To do
this, we need to change the relevant path as \TeX{} perceives it.
However, we don't want to throw away \TeX{}'s built-in path (all of a
sudden, \TeX{} won't know how to deal with all sorts of things).

To \emph{extend} a \TeX{} path, we define an operating system
environment variable in `path format', but leaving a gap which \TeX{}
will fill with its built-in value for the path.  The commonest case is
that we want to place our extension in front of the path, so that our
new things will be chosen in preference, so we leave our `gap to be
filled' at the end of the environment variable.  The syntax is simple
(though it depends which shell you're actually using): so on a
Unix-like system, using the \ProgName{bash} shell, the job might be
done like:
\begin{verbatim}
  export TEXINPUTS=/tmp:
\end{verbatim}
while in a Windows system, within a \MSDOS{} window, it would be:
\begin{verbatim}
  set TEXINPUTS=C:/temp;
\end{verbatim}
In either case, we're asking \TeX{} to load files from the root disc
temporary files directory; in the Unix case, the ``empty slot'' is
designated by putting the path separator `|:|' on its own at the end
of the line, while in the Windows case, the technique is the same, but
the path separator is `|;|'.

Note that in either sort of system, the change will only affect
instances of \TeX{} that are started from the shell where the
environment variable was set.  If you run \TeX{} from another window,
it will use the original input path.  To make a change of input path
that will ``stick'' for all windows, set the environment variable in
your login script or profile (or whatever) in a Unix system and log
out and in again, or in \File|autoexec.bat| in a Windows system, and
reboot the system.

While all of the above has talked about where \TeX{} finds its macro
files, it's applicable to pretty much any sort of file any
\TeX{}-related program reads~--- there are lots of these paths, and of
their corresponding environment variables.  In a
\ProgName{web2c}-based system, the copious annotations in the
\File|texmf.cnf| system configuration file help you to learn which
path names correspond to which type of file.

\Question[Q-instfont]{Installing a new font}

Fonts are really ``just another package'', and so should be installed
in the same sort of way as packages.  However, fonts tend to be more
complicated than the average package, and as a result it's sometimes
difficult to see the overall structure.

Font files may appear in any of a large number of different formats;
each format has a different function in a \TeX{} system, and each is
stored in a directory its own sub-tree in the installation's
\acro{TDS} tree; all these sub-trees have the directory
\File|$TEXMF/fonts| as their root.  A sequence of answers%
\nothtml{, below,} describes the installation of fonts\latexhtml{.}{:}
\begin{htmlversion}
follow the list through the ``next question'' links at the bottom of
this answer to view them all.
\end{htmlversion}

\Question[Q-instmffont]{Installing a font provided as \MF{} source}

Metafont fonts are (by comparison with other sorts of font) rather
pleasingly simple.  Nowadays, they are mostly distributed just as the
\MF{} source, since modern \TeX{} distributions are able to produce
everything the user needs ``on the fly''; however, if the distribution
\emph{does} include \acro{TFM} files, do install them, too, since they
save a little time and don't occupy much disc space.  Always distrust
distributions of \acro{PK} font bitmap files: there's no way of
learning from them what printer they were generated for, and naming
schemes under different operating systems are another source of
confusion.

\nothtml{``Where to install files'' (}% beware line breaks
\htmlonly{``}\Qref{Where to install files}{Q-wherefiles}\latexhtml{)}{''}
specifies where the files should go.

A confusion is introduced by font families whose authors devise rules
for automatic generation of \MF{} sources for generating fonts at
particular sizes; the installation has to know about the rules, as
otherwise it cannot generate font files.

\Question[Q-instprinterfont]{Installing a \PS{} printer built-in font}

There is a ``standard'' set of fonts that has appeared in every \PS{}
printer since the second generation of the type.  These fonts
(8~families of four text fonts each, and three special-purpose fonts)
are of course widely used, because of their simple availability.  The
set consists of:
\begin{itemize}
\item \FontName|Times| family (4 fonts)
\item \FontName|Palatino| family (4 fonts)
\item \FontName|New| \FontName|Century| \FontName|Schoolbook| family (4 fonts)
\item \FontName|Bookman| family (4 fonts)
\item \FontName|Helvetica| family (4 fonts)
\item \FontName|Avant| \FontName|Garde| (4 fonts)
\item \FontName|Courier| family (4 fonts)
\item \FontName|Utopia| family (4 fonts)
\item Zapf \FontName|Chancery| (1 font)
\item Zapf \FontName|Dingbats| (1 font)
\item \FontName|Symbol| (1 font)
\end{itemize}
All these fonts are supported, for \LaTeX{} users, by the
\Package{psnfss} set of metrics and support files in the file
\File|lw35nfss.zip| on \acro{CTAN}.  Almost any remotely modern \TeX{}
system will have some version of \Package{psnfss} installed, but
users should note that the most recent version has much improved
coverage of maths-with-\FontName|Times| and -\FontName|Palatino|, as
well as a more reliable set of font metrics.

The archive \File|lw35nfss.zip| is laid out according to the
\acro{TDS}, so in principle, installation consists simply of
``unzipping'' the file at the root of a \path|texmf| tree.

Documentation of the \Package{psnfss} bundle is provided in
\File|psnfss2e.pdf| in the distribution.
\begin{ctanrefs}
\item[psnfss \nothtml{\rmfamily}bundle]\CTANref{psnfss}
\end{ctanrefs}

\Question[Q-inst1cm]{Installing the Bluesky versions of the CM~fonts}

This is a specialised case of \nothtml{installing a font (}%
\Qref{installing a font}{Q-instfont}\nothtml{)}, but it comes easier
than most, since the font metrics are installed in every \AllTeX{}
system before you even start.  Indeed, most recent systems will have
the Type~1 fonts themselves already installed, so that the job is
already done, and all you need is to start using them:
so the first thing to do is to just try it.  On a system that uses
\ProgName{dvips} (most systems nowadays do), try the sequence:
\begin{verbatim}
  latex sample2e
  dvips -Pcmz -Pamz -o sample2e.ps sample2e
\end{verbatim}
at a ``command prompt'' (\ProgName{shell}, in a Unix-style system,
``\acro{DOS} box'' in a Windows system).

If the command works at all, the console output of the command will
include a sequence of Type~1 font file names, listed as |<cmr10.pfb>|
and so on;
this is \ProgName{dvips} telling you it's including the Type~1 font,
and you need do no more.

If the test has failed, you need to install your own set of the fonts.

The \acro{CTAN} directories listed below contain compressed archives of
the Type~1 
files for various architectures, both for the Computer Modern fonts
and for the \acro{AMS} fonts of mathematical and other useful things.
Download the archives that are appropriate for your architecture, and
extract the files~--- you only actually need the contents of the
\File|pfb| directories, since you already have the fonts
installed in the ``ordinary'' way, so that the \acro{TFM} files are
already present.  (You don't need the \PS{} font metric~--- \acro{AFM}
and \acro{PFM}~--- files in any case.)

The files should go into your local |texmf| tree (\File|texmf.local|,
\File|texmf-local|, \File|localtexmf|, or whatever).  Create
directories at offsets \path|fonts/type1/bluesky/cm| and
\path|fonts/type1/bluesky/ams|, and copy the |pfb| files into them.

Now you need to tell \ProgName{dvips}, \PDFTeX{}, etc., that the fonts
are available.  This is done by use of a \emph{map file}, which lists
\emph{font name} (as \TeX{} understands it), \emph{font name} (as it
appears in the type~1 file itself), and where the program will find
the file.  Map files are provided in the download bundles for the
\acro{AMS} fonts; for the \acro{CM} fonts, map files are available
separately.

The set of map files includes files |config.*|; each of these contains
an instruction to load a single map file.  For ordinary use, you
instruct \ProgName{dvips} to load the ``detailed'' map of the
\acro{CM} fonts by use of the command:
\begin{verbatim}
  dvips -Pcmz myfile
\end{verbatim}
The same can be done with the \acro{AMS} fonts, and you may invoke
both sets of fonts with:
\begin{verbatim}
  dvips -Pcmz -Pamz myfile
\end{verbatim}
Alternatively, the contents of \File|config.cmz| and \File|config.amz|
could be combined into a single file, perhaps \File|config.bluesky|,
loaded by the command
\begin{verbatim}
  dvips -Pbluesky myfile
\end{verbatim}

Remember, after all such changes, the % beware line breaks
\nothtml{file-name database must be refreshed (}%
\Qref{file-name database must be refreshed}{Q-instpackages}\nothtml{)}.
\begin{ctanrefs}
\item[AMS fonts]Browse \CTANref{ams-AMStype1}
\item[CM fonts]Browse \CTANref{bluesky}
\item[CM font maps]\CTANref{bluesky-maps}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Adjusting the typesetting}

\subsection{Alternative document classes}

\Question[Q-replstdcls]{Replacing the standard classes}

People are forever concocting classes that replace the standard ones:
the present author produced an \Class{ukart} class that used the
\Package{sober} package, and a few British-specific things (such as
appear in the \Package{babel} package's British-english
specialisation) in the 1980s, which is still occasionally used.

Similar public efforts were available well back in the days of
\LaTeXo{}: a notable example, whose pleasing designs seem not to have
changed much over all that time, is the \Class{ntgclass} bundle.
Each of the standard classes is replaced by a selection of classes,
named in Dutch, sometimes with a single numeric digit attached.  So we
have classes \Class{artikel2}, \Class{rapport1}, \Class{boek3} and
\Class{brief}.  These classes are moderately well documented in
English.

The \Class{KOMA-script} bundle (classes named \Class{scr...}) are a
strong current contender.  They are under active current development,
are comprehensive in their coverage, produce good-looking output and
are well documented in both English and German.

The other class currently under development is \Class{memoir}.  This
aims to replace \Class{book} and \Class{report} classes directly, and
(like \Class{KOMA-script}) is comprehensive in its coverage of small
issues.  \Class{Memoir}'s documentation is very highly spoken of, and
is sometimes recommended as an introductory tutorial on typesetting.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}KOMA-script bundle]\CTANref{koma-script}
\item[memoir.cls]\CTANref{memoir}
\item[\nothtml{\rmfamily}NTGclass bundle]\CTANref{ntgclass}
\item[sober.sty]\CTANref{sober}
\end{ctanrefs}

\Question[Q-thesis]{Formatting a thesis in \LaTeX{}}

Thesis styles are usually very specific to your University, so it's
usually not profitable to ask around for a package outside your own
University.  Since many Universities (in their eccentric way) still
require double-spacing, you may care to refer to
\Qref[question]{the relevant question}{Q-linespace}.
If you want to write your own, a good place to start is the University
of California style, but it's not worth going to a lot of trouble. (If
officials won't allow standard typographic conventions, you won't be
able to produce an \ae{}sthetically pleasing document anyway!)
\begin{ctanrefs}
\item[UC thesis style]\CTANref{ucthesis}
\end{ctanrefs}

\Question[Q-journalpaper]{Setting papers for journals}

Publishers of journals have a wide range of requirements for the
presentation of papers, and while many publishers do accept electronic
submissions in \AllTeX{}, they don't often submit recommended macros to
public archives.

Nevertheless, there are considerable numbers of macros of one sort or
another available on \acro{CTAN}; searching for your journal name in
the CTAN catalogue (see
% beware line wrap
\Qref[question]{searching \acro{CTAN} via the web}{Q-websearch})
may well turn up what you're seeking.

Failing that, you may be well advised to contact the prospective
publisher of your paper; many publishers have macros on their own web
sites, or otherwise available only upon application.

Check that the publisher is offering you macros suitable to an
environment you can use: a few still have no macros for current
\LaTeX{}, for example, claiming that \LaTeXo{} is good enough\dots{}

Some publishers rekey anything sent them anyway, so that it doesn't
really matter what macros you use.  Others merely encourage you to use
as few extensions of a standard package as possible, so that they will
find it easy to transform your paper to their own internal form.

\Question[Q-multidoc]{A `report' from lots of `article's}

This is a requirement, for example, if one is preparing the
proceedings of a conference whose papers were submitted in \LaTeX{}.

The nearest things to canned solutions are Peter Wilson's
\Class{combine} and Federico Garcia's \Class{subfiles} classes.

\Class{Combine} defines the means to `\cs|import|' entire documents,
and provides means of specifying significant features of the layout of
the document, as well as a global table of contents, and so on.  An
auxiliary package, \Package{combinet}, allows use of the \cs|title|s
and \cs|author|s (etc.\@) of the \cs|import|ed documents to appear in
the global table of contents.

\Class{Subfiles} is used in the component files of a multi-file
project, and the corresponding \Package{subfiles} is used in the
master file; arrangements may be made so that the component files will
be typeset using different page format, etc., parameters than those
used when they are typeset as a part of the main file.

A more `raw' toolkit is offered by Matt Swift's \Package{includex} and
\Package{moredefs} packages, both part of the \Package{frankenstein}
bundle) offer a possible way forward.

\Package{Includex} enables you to `\cs|includedoc|' complete articles
(in the way that you `\cs|include|' chapter files in an ordinary
report).  It doesn't do the whole job for you, though.  You need to
analyse the package use of the individual papers, and ensure that a
consistent set is loaded in the preamble of the main report.
  
A completely different approach is to use the \Package{pdfpages}
package, and to include articles submitted in \acro{PDF} format into a
a \acro{PDF} document produced by \acro{PDF}\LaTeX{}.  The package
defines an \cs|includepdf| command, which takes arguments similar to
those of the \cs|includegraphics| command.  With keywords in the
optional argument of the command, you can specify which pages you want
to be included from the file named, and various details of the layout
of the included pages.
\begin{ctanrefs}
\item[combine.cls]\CTANref{combine}
\item[combinet.sty]\CTANref{combine}
\item[includex.sty]Distributed in the ``unsupported'' part of
  \CTANref{frankenstein}
\item[moredefs.sty]Distributed as part of \CTANref{frankenstein}
\item[pdfpages.sty]\CTANref{pdfpages}
\item[subfiles.cls, etc.]\CTANref{subfiles}
\end{ctanrefs}

\Question[Q-cv]{\emph{Curriculum Vitae} (R\'esum\'e)}

A framework class, \Package{vita}, for \emph{Curricula Vitae} is
provided by Andrej Brodnik.

The class can be customised both for subject (example class option
files are offered for both computer scientists and singers), and for
language (both the options provided are available for both English and
Slovene).  Extensions may be written by creating new class option
files, or by using macros defined in the class to define new entry
types, etc.

Didier Verna's class, \Class{curve}, is based on a model in which
the \acro{CV} is made of a set of \emph{rubrics} (each one dealing
with a major item that you want to discuss, such as `education', `work
experience', etc).  The class's documentation is supported by a couple
of example files, and an emacs mode is provided.

The alternative to using a separate class is to impose a package on
one of the standard classes.  An example,
Axel Reichert's \Package{currvita} package, has been recommended to the
\acro{FAQ} team.  Its output certainly looks good.

There is also a \LaTeXo{} package \Package{resume}, which comes with
little but advice \emph{against} trying to use it.
\begin{ctanrefs}
\item[currvita.sty]\CTANref{currvita}
\item[curve.cls]\CTANref{curve}
\item[resume.sty]\CTANref{resume}
\item[vita.cls]\CTANref{vita}
\end{ctanrefs}

\Question[Q-letterclass]{Letters and the like}

\LaTeX{} itself provides a \Class{letter} document class, which is
widely disliked; the present author long since gave up trying with
it.  If you nevertheless want to try it, but are irritated by its way
of vertically-shifting a single-page letter, try the following hack:
\begin{verbatim}
\makeatletter
\let\@texttop\relax
\makeatother
\end{verbatim}
in the preamble of your file.

Doing-it-yourself is a common strategy; Knuth (for use with plain
\TeX{}, in the \TeX{}book), and Kopka and Daly (in their Guide to
\LaTeX{}) offer worked examples.

Nevertheless, there \emph{are} contributed alternatives~--- in fact
there are an awfully large number of them: the following list, of
necessity, makes but a small selection.

The largest, most comprehensive, class is \Class{newlfm}; the |lfm|
part of the name implies that the class can create letters, faxes and
memoranda.  The documentation is voluminous, and the package seems
very flexible.

Axel Kielhorn's \Class{akletter} class is the only other one,
recommended for inclusion in this \acro{FAQ}, whose documentation is
available in English.

The \Class{dinbrief} class, while recommended, is only documented in
German.

There are letter classes in each of the excellent
\Class{KOMA-script} (\Class{scrlttr2}: documentation is available in
English) and \Package{ntgclass} (\Class{brief}: documentation in Dutch
only) bundles.  While these are probably good (since the bundles
themselves inspire trust) they've not been specifically recommended by
any users.
\begin{ctanrefs}
\item[akletter.cls]\CTANref{akletter}
\item[brief.cls]Distributed as part of \CTANref{ntgclass}
\item[dinbrief.cls]\CTANref{dinbrief}
\item[newlfm.cls]\CTANref{newlfm}
\item[scrlttr2.cls]Distributed as part of \CTANref{koma-script}
\end{ctanrefs}

\Question[Q-extsizes]{Other ``document font'' sizes?}

The \LaTeX{} standard classes have a concept of a (base) ``document
font'' size; this size is the basis on which other font sizes (those
from \cs|tiny| to \cs|Huge|) are determined.  The classes are designed
on the assumption that they won't be used with sizes other than the
set that \LaTeX{} offers by default (10--12pt), but people regularly
find they need other sizes.  The proper response to such a requirement
is to produce a new design for the document, but many people don't
fancy doing that.

Pragmatists, therefore, will tend to go for the classes in the
\Package{extsizes} bundle.  This bundle offers
``extended'' versions of the article, report, book and letter classes,
at sizes of 8, 9, 14, 17 and 20pt as well as the standard 10--12pt.
Since little has been done to these classes other than to adjust font
sizes and things directly related to them, they won't be optimal~---
but they're certainly practical.
\begin{ctanrefs}
\item[extsizes bundle]\CTANref{extsizes}
\end{ctanrefs}

\subsection{Document structure}

\Question[Q-titlsty]{The style of document titles}

% Limited resources in the titlepage option/environment in the standard
% styles, inflexibility of \cs|maketitle|\dots{}  non-standard things in
% the title (such as logo images, etc.)

The \Package{titling} package provides a number of facilities that
permit manipulation of the appearance of a \cs|maketitle| command, the
\cs|thanks| commands within it, and so on.  The package also defines a
\environment{titlingpage} environment, that offers something in between the
standard classes' |titlepage| option and the \environment{titlepage}
environment, and is itself somewhat configurable.
\begin{ctanrefs}
\item[titling.sty]\CTANref{titling}
\end{ctanrefs}

\Question[Q-secthead]{The style of section headings}

Suppose that the editor of your favourite journal has specified that section
headings must be centred, in small capitals, and subsection headings ragged 
right in italic, but that you don't want to get involved in the sort of
programming described in \emph{The \LaTeX{} Companion}
\htmlignore
(\Qref{}{Q-books}; the programming itself is discussed in
\Qref[question]{}{Q-atsigns}).
\endhtmlignore
\begin{htmlversion}
  (see \Qref{\TeX{}-related books}{Q-books}; the
  \Qref{programming}{Q-atsigns} itself is discussed elsewhere in this
  \acro{FAQ}).
\end{htmlversion}
The following hack will 
probably satisfy your editor. Define yourself new commands
\begin{verbatim}
  \newcommand{\ssection}[1]{%
     \section[#1]{\centering\sc #1}}
  \newcommand{\ssubsection}[1]{%
     \subsection[#1]{\raggedright\it #1}}
\end{verbatim}
and then use \cs|ssection| and \cs|ssubsection| in place of
\cs|section| and \cs|subsection|. This isn't perfect: section numbers
remain in bold, and starred forms need a separate redefinition. (Also,
in the unlikely event that you still are using the prototype
\acro{NFSS} with \LaTeXo{}, the trick won't work because font-changing
commands behave differently there.)

The package \Package{sectsty} provides an easy-to-use set of tools to
do this job, while the package \Package{titlesec} has a structured
approach based on redefinition of the sectioning and chapter commands
themselves.  \Package{Titlesec}'s approach allows it to offer far more
radical adjustment: its options provide (in effect) a toolbox for
designing your own sectioning commands' output.

The \Package{fncychap} package provides a nice collection of customised
chapter heading designs.  The \Package{anonchap} package provides a
simple means of typesetting chapter headings ``like section headings''
(i.e., without the ``Chapter'' part of the heading); the
\Package{tocbibind} package provides the same commands, in pursuit of
another end.  Unfortunately, \Package{fncychap} is not attuned to the
existence of front- and backmatter in \Class{book} class documents.

The documentation of \Package{fncychap} is distributed as a separate
\PS{} file.
\begin{ctanrefs}
\item[anonchap.sty]\CTANref{anonchap}
\item[fncychap.sty]\CTANref{fncychap}
\item[sectsty.sty]\CTANref{sectsty}
\item[titlesec.sty]\CTANref{titlesec}
\item[tocbibind.sty]\CTANref{tocbibind}
\end{ctanrefs}

\Question[Q-appendix]{Appendixes}

\LaTeX{} provides an exceedingly simple mechanism for appendixes: the
command \cs|appendix| switches the document from generating sections
(in \Class{article} class) or chapters (in \Class{report} or
\Class{book} classes) to producing appendixes.  Section or chapter
numbering is restarted and the representation of the counter switches
to alphabetic.  So:
\begin{quote}
\begin{verbatim}
\section{My inspiration}
...

\section{Developing the inspiration}
...

\appendix
\section{How I became inspired}
...
\end{verbatim}
\end{quote}
would be typeset (in an \Class{article} document) something like:
\begin{quote}
\textbf{1~~My inspiration}

\dots{}

\textbf{2~~Developing the inspiration}

\dots{}

\textbf{A~~How I became inspired}

\dots{}
\end{quote}
which is quite enough for many ordinary purposes.  Note that, once
you've switched to typesetting appendixes, \LaTeX{} provides you with
no way back~--- once you've had an appendix, you can no longer have an
``ordinary'' \cs|section| or \cs|chapter|.

The \Package{appendix} provides several ways of elaborating on this
simple setup.  Straightforward use of the package allows you to have a
separate heading, both in the body of the document and the table of
contents; this would be achieved by
\begin{quote}
\begin{verbatim}
\usepackage{appendix}
...
\appendix
\appendixpage
\addappheadtotoc
\end{verbatim}
\end{quote}
The \cs|appendixpage| command adds a separate title ``Appendices''
above the first appendix, and \cs|addappheadtotoc| adds a similar
title to the table of contents.  These simple modifications cover many
people's needs about appendixes.

The package also provides an \environment{appendices} environment,
which provides for fancier use.  The environment is best controlled by
package options; the above example would be achieved by
\begin{quote}
\begin{verbatim}
\usepackage[toc,page]{appendix}
...
\begin{appendices}
...
\end{appendices}
\end{verbatim}
\end{quote}
The great thing that the \environment{appendices} environment gives
you, is that once the environment ends, you can carry on with sections
or chapters as before~--- numbering isn't affected by the intervening
appendixes.

The package provides another alternative way of setting appendixes, as
inferior divisions in the document.  The \environment{subappendices}
environment allows you to put separate appendixes for a particular
section, coded as \cs|subsection|s, or for a particular chapter, coded
as \cs|section|s.  So one might write:
\begin{quote}
\begin{verbatim}
\usepackage{appendix}
...
\section{My inspiration}
...
\begin{subappendices}
\subsection{How I became inspired}
...
\end{subappendices}

\section{Developing the inspiration}
...
\end{verbatim}
\end{quote}
Which will produce output something like:
\begin{quote}
\textbf{1~~My inspiration}

\dots{}

\textbf{1.A~~How I became inspired}

\dots{}

\textbf{2~~Developing the inspiration}

\dots{}
\end{quote}

There are many other merry things one may do with the package; the
user is referred to the package documentation for further details.
\begin{ctanrefs}
\item[appendix.sty]\CTANref{appendix}
\end{ctanrefs}

\Question[Q-secindent]{Indent after section headings}

\LaTeX{} implements a style that doesn't indent the first paragraph
after a section heading.  There are coherent reasons for this, but not
everyone likes it.
The \Package{indentfirst} package
suppresses the mechanism, so that the first paragraph is
indented.
\begin{ctanrefs}
\item[indentfirst.sty]Distributed as part of \CTANref{2etools}
\end{ctanrefs}

\Question[Q-subsubsub]{How to create a \csx{subsubsubsection}}

\LaTeX{}'s set of ``sections'' stops at the level of
\cs|subsubsection|.  This reflects a design decision by Lamport~---
for, after all, who can reasonably want a section with such huge
strings of numbers in front of it?

In fact, \LaTeX{} standard classes \emph{do} define ``sectioning''
levels lower than \cs|subsubsection|, but they don't format them like
sections (they're not numbered, and the text is run-in after the
heading).  These deeply inferior section commands are \cs|paragraph|
and \cs|subparagraph|; you can (if you \emph{must}) arrange that these
two commands produce numbered headings, so that you can use them as
\cs|subsubsubsection|s and lower.

The \Package{titlesec} allows you to adjust the definitions of the
sectioning macros, and it may be used to
transform a \cs|paragraph|'s typesetting so that it looks like that
of a \cs|section|.

If you want to program the change yourself, you'll find that the
commands (\cs|section| all the way down to \cs|subparagraph|) are
defined in terms of the internal \cs|@startsection| command, which
takes 6~arguments.  Before attempting this sort of work, you are well
advised to read the \LaTeX{} sources (\File|ltsect.dtx| in the
\LaTeX{} distribution) and the source of the standard packages
(\File|classes.dtx|).
% beware line wraps (next two lines)
The \nothtml{\LaTeX{} companion (}%
\Qref{\LaTeX{} companion}{Q-books}\nothtml{)} discusses use of
\cs|@startsection| for this sort of thing.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\LaTeX{} source]\CTANref{latex}
\item[titlesec.sty]\CTANref{titlesec}
\end{ctanrefs}

\Question[Q-captsty]{The style of captions}

Changes to the style of captions may be made by redefining the commands
that produce the caption.  So, for example, \cs|fnum@figure| (which
produces the float number for figure floats) may be redefined, in a
package of your own, or between
\nothtml{\cs|makeatletter|--\cs|makeatother| (}% beware line breaks
\Qref{\cs|makeatletter|--\cs|makeatother|}{Q-atsigns}\nothtml{)}:
\begin{htmlversion}
\begin{verbatim}
  \renewcommand{\fnum@figure}{\textbf{Fig.~\thefigure}}
\end{verbatim}
\end{htmlversion}
\htmlignore
\ifpdf
\begin{verbatim}
  \renewcommand{\fnum@figure}{\textbf{Fig.~\thefigure}}
\end{verbatim}
\else
\begin{verbatim}
  \renewcommand{\fnum@figure}%
    {\textbf{Fig.~\thefigure}}
\end{verbatim}
\fi
\endhtmlignore
which will cause the number to be typeset in bold face.  (Note that
the original definition used \nothtml{\cs|figurename|~--- }%
\Qref{\cs|figurename|}{Q-fixnam}.)  More elaborate changes can be
made by patching the \cs|caption| command, but since there are
packages to do the job, such changes (which can get rather tricky)
aren't recommended for ordinary users.

The \Package{float} package provides some control of the appearance of
captions, though it's principally designed for the creation of
non-standard floats.  The \Package{caption2} and \Package{ccaption}
(note the double ``\emph{c}'') packages provide a range of different
formatting options; \Package{ccaption} is the more modern and
comprehensive, and also provides `continuation' captions and captions
that can be placed outside of float environments.

The documentation of the \Package{caption2} package is incomplete, and
the documentation of the older \Package{caption} package should be
considered along with that of the newer package.
\begin{ctanrefs}
\item[caption2.sty]\CTANref{caption} (\Package{caption2} is bundled
  with the distribution of the older package \Package{caption})
\item[ccaption.sty]\CTANref{ccaption}
\item[float.sty]\CTANref{float}
\end{ctanrefs}

\Question[Q-fancyhdr]{Alternative head- and footlines in \LaTeX{}}

The standard \LaTeX{} document classes define a small set of `page
styles' which (in effect) specify head- and footlines for your
document.  The set defined is very restricted, but \LaTeX{} is capable
of much more; people occasionally set about employing \LaTeX{}
facilities to do the job, but that's quite unnecessary~--- Piet van
Oostrum has already done the work.

The package \Package{fancyhdr} provides
simple mechanisms for defining pretty much every head- or footline
variation you could want; the directory also contains some (rather
good) documentation and one or two smaller packages.  \Package{Fancyhdr}
also deals with the tedious behaviour of the standard styles with
\htmlignore
  initial pages (\Qref{}{Q-ps@empty}),
\endhtmlignore
\begin{htmlversion}
  \Qref{initial pages}{Q-ps@empty},
\end{htmlversion}
by enabling you to define
different page styles for initial and for body pages.
\begin{ctanrefs}
\item[fancyhdr.sty]\CTANref{fancyhdr}
\end{ctanrefs}

\Question[Q-widefigs]{Wide figures in two-column documents}

Floating figures and tables ordinarily come out the same width as the
page, but in two-column documents they're restricted to the width of
the column.  This is sometimes not good enough; so there are alternative
versions of the float environments~--- in two-column documents,
|figure*| provides a floating page-wide figure (and |table*| a
page-wide table) which will do the necessary.

The ``|*|''ed float environments can only appear at the top of a page,
or on a whole page~--- |h| or |b| float placement directives are
simply ignored.

Unfortunately, page-wide equations can only be accommodated inside
float environments.  You should include them in |figure| environments,
or use the \Package{float} or \Package{ccaption}package to define a
new float type. 
\begin{ctanrefs}
\item[ccaption.sty]\CTANref{ccaption}
\item[float.sty]\CTANref{float}
\end{ctanrefs}

\Question[Q-onecolabs]{1-column abstract in 2-column document}

One often requires that the abstract of a paper should appear across
the entire page, even in a two-column paper.  The required trick is:
\begin{verbatim}
  \documentclass[twocolumn]{article}
  ...
  \begin{document}
  ... % \author, etc
  \twocolumn[
    \begin{@twocolumnfalse}
      \maketitle
      \begin{abstract}
        ...
      \end{abstract}
    \end{@twocolumnfalse}
  ]
\end{verbatim}
Unfortunately, with the above \cs|thanks| won't work in the
\cs|author| list.  If you need such specially-numbered footnotes, you
can make them like this:
\begin{verbatim}
  \title{Demonstration}
  \author{Me, You\thanks{}}
  \twocolumn[
    ... as above ...
  ]
  {
    \renewcommand{\thefootnote}%
      {\fnsymbol{footnote}}
    \footnotetext[1]{Thanks for nothing}
  }
\end{verbatim}
and so on.

As an alternative, among other facilities the \Package{abstract} package 
provides a
\cs|saythanks| command and a \environment{onecolabstract} environment
which remove the need to fiddle with the \cs|thanks| and
footnoting. They can be used like this:
\begin{verbatim}
\twocolumn[
  \maketitle             % full width title
  \begin{onecolabstract} % full width abstract
  ... text 
  \end{onecolabstract}
]
\saythanks               % typeset any \thanks
\end{verbatim}
\begin{ctanrefs}
\item[abstract.sty]\CTANref{abstract}
\end{ctanrefs}

\Question[Q-reallyblank]{Really blank pages between chapters}

\Class{Book} (by default) and \Class{report} (with |openright| class
option) ensure that each chapter starts on a right-hand (recto) page;
they do this by inserting a \cs|cleardoublepage| command between
chapters (rather than a mere \cs|clearpage|).  The empty page thus
created gets to have a normal running header, which some people don't
like.

The (excellent) \Package{fancyhdr} manual covers this issue, basically
advising the creation of a command \cs|clearemptydoublepage|:
\begin{verbatim}
\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{%
  \clearpage
  {\pagestyle{empty}\origdoublepage}%
}
\end{verbatim}
The ``obvious'' thing is then to use this command to replace
\cs|cleardoublepage| in a patched version of the |chapter| command.
(Make a package of your own containing a copy 
of the command out of the class.)  This isn't particularly difficult,
but you can instead simply subvert \cs|cleardoublepage| (which isn't
often used elsewhere):
\begin{verbatim}
\let\cleardoublepage\clearemptydoublepage
\end{verbatim}
Note: this command works because \cs|clearemptydoublepage| uses a copy
of \cs|cleardoublepage|: see
% beware line break
\Qref[question]{patching techniques}{Q-patch} for explanation.

Note that the \emph{\acro{KOMA}-Script} replacement for the \Class{book}
class (\Class{scrbook}) offers class options that control the
appearance of these empty pages, and Peter Wilson's \Class{memoir}
class has similar facilities.
\begin{ctanrefs}
\item[memoir.cls]\CTANref{memoir}
\item[scrbook.cls]Part of \CTANref{koma-script}
\end{ctanrefs}

\Question[Q-balance]{Balancing columns at the end of a document}

The \Package{twocolumn} option of the standard classes causes
\LaTeX{} to set the text of a document in two columns.  However, the last
page of the document typically ends up with columns of different
lengths~--- such columns are said to be ``unbalanced''.  Many (most?)
people don't like unbalanced columns.

The simplest solution to the problem is to use the \Package{multicol}
package in place of the \Package{twocolumn} option, as
\Package{multicol} balances the columns on the final page by default.
However, the use of \Package{multicol} does come at a cost: its
special output routine disallows the use of in-column floats, though
it does still permit full-width (e.g., \environment{figure*}
environment) floats. 

As a result, there is a constant push for a means of balancing columns
at the end of a \Package{twocolumn} document.  Of course, the job can
be done manually: \cs|pagebreak| inserted at the appropriate place on
the last page can often produce the right effect, but this seldom
appeals, and if the last page is made up of automatically-generated
text (for example, bibliography or index) inserting the command will
be difficult.

The \Package{flushend} package offers a solution to this problem.  It's a
somewhat dangerous piece of macro code, which patches one of the most
intricate parts of the \LaTeX{} kernel without deploying any of the
safeguards discussed in \Qref[question]{patching commands}{Q-patch}.
The package only changes the behaviour at end document (its
\cs|flushend| command is enabled by default), and one other command
permits adjustment of the final balance; other packages in the bundle
provide means for insertion of full width material in two-column
documents.

The \Package{balance} package also patches the output routine
(somewhat more carefully than \Package{flushend}).

The user should be aware that any of these packages are liable to
become confused in the presence of floats: if problems arise, manual
adjustment of the floats in the document is likely to be necessary.
It is this difficulty (what's required in any instance can't really be
expressed in current \LaTeX{}) that led the author of
\Package{multicol} to suppress single-column-wide floats.
\begin{ctanrefs}
\item[balance.sty]Distributed as part of \CTANref{preprint}
\item[flushend.sty]Distributed as part of \CTANref{sttools}
\item[multicol.sty]Distributed as part of \CTANref{2etools}

\end{ctanrefs}

\Question[Q-runheadtoobig]{My section title is too wide for the page header}

By default, \LaTeX{} sectioning commands make the chapter or section
title available for use by page headers and the like.  Page headers
operate in a rather constrained area, and it's common for titles too
be too big to fit: the \LaTeX{} sectioning commands therefore take an
optional argument:
\begin{verbatim}
\section[short title]{full title}
\end{verbatim}
If the \meta{short title} is present, it is used both for the table of
contents and for the page heading: the usual answer to people who
complain about the size of the title that's gone in to the running
head, is to suggest that they the optional argument.

However, using the same text for the table of contents as for the
running head may also be unsatisfactory: if your chapter titles are
seriously long (like those of a Victorian novel), a valid and rational
scheme is to have a shortened table of contents entry, and a really
terse entry in the running head.

In fact, the sectioning commands use `mark' commands to pass
information to the page headers.  For example, \cs|chapter| uses
\cs|chaptermark|, \cs|section| uses \cs|sectionmark|, and so on.  With
this knowledge, one can achieve a three-layer structure for chapters:
\begin{verbatim}
\chapter[middling version]{verbose version}
\chaptermark{terse version}
\end{verbatim}
which should supply the needs of every taste.

Chapters, however, have it easy: hardly any book design puts a page
header on a chapter start page.  In the case of sections, one has
typically to take account of the nature of the \cs|*mark| commands:
the thing that goes in the heading is the first mark on the page (or,
failing any mark, the last mark on any previous page).  As a result
the recipe for sections is more tiresome:
\begin{verbatim}
\section[middling version]{verbose version%
                \sectionmark{terse version}}
\sectionmark{terse version}
\end{verbatim}
(the first \cs|sectionmark| deals with the header of the page the
\cs|section| command falls on, and the second deal with subsequent
pages; note that here, you need the optional argument to \cs|section|,
even if ``\emph{middling version}'' is in fact the same text as
``\emph{long version''}.)

A similar arrangement is necessary even for chapters if the class
you're using is odd enough that it puts a page header on a chapter's
opening page.

Note that the \Package{titlesec} package manages the running heads in
a completely different fashion; users of that package should refer to
the documentation.
\begin{ctanrefs}
\item[titlesec.sty]\CTANref{titlesec}
\end{ctanrefs}

\nothtml{\begingroup\boldmath}
\Question[Q-nofm]{Page numbering ``\meta{n} of \meta{m}''}
\nothtml{\afterquestion}

Finding the page number of the last page of a document, from within
the document, is somewhat tricky.  The \Package{lastpage} package is
therefore supplied to make life easy for us all; it defines a label
|LastPage| whose number is \emph{right} (after sufficiently many
passes through \LaTeX{}, of course).

The documentation of the \Package{fancyhdr} package spells out exactly
how one might actually use this information to produce page numbering
as suggested in the question.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}fancyhdr documentation]\CTANref{fancyhdr}
\item[lastpage.sty]\CTANref{lastpage}
\end{ctanrefs}

\Question[Q-pagebychap]{Page numbering by chapter}

When I was a young man, a common arrangement for loose bound technical
manuals is to number pages by chapter.  (It's quite a good scheme, in
those situations: even if your corrections add a whole page to the
chapter, the most you have to redistribute is that chapter.)

The problem, at first sight, seems pretty much the same as that in
another answer on \nothtml{running numbers within a chapter (}%
% beware line break
\Qref[question]{running numbers within a chapter}{Q-running-nos}\nothtml{)},
and the basic technique is indeed pretty similar.

However, tidying-up loose ends, making sure the page number gets reset
to the correct value at the start of each chapter, and so on, is
slightly more challenging.  This is why the \Package{chappg} package
was written: it does the obvious things, and more.

Users have been known to ask for running page numbers within a
section, but this really doesn't make sense: you need to run page
numbers within document objects that always start on a fresh page.

Documentation of \Package{chappg} is to be found in the package file.
\begin{ctanrefs}
\item[chappg.sty]\CTANref{chappg}
\end{ctanrefs}

\subsection{Page layout}

\Question[Q-papersize]{Printer paper sizes}

Paper sizes can be a pain: they're a forgotten backwater, because
there's no \acro{DVI} command to specify the paper size of the
document.  One usually finds American ``letter'' paper size being
used, by default, in macro packages (such as \Class{plain} and
\LaTeX{}); but distributions provide configuration files for
\acro{DVI} drivers (and since most distributions originate in Europe,
the drivers usually default to \acro{ISO} ``A4'' paper size).

This is (of course) pretty unsatisfactory.  Users may change the paper
size their document is designed for, pretty easily (and once off), but
they have to ensure that every run of \ProgName{xdvi},
\ProgName{dvips}, or whatever, is given the correct override for using
anything non-`standard'.

Of course, the default paper size for \acro{DVI} drivers may be
changed by a distribution management command, but this still doesn't
provide for people using the ``wrong'' sort of paper for some reason.

An interestingly different issue arises for users of \PDFTeX{}~--- the
\acro{PDF} format \emph{does} have the means of expressing paper size,
but much of the core software predates \PDFTeX{}, so not even
\PDFLaTeX{} sets the correct values into \cs|pdfpagewidth| and
\cs|pdfpageheight|.

The \acro{DVI} drivers \ProgName{dvips} and \ProgName{dvipdfm} define
\cs|special| commands for the document to specify its own paper size;
so in those cases, as in the case of \PDFTeX{} and V\TeX{}, the paper
size can be programmed by the document.  Users who wish to, may of
course consult the manuals of the various programs to write the
necessary code.

The \Package{geometry} package (whose main business is defining
typeset page areas), also takes notice of the paper size the document
is going to print to, and can issue the commands necessary to ensure
the correct size is used.  If \Package{geometry} is used when a
document is being processed by either \PDFLaTeX{} or V\TeX{}, it will
set the neccesary dimensions as a matter of course.  If the document
is being processed by \LaTeX{} on a \TeX{} or \eTeX{} engine, there
are two package options (\pkgoption{dvipdfm} and \pkgoption{dvips})
which instruct \Package{geometry} which \cs|special| commands to use.
(Note that the options are ignored if you are using either \PDFLaTeX{}
or V\TeX{}.)

So, the resolution of the problem is to add
\begin{verbatim}
  \usepackage[dvixxx,...]{geometry}
\end{verbatim}
(where \pkgoption{dvixxx} is your current favourite \acro{DVI}
driver), and the document will run correctly with any of
\LaTeX{} (whether or not run on V\TeX{}) or \PDFLaTeX{}.
\begin{ctanrefs}
\item[geometry.sty]\CTANref{geometry}
\end{ctanrefs}

\Question[Q-changemargin]{Changing the margins in \LaTeX{}}

Changing the size of the body of a \LaTeX{} document's text is a
surprisingly difficult task:
the best advice to the beginner is ``don't do it''.  There are
interactions between fundamental \TeX{} constraints, constraints
related to the design of \LaTeX{}, and good typesetting and design
practice, that mean that any change must be very carefully considered,
both to ensure that it ``works'' and to ensure that the result is pleasing
to the eye.

Lamport's warning in his section on 
`Customizing the Style' needs to be taken seriously.  One-inch 
margins on A4 paper are fine for 10- or 12-pitch typewriters, but not 
for 10pt (or even 11pt or 12pt) type because readers find such wide,
dense, lines
difficult to read: there should ideally be
no more than 75~characters per line (though the constraints change for
two-column text).
     
\LaTeX{}'s controls allow you to change the distance from the edges
of a page to the left and top edges of your typeset text, and the
width and height of the text.
Changing the last two requires 
more skill than you might expect: the height should bear a certain 
relationship to \cs|baselineskip|, and the width should be constrained
as mentioned above.

The controls are expressed as a set of page parameters; they are
somewhat complex, and it is easy to get their interrelationships wrong when
redefining the page layout.  The \Package{layout} package defines a
\cs|layout| command which draws a diagram of your existing page
layout, with the dimensions (but not their interrelationships) shown.
This \acro{FAQ} recommends that you use a package to establish
consistent settings of the parameters: the
interrelationships are taken care of in the established packages,
without you needing to think about them.

The `ultimate' tool for adjusting the dimensions and position of the
printed material on the page is the \Package{geometry} package; a very
wide range of adjustments of the layout may be relatively straightforwardly
programmed, and documentation in the 
\nothtml{|.dtx| file (}\Qref{|.dtx| file}{Q-dtx}\nothtml{)}
is good and comprehensive.

Somewhat simpler to use is the \Package{vmargin} package, which has a
canned set of paper sizes (a superset of that provided in \LaTeXe{}),
provision for custom paper, margin adjustments and provision for
two-sided printing.

If you're still eager to ``do it yourself'', start by familiarising
yourself with  \LaTeX{}'s page layout
parameters.  For example, see section~C.5.3 of the
\LaTeX{} manual (pp.~181--182), or corresponding sections in many of
the other good \LaTeX{} manuals
% beware line break
(see \Qref[question]{\LaTeX{} books}{Q-books}).
The parameters \cs|oddsidemargin|
and \cs|evensidemargin| are so-called because it is conventionally
taken that odd-numbered pages appear on the right-hand side of a
two-page spread (`recto') and even-numbered pages on the left-hand
side (`verso').  Both parameters refer to the \emph{left-hand} margin;
the right-hand margin is specified by implication, from the size of
\cs|textwidth|.
The origin in \acro{DVI} coordinates is one inch
from the top of the paper and one inch from the left side; positive
horizontal measurements extend
right across the page, and positive vertical measurements extend down
the page. Thus, for margins closer to the left and top edges of the
page than 1 inch, the corresponding parameters, \emph{i.e}.,
\cs|evensidemargin|, \cs|oddsidemargin|, \cs|topmargin|, can be set to
negative values.

Another surprise is that
you cannot change the width or height of the text within the
document, simply by
modifying the text size parameters. The simple rule is that the parameters
should only be changed in the preamble of the document, \emph{i.e}., before
the \cs|begin{document}| statement.  To adjust text width within a
document we define an environment:
\begin{verbatim}
\newenvironment{changemargin}[2]{%
 \begin{list}{}{%
  \setlength{\topsep}{0pt}%
  \setlength{\leftmargin}{#1}%
  \setlength{\rightmargin}{#2}%
  \setlength{\listparindent}{\parindent}%
  \setlength{\itemindent}{\parindent}%
  \setlength{\parsep}{\parskip}%
 }%
\item[]}{\end{list}}
\end{verbatim}
This environment takes two arguments, and will indent the left
and right margins, respectively, by the parameters' values. Negative values
will cause the margins to be narrowed, so
|\begin{changemargin}{-1cm}{-1cm}| narrows the left and right margins
by 1cm.

The \Package{chngpage} package provides ready-built commands to do the
above; it includes provision for changing the shifts applied to your
text according to whether you're on an odd or an even page of a
two-sided document.  The package's documentation (in the file
itself) suggests a strategy for changing text dimensions
between pages~--- as mentioned above, changing the text dimensions
within the body of a page may lead to unpredictable results.
\begin{ctanrefs}
\item[chngpage.sty]\CTANref{chngpage}
\item[geometry.sty]\CTANref{geometry}
\item[layout.sty]Distributed as part of \CTANref{2etools}
\item[vmargin.sty]\CTANref{vmargin}
\end{ctanrefs}

\Question[Q-nopageno]{How to get rid of page numbers}

The package \Package{nopageno} will suppress page numbers in a whole
document.

To suppress page numbers from a single page, use
\cmdinvoke{thispagestyle}{empty} somewhere within the text of the
page.  (Note that \cs|maketitle| and \cs|chapter| both use
\cs|thispagestyle| internally, so you need to call it after you've called
them.)

To suppress page numbers from a sequence of pages, you may use
\cmdinvoke{pagestyle}{empty} at the start of the sequence, and restore
the original page style at the end.
Unfortunately, you still have to use \cs|thispagestyle| after any
\cs|maketitle| or \cs|chapter| command.

An alternative is to use the rather delightful
\cmdinvoke{pagenumbering}{gobble}; this has the simple effect that any
attempt to print a page number produces nothing, so there's no issue
about preventing any part of \LaTeX{} from printing the number.
However, the
\cs|pagenumbering| command does have the side effect that it resets the page
number (to 1), which may be undesirable.
\begin{ctanrefs}
\item[nopageno]\CTANref{nopageno}
\end{ctanrefs}

\Question[Q-ps@empty]{\cs|pagestyle{empty}| on first page in \LaTeX{}}

If you use \cs|pagestyle{empty}|, but the first page is numbered anyway,
you are probably using the \cs|maketitle| command too. The behaviour
is not a bug but a feature! The standard \LaTeX{} styles are written so that
initial pages (pages containing a \cs|maketitle|, \cs|part|, or
\cs|chapter|) have a different page style from the rest of the document; 
to achieve this, the commands internally issue
\cs|thispagestyle{plain}|. This is usually not acceptable behaviour if
the surrounding page style is `empty'.

Possible workarounds include: 
\begin{itemize}
\item Put \cs|thispagestyle{empty}| immediately after the \cs|maketitle|
  command, with no blank line between them.
\item Use the \Package{fancyhdr} package, which allows you to customise the
  style for initial pages independently of that for body pages.
\item Use the \Package{nopageno} package, which suppresses all page
  numbers by affecting the behaviour of page style commands.
\end{itemize}
\begin{ctanrefs}
\item[fancyhdr.sty]\CTANref{fancyhdr}
\item[nopageno.sty]\CTANref{nopageno}
\end{ctanrefs}

\Question[Q-crop]{How to create crop marks}

If you're printing something that's eventually to be reproduced in
significant quantities, and bound, it's conventional to print on paper
larger than your target product, and to place ``crop marks'' outside
the printed area.  These crop marks are available to the production
house, for lining up reproduction and trimming machines.

You can save yourself the (considerable) trouble of programming these
marks for yourself by using the package \Package{crop}, which has
facilities to satisfy any conceivable production house.
\begin{ctanrefs}
\item[crop.sty]\CTANref{crop}
\end{ctanrefs}

\Question[Q-watermark]{`Watermarks' on every page}

It's often useful to place some text (such as `DRAFT') in the
background of every page of a document.  For \LaTeX{} users, this can
be achieved with the \Package{draftcopy} package.  This can deal with
many types of \acro{DVI} processors (in the same way that the graphics
package does) and knows translations for the word `DRAFT' into a wide
range of languages (though you can choose your own word, too).

More elaborate watermarks may be achieved using the \Package{eso-pic}
package, which in turn uses the package \Package{everyshi}, part of
Martin Schr\"oder's \Package{ms} bundle.  \Package{Eso-pic} attaches a
\environment{picture} environment to every page as it is shipped out;
you can put things into that environment.  The package provides
commands for placing things at certain useful points (like ``text
upper left'' or ``text centre'') in the picture, but you're at liberty
to do what you like.
\begin{ctanrefs}
\item[draftcopy.sty]\CTANref{draftcopy}
\item[eso-pic.sty]\CTANref{eso-pic}
\item[everyshi.sty]Distributed as part of \CTANref{ms}
\end{ctanrefs}

\Question[Q-landscape]{Typesetting things in landscape orientation}

It's often necessary to typeset part of a document in landscape
orientation; to achieve this, one needs not only to change the page
dimensions, but also to instruct the output device to print the
strange page differently.

There are two ``ordinary'' mechanisms for doing two slight variations
of landscape typesetting:
\begin{itemize}
\item If you have a single floating object that is wider than it is
  deep, and will only fit on the page in landscape orientation, use
  the \Package{rotating} package; this defines |sidewaysfigure| and
  \environment{sidewaystable} environments which create floats that
  occupy a whole page.
\item If you have a long sequence of things that need to be typeset in
  landscape (perhaps a code listing, a wide \environment{tabbing}
  environment, or a huge table typeset using \Package{longtable} or
  \Package{supertabular}), use the \Package{lscape} package (or
  \Package{pdflscape} if you're generating \acro{PDF} output).  This
  defines an environment \environment{landscape}, which clears the current page
  and restarts typesetting in landscape orientation (and clears the
  page at the end of the environment before returning to portrait
  orientation).
\end{itemize}
No currently available package makes direct provision for typesetting
in both portrait and landscape orientation on the same page (it's not
the sort of thing that \TeX{} is well set-up to do).  If such
behaviour was an absolute necessity, one would use the techniques
described in
% beware line-wrap
\Qref[question]{"flowing text around figures"}{Q-textflow}, and would
rotate the landscape portion using the rotation facilities of the
\Package{graphics} package.  (Returning from landscape to portrait
orientation would be somewhat easier: the portrait part of the page
would be a bottom float at the end of the landscape section, with its
content rotated.)

To set an entire document in landscape orientation, one might use
\Package{lscape} around the whole document.  A better option is the
|landscape| option of the \Package{geometry} package; if you also give
it |dvips| or |pdftex| option, \Package{geometry} also emits the
rotation instructions to cause the output to be properly oriented.

A word of warning: most current \TeX{} previewers do not honour
rotation requests in |.dvi| files (the exceptions are the
\begin{htmlversion}
  (\Qref{commercial}{Q-commercial}) \YandY{} previewer
  \ProgName{dviwindo},
\end{htmlversion}
\htmlignore
  (commercial) \YandY{} previewer \ProgName{dviwindo}
  (\Qref{}{Q-commercial}),
\endhtmlignore
and the fp\TeX{} previewer Win\acro{DVI}).  If your previewer is not
capable of rotation, your best bet is to convert your output to
\PS{} or to \acro{PDF}, and to view these `final' forms with an
appropriate viewer.
\begin{ctanrefs}
\item[geometry.sty]\CTANref{geometry}
\item[graphics.sty]Distributed as part of \CTANref{graphics}
\item[longtable.sty]Distributed as part of \CTANref{2etools}
\item[lscape.sty]Distributed as part of \CTANref{graphics}
\item[pdflscape.sty]Distributed with Heiko Oberdiek's packages
  \CTANref{oberdiek}
\item[rotating.sty]\CTANref{rotating}
\item[supertabular.sty]\CTANref{supertabular}
\end{ctanrefs}

\Question[Q-abspos]{Putting things at fixed positions on the page}

\TeX{}'s model of the world is (broadly speaking) that the author
writes text, and \TeX{} and its macros decide how it all fits on the
page.  This is not good news for the author who has, from whatever
source, a requirement that certain things go in exactly the right
place on the page.

There \emph{are} places on the page, from which things may be hung,
and two \LaTeX{} packages allow you position things relative to such
points, thus providing a means of absolute positioning.

The \Package{textpos} package aids the construction of pages from
``blobs'', dotted around over the page (as in a poster); you give it
the location, and it places your typeset box accordingly.

The \Package{eso-pic} defines a ``shipout picture'' that covers the
page.  The user may add \environment{picture}-mode commands to this
picture, which of course can include box placements as well as the
other rather stilted commands of \environment{picture}-mode.
(\Package{Eso-pic} requires the services of \Package{everyshi}, which
must therefore also be available.)
%
% Fortunately, in the \LaTeX{} world at least, there \emph{is} a fixed
% point on every page, to whit the page header.  The package
% \Package{textpos} latches bits of typesetting to locations you
% specify, by fixing them to the page header, and thereby solves the
% problem.
\begin{ctanrefs}
\item[eso-pic.sty]\CTANref{eso-pic}
\item[everyshi.sty]Distributed as part of \CTANref{ms}
\item[textpos.sty]\CTANref{textpos}
\end{ctanrefs}

\Question[Q-nopagebrk]{Preventing page breaks between lines}

One commonly requires that a block of typeset material be kept on the
same page; it turns out to be surprisingly tricky to arrange this.

\LaTeX{} provides a \environment{samepage} environment which claims it
does this sort of thing for you.  It proceeds by setting infinite
penalties for all sorts of page-break situations; but in many
situations where you want to prevent a page break,
\environment{samepage} doesn't help.  If you're trying to keep running
text together, you need to end the paragraph inside the environment
(see \Qref[question]{preserving paragraph parameters}{Q-paraparam}).
Also, if the things you are trying to keep together insert their own
pagebreak hints, \environment{samepage} has no power over them: a good
exaple is list items~--- they suggest page breaks between them.  Even
if \environment{samepage} \emph{does} work, it's likely to leave stuff
jutting out at the bottom of the page.

A convenient trick is to set all the relevant stuff in a \cs|parbox|
(or a \environment{minipage} if it contains things like verbatim text
that may not be in the argument of a \cs|parbox|).  The resulting box
certainly \emph{won't} break between pages, but that's not to say that
it will actually do what you want it to do: again, the box may be left
jutting out at the bottom of the page.

Why do neither of these obvious things work?  Because \TeX{} can't
really distinguish between infinitely awful things.
\environment{Samepage} will make any possible break point ``infinitely
bad'' and boxes don't even offer the option of breaks, but if the
alternative is the leave an infinitely bad few centimetres of blank
paper at the bottom of the page, \TeX{} will take the line of least
resistance and do nothing.

This problem still arises even if you have \cs|raggedbottom| in
effect: \TeX{} doesn't notice the value of \emph{that} until it starts
actually shipping a page out.  One approach is to set:
\begin{verbatim}
  \raggedbottom
  \addtolength{\topskip}{0pt plus 10pt}
\end{verbatim}
The |10pt| offers a hint to the output routine that the column is
stretchable; this will cause \TeX{} to be more tolerant of the need to
stretch while building the page.  If you're doing this as a temporary
measure, cancel the change to \cs|topskip| by:
\begin{verbatim}
  \addtolength{\topskip}{0pt plus-10pt}
\end{verbatim}
as well as resetting \cs|flushbottom|.
(Note that the |10pt| never actually shows up, because it is
overwhelmed when the page is shipped out by the stretchability
introduced by \cs|raggedbottom|; however, it could well have an effect if
\cs|flushbottom| was in effect.)

An alternative (which derives from a suggestion by Knuth in the
\TeX{}book) is the package \Package{needspace}, which defines a
command \cs|needspace| whose argument tells it what space is needed.
If the space isn't available, the current page is cleared, and the
matter that needs to be kept together will be inserted on the new
page.  For example, if 4~lines of text need to be kept together, the
sequemce
\begin{verbatim}
  \par
  \needspace{4\baselineskip}
  % the stuff that must stay together
  <text generating lines 1-4>
  % now stuff we don't mind about
\end{verbatim}

Yet another trick by Knuth is useful if you have a sequence of small
blocks of text that need, individually, to be kept on their own page.
Insert the command \cs|filbreak| before each small block, and the
effect is achieved.  The technique can be used in the case of
sequences of \LaTeX{}-style sections, by incorporating \cs|filbreak|
into the definition of a command (as in % beware line break
\Qref[question]{patching commands}{Q-patch}).  A simple and effective
patch would be:
\begin{verbatim}
  \let\oldsubsubsection=\subsubsection
  \renewcommand{\subsubsection}{%
    \filbreak
    \oldsubsubsection
  }
\end{verbatim}
While the trick works for consecutive sequences of blocks, it's
slightly tricky to get out of such sequences unless the sequence is
interrupted by a forced page break (such as \cs|clearpage|, which may
be introduced by a \cs|chapter| command, or the end of the document).
If the sequence is not interrupted, the last block is likely to be
forced onto a new page, regardless of whether it actually needs it.

If one is willing to accept that not everything can be accomplished
totally automatically, the way to go is to typeset the document and to
check for things that have the potential to give trouble.  In such a
scenario (which has Knuth's authority behind it, if one is to believe
the rather few words he says on the subject in the \TeX{}book) one can
decide, case by case, how to deal with problems at the last
proof-reading stage.  The alternatives are to insert \cs|clearpage|
commands as necessary, or to use \cs|enlargethispage|.  Supposing you
have a line or two that stray: issue the command
\cmdinvoke{enlargethispage}{2\cs|baselineskip|} and two lines are
added to the page you're typesetting.  It depends on the document
whether this looks impossibly awful or entirely acceptable, but the
command remains a useful item in the armoury.
\begin{ctanrefs}
\item[needspace.sty]\CTANref{needspace}
\end{ctanrefs}

\Question[Q-parallel]{Parallel setting of text}

It's commonly necessary to present text in two languages `together' on
a page, or on opposite pages of a two-page spread.  For this to be
satisfactory, one usually needs some sort of alignment between the two
texts.

The \Package{parallel} package satisfies the need, permitting
typesetting in two columns (not necessarily of the same width) on one
page, or on the two opposing pages of a two-page spread.
\begin{ctanrefs}
\item[parallel.sty]\CTANref{parallel}
\end{ctanrefs}

\Question[Q-epigraph]{Typesetting epigraphs}

Epigraphs are those neat quotations that authors put at the start of
chapters (or even at the end of chapters: Knuth puts things at the
ends of chapters of the \TeX{}book).

Typesetting them is a bit of a fiddle, but not impossible to do for
yourself.  However, the \Package{epigraph} package will do the job for
you, even in situations where it's particularly nasty to get right.

The package defines an \cs|epigraph| command, for creating a single
epigraph (as at the top of a chapter):
\begin{quote}
\begin{verbatim}
\chapter{The Social Life of Rabbits}
\epigraph{Oh!  My ears and whiskers!}%
         {Lewis Carroll}
\end{verbatim}
\end{quote}
and an epigraphs environment, for entering more than one epigraph
consecutively, in a sort of list introduced by \cs|qitem| commands:
\begin{quote}
\begin{verbatim}
\begin{epigraphs}
\qitem{What I tell you three times is true}%
      {Lewis Carroll}
\qitem{Oh listen do, I'm telling you!}%
      {A.A. Milne}
\end{epigraphs}
\end{verbatim}
\end{quote}
The \cs|epigraphhead| command enables you to place your epigraph
\emph{above} a chapter header:
\begin{quote}
\begin{verbatim}
\setlength{\unitlength}{1pt}
...
\chapter{The Social Life of Rabbits}
\epigraphhead[<distance>]{%
  \epigraph{Oh!  My ears and whiskers!}%
           {Lewis Carroll}%
}
\end{verbatim}
\end{quote}
The \meta{distance} says how far above the chapter heading the
epigraph is to go; it's expressed in terms of the \cs|unitlength|
that's used in the \environment{picture} environment; the package's
author recommends \texttt{70pt}.

The package also offers various tricks for adjusting the layout of
chapter header (necessary if you've found a hugely long quotation for
an \cs|epigraphhead|), for patching the bibliography, for patching
\cs|part| pages, and so on.  (Some of these suggested patches lead you
through writing your own package\dots{})
\begin{ctanrefs}
\item[epigraph.sty]\CTANref{epigraph}
\end{ctanrefs}

\subsection{Spacing of characters and lines}

\Question[Q-linespace]{Double-spaced documents in \LaTeX{}}

A quick and easy way of getting inter-line space
for copy-editing is to change \cs|baselinestretch|~---
\cmdinvoke{linestretch}{1.2} (or, equivalently
\cmdinvoke{renewcommand}{\csx{baselinestretch}}{1.2}) may be adequate.
Note that \csx{baselinestretch} changes don't take effect until you
select a new font, so make the change in the preamble before any font
is selected.  Don't try changing \csx{baselineskip}: its value is reset
at any size-changing command so that results will be inconsistent.

For preference (and certainly for a production document, such as a
dissertation or an article submission), use a line-spacing package.
The only one currently supported is \Package{setspace} (do \emph{not}
be tempted by \Package{doublespace}~--- its performance under current
\LaTeX{} is at best problematical).  \Package{Setspace} switches off
double-spacing at places where even the most die-hard official would
doubt its utility (footnotes, figure captions, and so on); it's very
difficult to do this consistently if you're manipulating
\csx{baselinestretch} yourself.

Of course, the real solution (other than for private copy editing) is
\emph{not} to use double-spacing at all.  Universities, in particular,
have no excuse for specifying double-spacing in submitted
dissertations: \LaTeX{} is a typesetting system, not a
typewriter-substitute, and can (properly used) make single-spaced text
even more easily readable than double-spaced typewritten text.  If you
have any influence on your university's system (for example, through
your dissertation supervisor), it may be worth attempting to get the
rules changed (at least to permit a ``well-designed book'' format).

Double-spaced submissions are also commonly required when submitting
papers to conferences or journals.  Fortunately (judging by the
questions from users in this author's department), this demand is
becoming less common.

Documentation of \Package{setspace} appears as \TeX{} comments in the
package file itself.
\begin{ctanrefs}
\item[setspace.sty]\CTANref{setspace}
\end{ctanrefs}

\Question[Q-letterspace]{Changing the space between letters}

A common technique in advertising copy (and other text whose actual
content need not actually be \emph{read}) is to alter the space
between the letters (otherwise known as the tracking).  As a general
rule, this is a very bad idea: it detracts from legibility, which is
contrary to the principles of typesetting (any respectable font you
might be using should already have optimum tracking built into it).

The great type designer, Eric Gill, is credited with saying ``he who
would letterspace lower-case text, would steal sheep''.  (The
attribution is probably apocryphal: others are also credited with the
remark.  Stealing sheep was, in the 19th century, a capital offence in
Britain.)  As the remark suggests, though, letterspacing of upper-case
text is less awful a crime; the technique used also to be used for
emphasis of text set in Fraktur (or similar) fonts.

Straightforward macros (usable, in principle, with any \TeX{} macro
package) may be found in \Package{letterspacing} (which is the name of
the |.tex| file; it also appears as the \Package{letterspace} package
in some distributions).

%%% the package has a serious bug in it, so suppress mention pro tem
%The \Package{tracking} package has similar facilities.

A more comprehensive solution is to be found in the \Package{soul}
package (which is optimised for use with \LaTeX{}, but also works with
Plain \TeX{}).  Soul also permits hyphenation of letterspaced text;
Gill's view of such an activity is not (even apocryphally) recorded.
(Spacing-out forms part of the name of \Package{soul}; the other half
is described in \Qref[question]{another question}{Q-underline}.)
\begin{ctanrefs}
\item[letterspacing.tex]\CTANref{letterspacing}
\item[soul.sty]\CTANref{soul}
%\item[tracking.sty]\CTANref{tracking}
\end{ctanrefs}

\Question[Q-ragright]{Setting text ragged right}

The trick with typesetting ragged right is to be sure you've told the
\TeX{} engine 
``make this paragraph ragged, but never \emph{too} ragged''.  The
\LaTeX{} \cs|raggedright| command (and the corresponding
\environment{flushleft} environment) has a tendency to miss the
``never'' part, and will often create ridiculously short lines, for
some minor benefit later in the paragraph.  The Plain \TeX{} version
of the command doesn't suffer this failing, but is rather
conservative: it is loath to create too large a gap at the end of the
line, but in some circumstances (such as where
% beware line break
\nothtml{hyphenation is suppressed }%
\Qref{hyphenation is suppressed}{Q-hyphoff}) painfully large gaps may
sometimes be required.

Martin Schr\"oder's \Package{ragged2e} package offers the best of both
worlds: it provides raggedness which is built on the Plain \TeX{}
model, but which is easily configurable.  It defines easily-remembered
command (e.g., \cs|RaggedRight|) and environment (e.g.,
\environment{FlushLeft}) names that are simply capitalised
transformations of the \LaTeX{} kernel originals.  The documentation
discusses the issues and explains the signficance of the various
parameters of \Package{ragged2e}'s operation.
\begin{ctanrefs}
\item[ragged2e.sty]Distributed as part of \CTANref{ms}
\end{ctanrefs}

\Question[Q-flushboth]{Cancelling \csx{ragged} commands}

\LaTeX{} provides commands \cs|raggedright| and \cs|raggedleft|, but
none to cancel their effect.  The \cs|centering| command is
implemented in the same way as the \cs|ragged*| commands, and suffers
in the same way.

The following code (to be inserted in a package of your own, or as
\nothtml{internal \LaTeX{} code~---}% beware line break
\Qref{internal \LaTeX{} code}{Q-atsigns}) defines a command that
restores flush justification at both margins:
\begin{verbatim}
\def\flushboth{%
  \let\\\@normalcr
  \@rightskip\z@skip \rightskip\@rightskip
  \leftskip\z@skip
  \parindent 1.5em\relax}
\end{verbatim}
There's a problem with the setting of \cs|parindent| in the code: it's
necessary because both the \cs|ragged| commands set \cs|parindent| to
zero, but the setting isn't a constant of nature: documents using a
standard \LaTeX{} class with |twocolumn| option will have |1.0em| by
default, and there's no knowing what you (or some other class) will
have done.

If you are using Martin Schr\"oder's \Package{ragged2e} package, it is
worth updating to the latest release (January 2003), which has a
\cs|justifying| command to match its % beware 2 line breaks
\nothtml{ versions of the \LaTeX{} `ragged' commands (}%
\Qref{versions of the \LaTeX{} `ragged' commands}{Q-ragright}\nothtml{)}.
The package also provides a \environment{justify} environment, which
permits areas of justified text in a larger area which is ragged.
\begin{ctanrefs}
\item[ragged2e.sty]Distributed as part of \CTANref{ms}
\end{ctanrefs}
% this package hasn't materialised, for some reason i don't now
% remember...
%% Donald Arseneau's \Package{flushboth} package provides this code, and
%% preserves a sensible value for \cs|parindent| (at begin document).
%% This still doesn't protect it against any change you might make to
%% \cs|parindent| within the body of your document.
%% \begin{ctanrefs}
%% \item[flushboth.sty]\CTANref{flushboth}
%% \end{ctanrefs}

\subsection{Typesetting specialities}

\Question[Q-verbfile]{Including a file verbatim in \LaTeX{}}

A good way is to use Rainer Sch\"opf's \Package{verbatim} package,
which provides a command |\verbatiminput| that takes a file name
as argument:
\begin{quote}
\begin{verbatim}
\usepackage{verbatim}
...
\verbatiminput{verb.txt}
\end{verbatim}
\end{quote}
Another way is to use the \environment{alltt} environment, which requires
the \Package{alltt} package.  The environment interprets its contents
`mostly' verbatim, but executes any \AllTeX{} commands it finds:
\begin{quote}
\begin{verbatim}
\usepackage{alltt}
...
\begin{alltt}
\input{verb.txt}
\end{alltt}
\end{verbatim}
\end{quote}
of course, this is little use for inputting \AllTeX{} source code\dots{}

The \Package{moreverb} package extends the \Package{verbatim} package,
providing a \environment{listing} environment and a \cs|listinginput|
command, which line-number the text of the file.  The package also has
a \cs|verbatimtabinput| command, that honours \acro{TAB} characters in
the input (the package's \environment{listing} environment and the
\cs|listinginput| command also both honour \acro{TAB}).

The \Package{sverb} package provides verbatim input (without recourse
to the facilities of the \Package{verbatim} package):
\begin{quote}
\begin{verbatim}
\usepackage{sverb}
...
\verbinput{verb.txt}
\end{verbatim}
\end{quote}

The \Package{fancyvrb} package offers configurable
implementations of everything \Package{verbatim}, \Package{sverb} and \Package{moreverb}
have, and more besides.  It is nowadays the package of choice for the
discerning typesetter of verbatim text, but its wealth of facilities
makes it a complex beast and study of the documentation is strongly
advised.
\begin{ctanrefs}
\item[alltt.sty]Part of the \LaTeX{} distribution.
\item[fancyvrb.sty]\CTANref{fancyvrb}
\item[moreverb.sty]\CTANref{moreverb}
\item[sverb.sty]Distributed as part of \CTANref{mdwtools}
\item[verbatim.sty]Distributed as part of \CTANref{2etools}
\end{ctanrefs}

\Question[Q-linenos]{Including line numbers in typeset output}

For general numbering of lines, there are two packages for use with
\LaTeX{}, \Package{lineno} (which permits labels attached to
individual lines of typeset output) and \Package{numline}.

Both of these packages play fast and loose with the \LaTeX{} output
routine, which can cause problems: the user should beware\dots{}

If the requirement is for numbering verbatim text, 
\Package{moreverb} or \Package{fancyvrb} (see
\Qref[question]{including files verbatim}{Q-verbfile}) may be used.

One common use of line numbers is in critical editions of texts, and
for this the \Package{edmac} package offers comprehensive
support.
\begin{ctanrefs}
\item[edmac]\CTANref{edmac}
\item[fancyvrb.sty]\CTANref{fancyvrb}
\item[lineno.sty]\CTANref{lineno}
\item[moreverb.sty]\CTANref{moreverb}
\item[numline.sty]\CTANref{numline}
\end{ctanrefs}

\Question[Q-codelist]{Code listings in \LaTeX{}}

`Pretty' code listings are sometimes considered worthwhile by the
neurotically \ae{}sthetic programmer, but they have a serious place in
the typesetting of dissertations by computer science and other
students who are expected to write programs.  Simple verbatim listings
of programs are commonly useful, as well.

\begin{htmlversion}
  \Qref{Verbatim listings}{Q-verbfile} are dealt with elsewhere.
\end{htmlversion}
\htmlignore
  Verbatim listings are dealt with elsewhere (\Qref{}{Q-verbfile}).
\endhtmlignore
The problem of % beware line break
\latexhtml{typesetting algorithm specifications}{\Qref{typesetting algorithm specifications}{Q-algorithms}}
is also discussed in another question\nothtml{ (\Qref{}{Q-algorithms})}.

The \Package{listings} package is widely regarded as the best bet for
formatted output (it is capable of parsing program source, within the
package itself), but there are several well-established packages that
rely on a pre-compiler of some sort.

The \ProgName{lgrind} system is a well-established
pre-compiler, with all the facilities one might need and a wide
repertoire of languages.

The \ProgName{tiny_c2l} system is more recent:
users are encouraged to generate their own driver files for languages
it doesn't already deal with.

The \ProgName{C++2LaTeX} system comes
with strong recommendations for use with \acro{C} and \acro{C}++.

The \ProgName{highlight} system is a general converter, that can
produce \acro{HTML} and \acro{RTF} formats as well as \AllTeX{}.  It
claims to be highly customisable, and the distribution comes with a
wide range of language definitions.  Documentation is provided by the
\File|README| file in the distribution, which describes itself as a
manual.
\begin{ctanrefs}
\item[C++2LaTeX]\CTANref{c++2latex}
\item[highlight]\CTANref{highlight}
\item[lgrind]\CTANref{lgrind}
\item[listings.sty]\CTANref{listings}
\item[tiny\_c2l]\CTANref{tiny_c2l}
\end{ctanrefs}

\Question[Q-algorithms]{Typesetting pseudocode in \LaTeX{}}

There is no consensus on the `right' way to typeset pseudocode.
Consequently, there are a variety of \LaTeX{} packages to choose from
for producing \ae{}sthetically pleasing pseudocode listings.

Pseudocode differs from actual program listings in that it lacks
strict syntax and semantics.  Also, because pseudocode is supposed to
be a clear expression of an algorithm it may need to incorporate
mathematical notation, figures, tables, and other \LaTeX{} features
that do not appear in conventional programming languages.  
\begin{htmlversion}
  \Qref{Typesetting program listings}{Q-codelist} is described elsewhere.
\end{htmlversion}
\htmlignore
\begin{pdfversion}
  \Qref{Typesetting program listings}{Q-codelist} is described elsewhere.
\end{pdfversion}
\begin{dviversion}
  Typesetting program listings is described elsewhere (\Qref{}{Q-codelist}).
\end{dviversion}
\endhtmlignore

You can certainly create your own environment for typesetting
pseudocode using, for example, the \environment{tabbing} or
\environment{list} environments~--- it's not difficult, but it may
prove boring.  So it's worth trying the following packages, all
designed specifically for typesetting pseudocode.

The \Package{algorithms} bundle (which contains packages
\Package{algorithm} and \Package{algorithmic}, both of which are
needed for ordinary use) has a simple interface and produces fairly
nice output.  It provides primitives for statements, which can contain
arbitrary \LaTeX{} commands, comments, and a set of iterative and
conditional constructs.  These primitives can easily be redefined to
produce different text in the output.  However, there is no support
for adding new primitives.  Typesetting the pseudocode itself is
performed in \Package{algorithmic}; the \Package{algorithms} package
uses the facilities of the the \Package{float} package to number
algorithms sequentially, enable algorithms to float like figures or
tables, and support including a List of Algorithms in a document's
front matter.

The \Package{alg} package, like \Package{algorithms}, offers a
floating algorithm environment with all of the ensuing niceties.
\Package{alg}, however, can caption its floats in a variety of
(natural) languages.  In addition, \Package{alg} unlike
\Package{algorithms}, makes it easy to add new constructs.

The \Package{newalg} package has a somewhat similar interface to
\Package{algorithms}, but its output is designed to mimic the rather
pleasant typesetting used in the book ``Introduction to Algorithms''
by Corman, Leiserson, Rivest  and Stein. Unfortunately, \Package{newalg} does
not support a floating environment or any customisation of the output.

``\emph{Bona fide}'' use of the style of  ``Introduction to
Algorithms'' may be achieved with Cormen's own \Package{clrscode}:
this is the package as used in the second edition of the book.

The \Package{algorithm2e} is of very long standing, and is widely used
and recommended.  It loads the \Package{float} package to provide the
option of floating algorithm descriptions, but you can always use the
``\texttt{H}'' option of \Package{float} to have the algorithm appear
``where you write it''.

The usage of the \Package{program} package is a little different from
that of the other packages.  It typesets programs in maths mode
instead of text mode; and linebreaks are significant.
\Package{program} lacks a floating environment but does number
algorithms like \Package{alg} and \Package{algorithms}.  Customisation
and extension are not supported.

None of the above are perfect.  The factors that should influence your
choice of package include the output style you prefer, how much you
need to extend or modify the set of keywords, and whether you require
algorithms to float like figures and tables.

Documentation availability:
\begin{description}
\item[\Package{algorithms} bundle] is provided in \File{algorithms.ps}
  (also available as LaTeX{} source).  The documentation speaks as if
  the two packages of the bundle were indeed one, called
  \Package{algorithms}.
\item[\Package{program} package] (such as it is) appears in a file
  \File{program.msg}.
\item[\Package{clrscode} package] is to be found in
  \File{clrscode.pdf} in the distribution.
\item[\Package{algorithm2e} package] is to be found in
  \File{algorithm2e.tex} in the distribution (it needs the package
  itself when you process it).
\end{description}
\begin{ctanrefs}
\item[algorithm2e.sty]\CTANref{algorithm2e}
\item[algorithms\nothtml{\rmfamily} bundle]\CTANref{algorithms}
\item[alg.sty]\CTANref{alg}
\item[clrscode.sty]\CTANref{clrscode}
\item[float.sty]\CTANref{float}
\item[newalg.sty]\CTANref{newalg}
\item[program.sty]\CTANref{program}
\end{ctanrefs}

\Question[Q-makeindex]{Generating an index in \AllTeX{}}

Making an index is not trivial; what to index, and how to index it, is
difficult to decide, and uniform implementation is difficult to
achieve.  You will need to mark all items to be indexed in your text
(typically with \cs|index| commands).

It is not practical to sort
a large index within \TeX{}, so a post-processing program is used to sort
the output of one \TeX{} run, to be included into the document at the
next run.

The following programs are available:
\begin{description}
\item[makeindex] Comes with most distributions~--- a good workhorse,
  but is not well-arranged to deal with other sort orders than the
  canonical \acro{ASCII} ordering.

  The \Package{makeindex} documentation is a good source of information on how
  to create your own index. \Package{Makeindex} can be used with some \TeX{}
  macro packages other than \LaTeX{}, such as \nothtml{\Eplain\ (}%
  \Qref{Eplain}{Q-eplain}\nothtml{)}, and \TeXsis{}
  (whose macros can be used independently with Plain \TeX{}).
\item[idxtex] for \LaTeX{} under \acro{VMS}, which comes with a
  glossary-maker called \Package{glotex}.
\item[texindex] A witty little shell/\ProgName{sed}-script-based
  utility for \LaTeX{} under Unix.

  There are other programs called \ProgName{texindex}, notably
  one that comes with the
\htmlignore
  Texinfo distribution (\Qref{}{Q-texinfo}).
\endhtmlignore
\begin{htmlversion}
  \Qref{Texinfo}{Q-texinfo} distribution.
\end{htmlversion}
\item[xindy] arose from frustration at the difficulty of making a
  multi-language version of \ProgName{makeindex}.  It is designed to
  be a successor to \ProgName{makeindex}, by a team that included the
  then-current maintainer of \ProgName{makeindex}.  It successfully
  addresses many of \ProgName{makeindex}'s shortcomings, including
  difficulties with collation order in different languages, and it is
  highly flexible.  Sadly, its take-up is proving rather slow.
\end{description}
\begin{ctanrefs}
\item[idxtex]\CTANref{glo+idxtex}
\item[makeindex]\CTANref{makeindex}
\item[makeindex (Macintosh)]\CTANref{macmakeindex}
\item[texindex]\CTANref{texindex}
\item[texsis (system)]\CTANref{texsis}
\item[texsis (makeindex support)]\CTANref{texsis-index}
\item[xindy]\CTANref{xindy}
\end{ctanrefs}

\Question[Q-setURL]{Typesetting \acro{URL}s}

\acro{URL}s tend to be very long, and contain characters that would
naturally prevent them being hyphenated even if they weren't typically
set in \cs|ttfamily|, verbatim.  Therefore, without special treatment,
they often produce wildly overfull \cs|hbox|es, and their typeset
representation is awful.

There are three packages that help solve this problem:
\begin{itemize}
\item The \Package{path} package, which defines a \cs|path| command.
  The command defines each potential break character as a
  \cs|discretionary|, and offers the user the opportunity of
  specifying a personal list of potential break characters.  Its chief
  disadvantage is fragility in \LaTeX{} moving arguments.  (The
% beware line breaks
  \nothtml{Eplain macros~--- }\Qref{Eplain macros}{Q-eplain}\nothtml{~---}
  define a similar \cs|path| command.)

  \Package{Path}, though it works in simple situations, makes no
  attempt to work with \LaTeX{} (it is irremediably fragile).  Despite
  its long and honourable history, it is no longer recommended for
  \LaTeX{} use.
\item The \Package{url} package, which defines an \cs|url| command
  (among others, including its own \cs|path| command).  The command
  gives each potential break character a maths-mode `personality', and
  then sets the \acro{URL} itself (in the user's choice of font) in
  maths mode.  It can produce (\LaTeX{}-style) `robust' commands
  % beware line break within paren 
  (\htmlonly{see }\Qref{use of \cs|protect|}{Q-protect}) for use
  within moving arguments.  Note that, because the operation is
  conducted in maths mode, spaces within the \acro{URL} argument are
  ignored unless special steps are taken.

  It is possible to use the \Package{url} package in Plain \TeX{},
  with the assistance of the \Package{miniltx} package (which was
  originally developed for using the \LaTeX{} graphics package in
  Plain \TeX{}).  A small patch is also necessary: the required
  sequence is therefore:
\htmlignore
\begin{dviversion}
\begin{verbatim}
\input miniltx
\expandafter\def\expandafter\+%
                \expandafter{\+}
\input url.sty
\end{verbatim}
\end{dviversion}
\begin{pdfversion}
\begin{verbatim}
\input miniltx
\expandafter\def\expandafter\+\expandafter{\+}
\input url.sty
\end{verbatim}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
\input miniltx
\expandafter\def\expandafter\+\expandafter{\+}
\input url.sty
\end{verbatim}
\end{htmlversion}
\item The \Package{hyperref} package, which uses the typesetting code
  of \Package{url}, in a context where the typeset text forms the
  anchor of a link.
\end{itemize}

The author of this answer prefers the (rather newer) \Package{url}
package (directly or indirectly);
both \Package{path} and \Package{url} work well with Plain \TeX{}
(though of course, the fancy \LaTeX{} facilities of \Package{url}
don't have much place there).  (\Package{hyperref} isn't available in
a version for use with Plain \TeX{}.)

Documentation of both \Package{path} and \Package{url} is in the
package files.
\begin{ctanrefs}
\item[hyperref.sty]\CTANref{hyperref}
\item[miniltx.tex]Distributed as part of \CTANref{graphics-plain}
\item[path.sty]\CTANref{path}
\item[url.sty]\CTANref{url}
\end{ctanrefs}

\Question[Q-music]{Typesetting music in \TeX{}}

In the early days, a simple music package called \Package{mutex} was
written by Angelika Schofer and Andrea Steinbach, which demonstrated
that music typesetting was possible; the package was very limited, and
is no longer available.  Daniel Taupin took up the baton, and
developed Music\TeX{}, which allows the typesetting of
polyphonic and other multiple-stave music; Music\TeX{} remains
available, but is most definitely no longer recommended.

Music\TeX{} has 
been superseded by its successor MusiX\TeX{}, which is a three-pass
system (with a processor program that computes values for the element
spacing in the music), and achieves finer control than is possible in
the unmodified \TeX{}-based mechanism that Music\TeX{} uses.  Daniel
Taupin's is the only version of MusiX\TeX{} currently being developed
(the original author, Andreas Egler, had an alternative version, but he
is now working on a different package altogether).

Input to Musix\TeX{} is extremely tricky stuff, and Don Simons'
preprocessor \ProgName{pmx} is the preferred method of creating input
for Taupin's version.  \ProgName{Pmx} greatly eases use of
Musix\TeX{}, but it doesn't support the full range of Musix\TeX{}'s
facilities directly; however, it does allow in-line Musix\TeX{} code
in \ProgName{pmx} sources.

Dirk Laurie's \ProgName{M_Tx} allows preparation of music with lyrics;
it operates ``on top of'' \ProgName{pmx}

Another simple notation is supported by \ProgName{abc2mtex};
this is a package designed to notate tunes stored in an \acro{ASCII} format
(|abc| notation). It was designed primarily for folk and traditional
tunes of Western European origin (such as Irish, English and Scottish)
which can be written on one stave in standard classical notation, and
creates input intended for Music\TeX{}.
However, it should be extendable to many other types of music.

Digital music fans can typeset notation for their efforts by using
\ProgName{midi2tex}, which translates MIDI data files into Music\TeX{}
source code.

There is a mailing list (\Email{TeX-music@icking-music-archive.org})
for discussion of typesetting music in \TeX{}.  To subscribe, use
\URL{http://icking-music-archive.org/mailman/listinfo/tex-music/} 
\begin{ctanrefs}
\item[abc2mtex]\CTANref{abc2mtex}
\item[M-Tx]\CTANref{mtx}
\item[midi2tex]\CTANref{midi2tex}
\item[musictex]\CTANref{musictex}
\item[musixtex \nothtml{\rmfamily}(Taupin's version)]\CTANref{musixtex-taupin}
\item[musixtex \nothtml{\rmfamily}(Egler's version)]\CTANref{musixtex-egler}
\item[pmx]\CTANref{pmx}
\end{ctanrefs}

\Question[Q-parskip]{Zero paragraph indent}

The conventional way of typesetting running text has no separation
between paragraphs, and the first line of each paragraph in a block of
text indented.

In contrast, one common convention for typewritten text was to have no
indentation of paragraphs; such a style is often required for
``brutalist'' publications such as technical manuals, and in styles
that hanker after typewritten manuscripts, such as
officially-specified dissertation formats.

Anyone can see, after no more than a moment's thought, that if the
paragraph indent is zero, the paragraphs must be separated by blank
space: otherwise it is sometimes going to be impossible to see the
breaks between paragraphs.

The simple-minded approach to zero paragraph indentation is thus:
\begin{verbatim}
  \setlength{\parindent}{0pt}
  \setlength{\parskip}{\baselineskip}
\end{verbatim}
and in the very simplest text, it's a fine solution.

However, the non-zero \cs|parskip| interferes with lists and the like,
and the result looks pretty awful.  The \Package{parskip} package patches
things up to look reasonable; it's not perfect, but it deals with most
problems.

The Netherlands Users' Group's set of classes includes an
\Class{article} equivalent (\Class{artikel3}) and a \Class{report}
equivalent (\Class{rapport3}) whose design incorporates zero paragraph
indent and non-zero paragraph skip.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\acro{NTG} classes]\CTANref{ntgclass}
\item[parskip.sty]\CTANref{parskip}
\end{ctanrefs}

\Question[Q-dropping]{Big letters at the start of a paragraph}

A common style of typesetting, now seldom seen except in newspapers,
is to start a paragraph (in books, usually the first of a chapter)
with its first letter set large enough to span several lines.

This style is known as ``dropped capitals'', or (in French)
\latexhtml{``lettrines''}{«lettrines»}, and \TeX{}'s primitive
facilities for hanging indentation make its (simple) implementation
pretty straightforward.

The \Package{dropping} package does the job simply, but has a curious
attitude to the calculation of the size of the font to be used for the
big letters.  Examples appear in the package documentation, so before
you process the |.dtx|, the package itself must already be installed.
Unfortunately, \Package{dropping} has an intimate relation to the set
of device drivers available in an early version of the \LaTeX{}
graphics package, and it cannot be trusted to work with recent
offerings like \PDFTeX{},  V\TeX{} or \acro{DVI}pdfm.

On such occasions, the more recent \Package{lettrine} package is more
likely to succeed.  It has a well-constructed array of options, and
the examples (a pretty impressive set) come as a separate file in the
distribution (also available in \PS{}, so that they can be viewed
without installing the package itself).
\begin{ctanrefs}
\item[dropping]\CTANref{dropping}
\item[lettrine]\CTANref{lettrine}
\end{ctanrefs}

\Question[Q-dec_comma]{The comma as a decimal separator}

If you use a comma in maths mode, you get a small space
after it; this space is inappropriate if the comma is being used
as a decimal separator.  An easy solution to this problem is to
type (in maths mode) |3{,}14| instead of typing |3,14|.
However, if your language's typographic rules require the comma as a
decimal separator, such usage can rapidly become extremely tiresome.
In such cases it is probably better to use the
\Package{icomma} package.  The packages ensures that there will be no
extra space after a comma, unless you type a space after it (as in
|f(x, y)|, for instance), in which case the usual small space after
the comma appears.
\begin{ctanrefs}
\item[icomma.sty]Distributed as part of \CTANref{was}
\end{ctanrefs}

\Question[Q-breakbox]{Breaking boxes of text}

\AllTeX{} boxes may not be broken, in ordinary usage: once you've
typeset something into a box, it will stay there, and the box will
jut out beyond the side or the bottom of the page if it doesn't fit in
the typeset area.

If you want a substantial portion of your text to be framed (or
coloured), the restriction starts to seem a real imposition.
Fortunately, there are ways around the problem.

The \Package{framed} package provides \environment{framed} and
\environment{shaded} environments; both put their content into
something which looks like a framed (or coloured) box, but which
breaks as necessary at page end.  The environments ``lose'' footnotes,
marginpars and head-line entries, and will not work with
\Package{multicol} or other column-balancing macros.

The \Package{boites} package provides a \environment{breakbox}
environment; examples of its use may be found in the distribution, and
the package's \File{README} file contains terse documentation.  The
environments may be nested, and may appear inside
\environment{multicols} environments; however, floats, footnotes and
marginpars will be lost.

For Plain \TeX{} users, the facilities of the
\Package{backgrnd} package may be useful; this package subverts the
output routine to provide vertical bars to mark text, and the macros
are clearly marked to show where coloured backgrounds may be
introduced (this requires \Package{shade}, which is distributed as tex
macros and device-independent \MF{} for the shading).  The author of
\Package{backgrnd} claims that the package works with \LaTeXo{}, but
there are reasons to suspect that it may be unstable working with
current \LaTeX{}.
\begin{ctanrefs}
\item[backgrnd.tex]\CTANref{backgrnd}
\item[boites.sty]\CTANref{boites}
\item[framed.sty]\CTANref{framed}
\item[shade.tex]\CTANref{shade}
\end{ctanrefs}

\Question[Q-overstrike]{Overstriking characters}

This may be used, for example, to indicate text deleted in the course
of editing.  Both the \Package{ulem} and the \Package{soul} packages
provide the necessary facilities.

Overstriking for \nothtml{cancellation in maths expressions (}%
% beware line break
\Qref{cancellation in maths expressions}{Q-cancellation}\nothtml{)}
is achieved by a different mechanism.

Documentation of \Package{ulem} is in the package file.
\begin{ctanrefs}
\item[soul.sty]\CTANref{soul}
\item[ulem.sty]\CTANref{ulem}
\end{ctanrefs}

\Question[Q-upquot]{Realistic quotes for verbatim listings}

The |cmtt| font has ``curly'' quotes\nothtml{ (\texttt{`thus'})},
which are pleasing on the eye, but don't really tally with what one
sees on a modern % beware line break
\ProgName{xterm}\nothtml{ (which look like \texttt{\char18 this\char13})}.

The appearance of these quotes is critical in program listings,
particularly in those of Unix-like shell scripts.  The
\Package{upquote} package modifies the behaviour of the
\environment{verbatim} environment so that the output is a clearer
representation of what the user must type.
\begin{ctanrefs}
\item[upquote.sty]\CTANref{upquote}
\end{ctanrefs}

\Question[Q-time]{Printing the time}

\TeX{} has a primitive register that contains ``the number of minutes
since midnight''; with this knowledge it's a moderately simple
programming job to print the time (one that no self-respecting
Plain~\TeX{} user would bother with anyone else's code for).

However, \LaTeX{} provides no primitive for ``time'', so the
non-programming \LaTeX{} user needs help.

Two packages are available, both providing ranges of ways of printing
the date, as well as of the time: this question will concentrate on
the time-printing capabilities, and interested users can investigate
the documentation for details about dates.

The \Package{datetime} package defines two time-printing functions:
\cs|xxivtime| (for 24-hour time), \cs|ampmtime| (for 12-hour time) and
\cs|oclock| (for time-as-words, albeit a slightly eccentric set of
words).

The \Package{scrtime} package (part of the compendious
\Class{KOMA-Script} bundle) takes a package option (\pkgoption{12h}
or \pkgoption{24h}) to specify how times are to be printed.  The
command \cs|thistime| then prints the time appropriately (though
there's no \emph{am} or \emph{pm} in \pkgoption{12h} mode).  The
\cs|thistime| command also takes an optional argument, the character
to separate the hours and minutes: the default is of course
\texttt{:}.
\begin{ctanrefs}
\item[datetime.sty]\CTANref{datetime}
\item[scrtime.sty]Distributed as part of \CTANref{koma-script}
\end{ctanrefs}

\Question[Q-the-commands]{Redefining counters' \csx{the-}commands}

Whenever you request a new \LaTeX{} counter, \LaTeX{} creates a bunch
of behind-the-scenes commands, as well as definining the counter
itself.

Among other things, \cmdinvoke*{newcounter}{fred} creates a command
\csx{the}\texttt{\emph{fred}}, which expands to ``the value of
\texttt{\emph{fred}}'' when you're typesetting.

The definition of \csx{the}\texttt{\emph{fred}} should express the value of the
counter: it is almost always always a mistake to use the command to produce
anything else.  The value may reasonably be expressed as an arabic, a
roman or a greek number, as an alphabetic expression, or even as a
sequence (or pattern of) symbols.  If you need a decision process on
whether to re-define \csx{the}\texttt{\emph{fred}}, consider what
might happen when you do so.

So, for example, if you want your section numbers to be terminated by
a period, you could make \cs|thesection| expand with a terminating
period.  However, such a change to \cs|thesection| makes the
definition of \cs|thesubsection| look distinctly odd: you are going to
find yourself redefining things left, right and centre.  Rather, use
the standard techniques for % beware line break
\nothtml{adjusting the presentation of section numbers (}% beware line break
\Qref{adjusting the presentation of section numbers}{Q-seccntfmt}\nothtml{)}

Or, suppose you want the page number to appear at the bottom of each
page surrounded by dashes (``|-|{}|-~nnn~-|{}|-|''). Would you want to
achieve this by redefining \csx{thepage}, given the likely appearance
of the table of contents with the dashes attached every page number,
or of the modified \cs|pageref| references.  In this case, the
modification is best done by redefining the page style itself, perhaps
with \nothtml{package \Package{fancyhdr} (}%
\Qref{package \Package{fancyhdr}}{Q-fancyhdr}\nothtml{)}.

\subsection{Tables of contents and indexes}

\Question[Q-tocloft]{The format of the Table of Contents, etc.}

The formats of entries in the table of contents (\acro{TOC}) are
controlled by a number of internal commands (discussed in section~2.4
of \textit{The \LaTeX{} Companion}~--- see
% beware line wrap
\Qref[question]{\TeX{} books}{Q-books}).
The commands \cs|@pnumwidth|, \cs|@tocrmarg| and \cs|@dotsep| control
the space for page numbers, the indentation of the right-hand margin,
and the seperation of the dots in the dotted leaders, respectively.
The series
of commands named \cs|l@xxx|, where |xxx| is the name of a sectional heading
(such as |chapter| or |section|, \dots{}\@) control the layout of the
corresponding heading, including the space for section numbers.
All these internal commands may be individually redefined
to give the effect that you want.

Alternatively, the package \Package{tocloft} 
provides a set of user-level 
commands that may be used to change the \acro{TOC} formatting.  Since
exactly the same mechanisms are used for the List of Figures and List
of Tables, the layout of these sections may be controlled in the same way.
\begin{ctanrefs}
\item[tocloft.sty]\CTANref{tocloft}
\end{ctanrefs}

\Question[Q-secnumdep]{Unnumbered sections in the Table of Contents}

The way the relevant parts of sectioning commands work is exemplified
by the way the \cs|chapter| command uses the counter |secnumdepth|
(described in Appendix~C of the \LaTeX{} manual):
\begin{enumerate}
\item put something in the |.aux| file, which will appear in the |.toc|;
\htmlignore
\item if $\mbox{\texttt{secnumdepth}} \geq 0$,
\endhtmlignore
\begin{htmlversion}
\item if the |secnumdepth| counter is greater than or equal to zero,
\end{htmlversion}
      increase the counter for the chapter and write it out.
\item write the chapter title.
\end{enumerate}
Other sectioning commands are similar, but with other values 
used in the test.

So a simple way to get headings of funny `sections' such as
prefaces in  the table of contents is to use the counter:
\begin{verbatim}
  \setcounter{secnumdepth}{-1}
  \chapter{Preface}
\end{verbatim}
Of course, you have to set |secnumdepth| back to its usual value
(which is~2 in the standard styles) before you do
any `section' which you want to be numbered.

Similar settings are made automatically in the \LaTeX{} book class by
the |\frontmatter| and |\backmatter| commands.

The value of the counter |tocdepth| controls which headings will be
finally printed in the table of contents.  This normally has to be set
in the preamble and is a constant for the document.  The package
\Package{tocvsec2} package  provides a convenient
interface to allow you to change the |secnumdepth| and/or the
|tocdepth| counter values at any point in the body of the document;
this provides convenient independent controls over the sectional
numbering and the table of contents.

The package \Package{abstract} (see
\Qref[question]{one-column abstracts}{Q-onecolabs})
includes an option to add the |abstract| to the table of contents,
while the package \Package{tocbibind} 
has options to include the table of contents itself, the
|bibliography|, |index|, etc., to the table of contents.
\begin{ctanrefs}
\item[abstract.sty]\CTANref{abstract}
\item[tocbibind.sty]\CTANref{tocbibind}
\item[tocvsec2.sty]\CTANref{tocvsec2}
\end{ctanrefs}

\Question[Q-tocbibind]{Bibliography, index, etc., in \acro{TOC}}

The standard \LaTeX{} classes (and many others) use \cs|section*| or
\cs|chapter*| for auto-generated parts of the document (the tables of
contents, figures and tables, the bibliography and the index).  As a
result, these items aren't numbered (which most people don't mind),
and (more importantly) they don't appear in the table of contents.

The correct solution (as always) is to have a class of your own that
formats your document according to your requirements.  The macro to do
the job (\cs|addcontentsline|) is fairly simple, but there is always
an issue of ensuring that the contents entry quotes the correct page:
\begin{verbatim}
  \bibliography{frooble}
  \addcontentsline{toc}{chapter}{Bibliography}
\end{verbatim}
will produce the \emph{wrong} answer if the bibliography is more than
one page long.  Instead, one should say:
\begin{verbatim}
  \cleardoublepage
  \addcontentsline{toc}{chapter}{Bibliography}
  \bibliography{frooble}
\end{verbatim}
(Note that \cs|cleardoublepage| does the right thing, even if your
document is single-sided~--- in that case, it's a synonym for
\cs|clearpage|).  Ensuring that the entry refers to the right place is
trickier still in a \cs|section|-based class.

The common solution, therefore, is to use the \Package{tocbibind}
package, which provides many facilities to control the way these
entries appear in the table of contents.

Of course, the \emph{\acro{KOMA}-Script} bundle of classes (\Class{scrbook}
instead of \Class{book}, \Class{scrreprt} instead of \Class{report},
etc.\@) provide this functionality as a set of class options.
\begin{ctanrefs}
\item[KOMA-Script bundle]\CTANref{koma-script}
\item[tocbibind.sty]\CTANref{tocbibind}
\end{ctanrefs}

\Question[Q-multind]{Multiple indexes}

\LaTeX{}'s standard indexing capabilities (those provided by the
\Package{makeidx} package) only provide for one index in your
document; even quite modest documents can be improved by indexes for
separate topics.

The \Package{multind} package provides simple and straightforward
multiple indexing.  You tag each \cs|makeindex|, \cs|index| and
\cs|printindex| command with a file name, and indexing commands are
written to (or read from) the name with the appropriate (|.idx| or
|.ind|) extension appended.  The \cs|printindex| command is modified
from the \LaTeX{} standard so that it doesn't create its own chapter
or section heading; you therefore decide what names (or sectioning
level, even) to use for the indexes, and \nothtml{\cs|indexname| (}%
\Qref{\cs|indexname|}{Q-fixnam}\nothtml{)} is completely ignored.

To create a ``general'' and an ``authors'' index, one might write:
\begin{quote}
\begin{verbatim}
\usepackage{multind}
\makeindex{general}
\makeindex{authors}
...
\index{authors}{Robin Fairbairns}
...
\index{general}{FAQs}
...
\section{General index}
\printindex{general}
\section{Author index}
\printindex{authors}
\end{verbatim}
\end{quote}
To complete the job, run \LaTeX{} on your file enough times that
labels, etc., are stable, and then execute the commands
\begin{quote}
\begin{verbatim}
makeindex general
makeindex authors
\end{verbatim}
\end{quote}
before running \LaTeX{} again.  Note that the names of the index files
to process are not necessarily related to the name of the \LaTeX{}
file you're processing, at all.  (There's no documentation that comes
with the package: what you see above is as good as you will get\dots{})

The \Package{index} package provides a comprehensive set of indexing
facilities, including a \cs|newindex| command that allows the
definition of new styles of index.  \cs|newindex| takes a `tag' (for
use in indexing commands), replacements for the |.idx| and |.ind| file
extensions, and a title for the index when it's finally printed; it
can also change the item that's being indexed against (for example,
one might have an index of artists referenced by the figure number
where their work is shown).

Using \Package{index}, to create an author index together with a
``normal'' index, one would start with preamble commands:
\begin{quote}
\begin{verbatim}
\usepackage{index}
\makeindex
\newindex{aut}{adx}{and}{Name Index}
\end{verbatim}
\end{quote}
which load the package, define a ``main'' (original-style) index, and
then define an author index.  Then, in the body of the document, we
might find commands like:
\begin{quote}
\begin{verbatim}
\index[aut]{Robin Fairbairns}
...
\index{FAQs}
\end{verbatim}
\end{quote}
Which place an entry in the author index, and then one in the main
index.  At the end of the document, we have two commands:
\begin{quote}
\begin{verbatim}
\printindex
\printindex[aut]
\end{verbatim}
\end{quote}
Which will print the main index and then the author index.  Supposing
this lot to be in \File{myfile.tex}, after enough runs through
\LaTeX{} that labels are stable, execute the following  commands
(Unix-style shell commands shown here, but the principle is the same
whatever system you're using):
\begin{quote}
\begin{verbatim}
makeindex myfile
makeindex myfile.adx -o myfile.and
\end{verbatim}
\end{quote}
and rerun \LaTeX{}.  The \ProgName{makeindex} commands process
\File{myfile.idx} to \File{myfile.ind} (the default action), and then
\File{myfile.adx} to \File{myfile.and}, the two files needed as input
by the two \csx{printindex} commands in \File{myfile.tex}.

The \Package{splitidx} package (which comes with a small executable
\ProgName{splitindex} available for a variety of platforms) is another
alternative.  It supports the sorts of things that the \Package{index}
package does, but since it uses a separate program to separate the
index entries, it is not limited by the number of output streams
\AllTeX{} can have open at any one time.  An example of use appears in
the documentation.
\begin{ctanrefs}
\item[index.sty]Distributed as part of \CTANref{camel}
\item[makeidx.sty]Part of the \LaTeX{} distribution
\item[multind.sty]\CTANref{multind}
\item[splitidx.sty \bgroup\nothtml{\normalfont}and \egroup splitindex]%
  \CTANref{splitindex}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\subsection{Labels and references}

\Question[Q-nameref]{Referring to things by their name}

\LaTeX{}'s labelling mechanism is designed for the impersonal world of
the academic publication, in which everything has a number: an
extension is necessary if we are to record the \emph{name} of things
we've labelled.  The two packages available extend the \LaTeX{}
sectioning commands to provide reference by the name of the section.

The \Package{titleref} package is a simple extension which provides
the command \cs|titleref|; it is a stand-alone package; don't use it
in a document in which you also need to use \Package{hyperref}.

The \Package{nameref} package employs the techniques of the
\Package{hyperref} package to define a \cs|nameref| command. The
\Package{hyperref} also defines \cs|nameref| as a command which, like
\cs|ref| itself, is active.
\begin{ctanrefs}
\item[hyperref.sty]\CTANref{hyperref}
\item[nameref.sty]Distributed with \CTANref{hyperref}
\item[titleref.sty]\CTANref{titleref}
\end{ctanrefs}

\Question[Q-extref]{Referring to labels in other documents}

When producing a set of inter-related documents, you'll often want to
refer to labels in another document of the set; but \LaTeX{}, of its
own accord, doesn't permit this.

So the package \Package{xr} was written: if you say
\begin{quote}
\begin{verbatim}
\usepackage{xr}
\externaldocument{volume1}
\end{verbatim}
\end{quote}
will load all the references from \File{volume1} into your present
document.

But what if the documents both have a section labelled
``\environment{introduction}'' (likely enough, after all)?  The
package provides a means to transform all the imported labels, so you
don't have to change label names in either document.  For example:
\begin{quote}
\begin{verbatim}
\usepackage{xr}
\externaldocument[V1-]{volume1}
\end{verbatim}
\end{quote}
loads the references from \File{volume1}, but prefixes every one with
the string |V1-|.  So you would refer to the introduction to volume~1
as:
\begin{narrowversion}
\begin{quote}
\begin{verbatim}
\usepackage{xr}
\externaldocument[V1-]{volume1}
...
... the introduction to volume1
               (\ref{V1-introduction})...
\end{verbatim}
\end{quote}
\end{narrowversion}
\begin{wideversion}
\begin{quote}
\begin{verbatim}
\usepackage{xr}
\externaldocument[V1-]{volume1}
...
... the introduction to volume1 (\ref{V1-introduction})...
\end{verbatim}
\end{quote}
\end{wideversion}
To have the facilities of \Package{xr} working with
\Package{hyperref}, you need \Package{xr-hyper}.  For simple
hyper-cross-referencing (i.e., to a local \acro{PDF} file you've just
compiled), write:
\begin{quote}
\begin{verbatim}
\usepackage{xr-hyper}
\usepackage{hyperref}
\externaldocument[V1-]{volume1}
...
... the \nameref{V1-introduction})...
\end{verbatim}
\end{quote}
and the name reference will appear as an active link to
the ``introduction'' chapter of \File{volume1.pdf}.

To link to a \acro{PDF} document on the Web, for which you happen to
have the .aux file, write:
\begin{quote}
\begin{wideversion}
\begin{verbatim}
\usepackage{xr-hyper}
\usepackage{hyperref}
\externaldocument[V1-]{volume1}[http://mybook.com/volume1.pdf]
...
... the \nameref{V1-introduction})...
\end{verbatim}
\end{wideversion}
\begin{narrowversion}
\begin{verbatim}
\usepackage{xr-hyper}
\usepackage{hyperref}
\externaldocument[V1-]{volume1}%
    [http://mybook.com/volume1.pdf]
...
... the \nameref{V1-introduction})...
\end{verbatim}
\end{narrowversion}
\end{quote}
\begin{ctanrefs}
\item[xr.sty]Distributed as part of \CTANref{2etools}
\item[xr-hyper.sty]Distributed with \CTANref{hyperref}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{How do I do\dots{}?}

\subsection{Mathematics}

\Question[Q-proof]{Proof environment}

It has long been thought impossible to make a \environment{proof}
environment which automatically includes an `end-of-proof' symbol.
Some proofs end in displayed maths; others do not.  If the input file
contains
% beware line break
|...\] \end{proof}| then \LaTeX{} finishes off the displayed maths and gets
ready for a new line before it reads any instructions connected with
ending the proof, so the code is very tricky.  You \emph{can} insert
the symbol by hand, but the \Package{ntheorem} package now solves the
problem for \LaTeX{} users: it does indeed provide an automatic way of
signalling the end of a proof.

The \AMSLaTeX{} package \Package{amsthm} also provides a
\environment{proof} environment that does the job; though you need to
insert a \cs|qedhere| command if the proof ends with a displayed
equation:
\begin{verbatim}
\begin{proof}
 text...
 \begin{equation*}
  maths... \tag*{\qedhere}
 \end{equation*}
\end{proof}
\end{verbatim}
The |\tag*{\qedhere}| construction may be used in any of \AMSLaTeX{}'s
numbering environments.
\begin{ctanrefs}
\item[amsthm.sty]Distributed as part of the \AMSLaTeX{} bundle
  \CTANref{amslatex}
\item[ntheorem]\CTANref{ntheorem}
\end{ctanrefs}

\Question[Q-theoremfmt]{Roman theorems}

If you want to take advantage of the powerful |\newtheorem| command
without the constraint that the contents of the theorem is in a sloped
font (for example, to use it to create remarks, examples, proofs,
\dots{}) then you can use the \Package{theorem} package.
Alternatively, the following sets up an 
environment \environment{remark} whose content is in roman.
\begin{verbatim}
  \newtheorem{preremark}{Remark}
  \newenvironment{remark}%
    {\begin{preremark}\upshape}{\end{preremark}}
\end{verbatim}
The \Package{ntheorem} package provides roman theorems directly.
\begin{ctanrefs}
\item[ntheorem.sty]\CTANref{ntheorem}
\item[theorem.sty]Distributed as part of \CTANref{2etools}
\end{ctanrefs}

\Question[Q-newfunction]{Defining a new log-like function in \LaTeX{}}

Use the \cs|mathop| command, as in:
\begin{verbatim}
  \newcommand{\diag}{\mathop{\mathrm{diag}}}
\end{verbatim}

Subscripts and superscripts on \cs|diag| will be placed as they
are on \cs|lim|.  If you want your subscripts and superscripts always
placed to the right, do:
\htmlignore
\begin{dviversion}
\begin{verbatim}
  \newcommand{\diag}%
    {\mathop{\mathrm{diag}}\nolimits}
\end{verbatim}
\end{dviversion}
\begin{pdfversion}
\begin{verbatim}
  \newcommand{\diag}{\mathop{\mathrm{diag}}\nolimits}
\end{verbatim}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
  \newcommand{\diag}{\mathop{\mathrm{diag}}\nolimits}
\end{verbatim}
\end{htmlversion}

\AMSLaTeX{} (in its \Package{amsopn} package) provides a command
\cs|DeclareMathOperator| that takes does the same job as the first
definition above.  To create our original \cs|diag| command, one would
say:
\begin{verbatim}
  \DeclareMathOperator{\diag}{diag}
\end{verbatim}
\cs|DeclareMathOperator*| declares the operator always to have its
sub- and superscripts in the % multiple line break problems!
\latexhtml{``\csx{limits} position'' (}{``}\Qref{\csx{limits} position}{Q-limits}\latexhtml{)}{''}.

(It should be noted that ``log-like'' was reportedly a \emph{joke} on
Lamport's part; it is of course clear what was meant.)
\begin{ctanrefs}
\item[amsopn.sty]In the \AMSLaTeX{} distribution \CTANref{amslatex}
\end{ctanrefs}

\Question[Q-braket]{Set specifications and Dirac brackets}

One of the few glaring omissions from \TeX{}'s mathematical
typesetting capabilities is a means of setting separators in the
middle of mathematical expressions.  \TeX{} provides primitives called
\cs|left| and \cs|right|, which can be used to modify brackets (of
whatever sort) around a mathematical expression, as in:
% beware line wrap
|\left( <expression> \right)|~--- the size of the parentheses is
matched to the vertical extent of the expression.

However, in all sorts of mathematical enterprises one may find oneself
needing a \cs|middle| command, to be used in expressions like
\begin{htmlversion}
\begin{verbatim}
  \left\{ x\in \mathbb{N} \middle| x \mbox{ even} \right\}
\end{verbatim}
\end{htmlversion}
\htmlignore
\ifpdf
\begin{verbatim}
  \left\{ x\in \mathbb{N} \middle| x \mbox{ even} \right\}
\end{verbatim}
\else
\begin{verbatim}
 \left\{ x\in N \middle| x\mbox{ even} \right\}
\end{verbatim}
\fi
\endhtmlignore
to specify the set of even natural numbers.  The
% beware line break
\nothtml{\eTeX{} system (}\Qref{\eTeX{} system}{Q-NTS}\nothtml{)}
defines just such a command, but users of Knuth's original need some
support.  Donald Arseneau's \Package{braket} package provides commands
for set specifications (as above) and for Dirac brackets (and bras and
kets).  The package uses the \eTeX{} built-in command if it finds
itself running under \eTeX{}.
\begin{ctanrefs}
\item[braket.sty]\CTANref{braket}
\end{ctanrefs}

\Question[Q-cancellation]{Cancelling terms in maths expressions}

A technique used when explaining the behaviour of expressions or
equations (often for pedagogical purposes).  The \Package{cancel}
package provides several variants of cancellation marks (``|\|'',
``|/|'' and ``|X|''), and a means of cancelling `to' a particular
value.

Documentation of \Package{cancel} is in the package file.
\begin{ctanrefs}
\item[cancel.sty]\CTANref{cancel}
\end{ctanrefs}

\Question[Q-mathsize]{Adjusting maths font sizes}

In Plain~\TeX{}, when you introduce a new font size you must also
declare what size fonts are to be used in mathematics with it.  This
is done by declaring \cs|textfont|, \cs|scriptfont| and
\cs|scriptscriptfont| for the maths families you're using; all such
things are described in chapter~17 of the \nothtml{\TeX{}book (}% line wrap!!
\Qref{\TeX{}book}{Q-books}\nothtml{)} and other books and
\nothtml{tutorials (}% beware line wrap
\Qref{tutorials}{Q-tutorials}\nothtml{)} that discuss Plain~\TeX{} in
sufficient detail.

In \LaTeX{}, of course, all this stuff is automated: there is a scheme
that, for each (text) font size, determines what maths font sizes are
to be used.  The scheme first checks a set of ``known'' text sizes,
for each of which maths sizes are declared in advance.  If the text
size isn't ``known'', the script- and scriptscriptfont sizes are
calculated as fixed ratios of the tex font size.  (The values used are
\cs|defaultscriptratio|\latexhtml{$=$}{=}0.7, and
\cs|defaultscriptscriptratio|\latexhtml{$=$}{=}0.5.)

The fixed-ratio formula is capable of producing inconvenient results
(particularly if you are using fonts which \LaTeX{} believes are only
available in a fixed set of sizes).  You may also want to replace
\LaTeX{}'s ideas altogether, for example by setting maths noticeable
larger or smaller than its surrounding text.  For this purpose, the
\LaTeX{} command
\cmdinvoke{DeclareMathSizes}{\meta{tfs}}{\meta{ts}}{\meta{ss}}{\meta{sss}}
may be used (this is the same command that \LaTeX{} itself uses to
define its own set of sizes).  This establishes (or re-establishes)
the maths font sizes for the text font size \texttt{\meta{tfs}}
(\texttt{\meta{ts}} being the \cs|textsize|, \texttt{\meta{ss}} being
the \cs|scriptsize| and \texttt{\meta{sss}} being the
\cs|scriptscriptsize| to use).

\cs|DeclareMathSizes| may only be used in the preamble of the
document: only one association is available for each text font size
for the whole document.

\Question[Q-mathlips]{Ellipses}
\keywords{\csx{dots} \csx{cdots} \csx{vdots} \csx{ddots}}

Ellipses are commonly required, and \LaTeX{} natively supplies a fair
range (\cs|dots|, \cs|cdots|, \cs|vdots| and \cs|ddots|).  By using
the \Package{graphics} package, one can change the slope of the
\cs|ddots| command, as in
\begin{verbatim}
  $ ... \reflectbox{$\ddots$} ... $
\end{verbatim}
While this works, it is not a recommended way of achieving the desired
result (see below).  Moreover, \LaTeX{}'s range is not adequate to
everyone's requirements, and at least three packages provide
extensions to the set.

The \AMSLaTeX{} bundle provides a range of
``semantically-named'' ellipses, for use in different situations:
\cs|dotsb| for use between pairs of binary operators, \cs|dotsc| for
use between pairs of commas, and so on.

The \Package{yhmath} package defines an \cs|adots| command, which is
the analogue of \cs|ddots|, sloping forwards rather than backwards.
The \Package{yhmath} package comes with a rather interesting font that
extends the standard \Package{cmex}; details are in the documentation.
The disadvantage of this setup is, that although \cs|adots| is merely
a macro, the package tries to load its own font and produces a
``missing font'' substitution warning message if you haven't installed
the font.

The \Package{mathdots} package (besides fixing up the behaviour of
\AllTeX{} \cs|ddots| and \cs|vdots| when the font size changes)
provides an ``inverse diagonal'' ellipsis \cs|iddots| (doing the same
job as \Package{yhmath}'s \cs|adots|, but better).

Documentation of \Package{yhmath} appears, processed, in the
distribution (thus saving you the bother of installing the package
before being able to read the documentation).  Documentation of
\Package{mathdots} appears at the end the package file itself.
\begin{ctanrefs}
\item[amslatex]\CTANref{amslatex}
\item[graphics.sty]Part of the \CTANref{graphics} bundle
\item[mathdots.sty]\CTANref{mathdots}
\item[yhmath \nothtml{\rmfamily}(fonts)]\CTANref{yhmath-fonts}
\item[yhmath \nothtml{\rmfamily}(macros)]\CTANref{yhmath-macros}
\end{ctanrefs}

\Question[Q-limits]{Sub- and superscript positioning for operators}

The commonest hand-written style for expressions is to place the
limit expressions on operators such as \cs|sum| and \cs|int|
physically above and below the operator.  In \AllTeX{}, we write these
limit expressions using sub- and superscripts applied to the operator,
but they don't always appear in the ``handwritten'' way in \TeX{}'s
output.

The reason is, that when an expression appears in non-display maths,
in running text (and is therefore in \TeX{} \cs|textstyle|), placing
the limits thus could lead to ragged line spacing (and hence
difficult-to-read text).  It is therefore common (in \cs|textstyle|)
to place the limits as one would sub- and superscripts of variables.

This is not universally satisfactory, so the primitive \cs|limits| is
provided:
\begin{verbatim}
  $\sum\limits_{n=1}^{m} ...$
\end{verbatim}
which will place the limits right above and below the symbol (and be
blowed to the typography\dots{}).

Contrariwise, you may wish to change the arrangement of the limits
when in \cs|displaystyle|.  For this purpose, there's a corresponding
\cs|nolimits|:
\begin{verbatim}
  \[\sum\nolimits_{n=1}^{m} ...\]
\end{verbatim}
which will place the limits as they would be in \cs|textstyle|.

(Note that the macro \cs|int| normally has \cs|nolimits| built in to
its definition.  There is an example in the \TeX{}book to show how odd
\cs|int|\cs|limits| looks when typeset.)

\Question[Q-mathstext]{Text inside maths}

When we type maths in \AllTeX{}, the letters from which we make up
ordinary text assume a special significance: they all become
single-letter variable names.  The letters appear in italics, but it's
not the same sort of italics that you see when you're typing ordinary
text: a run of maths letters (for example ``here'') looks oddly
``lumpy'' when compared with the word written in italic text.  The
difference is that the italic text is kerned to make the letters fit
well together, whereas the maths is set to look as if you're
multiplying \emph{h} by \emph{e} by \emph{r} by \emph{e}.  The other
way things are odd in \TeX{} maths typing is that spaces are ignored:
at best we can write single words in this oddly lumpy font.

So, if we're going to have good-looking text in amongst maths we're
writing, we have to take special precautions.  If you're using
\LaTeX{}, the following should help.

The simplest is to use \cs|mbox| or \cs|textrm|:
\begin{quote}
\begin{verbatim}
$e = mc^2 \mbox{here we go again}$
\end{verbatim}
\end{quote}
The problem is that, with either, the size of the text remains firmly
at the surrounding text size, so that
\begin{quote}
\begin{verbatim}
$z = a_{\mbox{other end}}$
\end{verbatim}
\end{quote}
looks quite painfully wrong.

The other simple technique, \cs|textrm|, is more promising:
\begin{quote}
\begin{verbatim}
$z = a_{\textrm{other end}}$
\end{verbatim}
\end{quote}
is definitely right.  However, the surrounding text may not be in your
roman font; if you care about matching text, you need to choose
between \cs|textrm|, \cs|textsf|, and so on.

(The maths-mode instance of your roman font (\cs|mathrm|) gets the size
right, but since it's intended for use in maths, its spaces get
ignored~--- use \cs|mathrm| for upright roman alphabetic variable
names, but not otherwise.)

You can correct these problems with size selectors in the text, as:
\begin{quote}
\begin{verbatim}
$z = a_{\mbox{\scriptsize other end}}$
\end{verbatim}
\end{quote}
which works if your surrounding text is at default document size, but
gives you the wrong size otherwise.

These short cuts are (just about) \acro{OK} for the ``occasional''
mathematician, but serious mathematics calls for a technique that
relieves the typist of the sort of thought required.  As usual, the
\AMSLaTeX{} system provides what's necessary~--- the \cs|text|
command.  The command is actually provided by the \Package{amstext}
package, but the ``global'' \Package{amsmath} package loads it, so
anyone using \AMSLaTeX{} proper has the command available, so even
joke mathematicians can write:
\begin{quote}
\begin{verbatim}
\usepackage{amsmath}
...
$z = a_{\text{other end}}$
\end{verbatim}
\end{quote}
and the text will be at the right size, and in the same font as
surrounding text.

\AMSLaTeX{} also makes provision for interpolated comments in the
middle of one of its multi-line display structures, through the
\cs|intertext| command.  For example:
\htmlignore
\begin{dviversion}
\begin{quote}
\begin{verbatim}
\begin{align}
A_1&=N_0(\lambda;\Omega')-
         \phi(\lambda;\Omega'),\\
A_2&=\phi(\lambda;\Omega')-
         \phi(\lambda;\Omega),\\
\intertext{and}
A_3&=\mathcal{N}(\lambda;\omega).
\end{align}
\end{verbatim}
\end{quote}
\end{dviversion}
\begin{pdfversion}
\begin{quote}
\begin{verbatim}
\begin{align}
A_1&=N_0(\lambda;\Omega')-\phi(\lambda;\Omega'),\\
A_2&=\phi(\lambda;\Omega')-\phi(\lambda;\Omega),\\
\intertext{and}
A_3&=\mathcal{N}(\lambda;\omega).
\end{align}
\end{verbatim}
\end{quote}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{quote}
\begin{verbatim}
\begin{align}
A_1&=N_0(\lambda;\Omega')-\phi(\lambda;\Omega'),\\
A_2&=\phi(\lambda;\Omega')-\phi(\lambda;\Omega),\\
\intertext{and}
A_3&=\mathcal{N}(\lambda;\omega).
\end{align}
\end{verbatim}
\end{quote}
\end{htmlversion}
places the text ``and'' on a separate line before the last line of the
display.  The command may only be used immediately after a |\\| command.

Comprehensive documentation of \AMSLaTeX{} is to be found in
\File{amsldoc}, in the distribution; it is also available on the web
at \URL{ftp://ftp.ams.org/pub/tex/doc/amsmath/amsldoc.pdf}
\begin{ctanrefs}
\item[amsldoc.tex]Distributed as part of \AMSLaTeX{} \CTANref{amslatex}
\item[amsmath.sty]Distributed as part of \AMSLaTeX{} \CTANref{amslatex}
\item[amstext.sty]Distributed as part of \AMSLaTeX{} \CTANref{amslatex}
\end{ctanrefs}

\Question[Q-reuseq]{Re-using an equation}

To repeat an existing equation, one wants not only to have the same
mathematics in it, one also wants to re-use the original label it
had.  The \Package{amsmath} package comes to our help, here:
\begin{quote}
\begin{verbatim}
\usepackage{amsmath}
...
\begin{equation}
  a=b
  \label{eq1}
\end{equation}
...
Remember that
\begin{equation}
  a=b
  \tag{\ref{eq1}}
\end{equation}
\end{verbatim}
\end{quote}
Here, the second instance of \latexhtml{$a=b$}{\emph{a=b}} will be
typeset with a copy, made by the \cs|tag| command, of the label of the
first instance.

Comprehensive documentation of \AMSLaTeX{} is to be found in
\File{amsldoc}, in the distribution; it is also available on the web
at \URL{ftp://ftp.ams.org/pub/tex/doc/amsmath/amsldoc.pdf}
\begin{ctanrefs}
\item[amsldoc.tex]Distributed as part of \AMSLaTeX{} \CTANref{amslatex}
\item[amsmath.sty]Distributed as part of \AMSLaTeX{} \CTANref{amslatex}
\end{ctanrefs}

\subsection{Lists}

\Question[Q-enumerate]{Fancy enumeration lists}

The \Package{enumerate} package allows you to control the display of
the enumeration counter.  The package adds an optional
parameter to the \environment{enumerate} environment, which is used to
specify the layout of the labels.  The layout parameter contains an
enumeration type (`\texttt{1}' for arabic numerals, `\texttt{a}' or
`\texttt{A}' for alphabetic enumeration, and `\texttt{i}' or
`\texttt{I}' for Roman numberals), and things to act as decoration of
the enumeration.  So, for example
\begin{quote}
\begin{verbatim}
\usepackage{enumerate}
...
\begin{enumerate}[(a)]
\item ...
...
\end{enumerate}
\end{verbatim}
\end{quote}
starts a list whose labels run (a), (b), (c), \dots{}; while
\begin{quote}
\begin{verbatim}
\usepackage{enumerate}
...
\begin{enumerate}[I/]
\item ...
...
\end{enumerate}
\end{verbatim}
\end{quote}
starts a list whose labels run I/, II/, III/, \dots{}

The \Package{paralist} package, whose primary purpose is % beware line break
\Qref*{compaction of lists}{Q-complist}, provides the same facilities
for its \environment{enumerate}-like environments.

If you need non-stereotyped designs, the \Package{enumitem} package
gives you most of the flexibility you might want to design your own.
The silly roman example above could be achieved by:
\begin{quote}
\begin{verbatim}
\usepackage{enumitem}
...
\begin{enumerate}[label=\Roman{*}/]
\item ...
...
\end{enumerate}
\end{verbatim}
\end{quote}
Note that the `\texttt{*}' in the key value stands for the list
counter at this level.  You can also manipulate the format of
references to list item labels:
\begin{quote}
\htmlignore
\begin{dviversion}
\begin{verbatim}
\usepackage{enumitem}
...
\begin{enumerate}[label=\Roman{*}/,
                    ref=(\roman{*})]
\item ...
...
\end{enumerate}
\end{verbatim}
\end{dviversion}
\begin{pdfversion}
\begin{verbatim}
\usepackage{enumitem}
...
\begin{enumerate}[label=\Roman{*}/, ref=(\roman{*})]
\item ...
...
\end{enumerate}
\end{verbatim}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
\usepackage{enumitem}
...
\begin{enumerate}[label=\Roman{*}/, ref=(\roman{*})]
\item ...
...
\end{enumerate}
\end{verbatim}
\end{htmlversion}
\end{quote}
to make references to the list items format appear as (i), (ii),
(iii), etc.
%% It is possible (if not particularly convenient) to do the same thing
%% yourself.  Suppose you want your top-level \environment{enumerate}s to
%% be labelled I/, II/, III/, \dots{}, then give these commands:
%% \begin{verbatim}
%%    \renewcommand{\theenumi}{\Roman{enumi}}
%%    \renewcommand{\labelenumi}{\theenumi/}
%% \end{verbatim}
%% The possible styles of numbering are given in Section~6.3 of Lamport's
%% book (see \Qref[question]{\TeX{}-related books}{Q-books}).  Both
%% \cs|theenumi| and \cs|labelenumi| must be changed, since
%% \cs|theenumi| is used in cross-references to the list.
%%
%% For lower level \environment{enumerate}s, replace |enumi| by |enumii|,
%% |enumiii| or |enumiv|, according to the level.  If your label is much
%% larger than the default, you should also change \cs|leftmargini|,
%% \cs|leftmarginii|, \emph{etc}.
\begin{ctanrefs}
\item[enumerate.sty]Distributed as part of \CTANref{2etools}
\item[enumitem.sty]Distributed as part of \CTANref{bezos}
\item[paralist.sty]\CTANref{paralist}
\end{ctanrefs}

\Question[Q-complist]{How to reduce list spacing}

\nothtml{Lamport's book (see }%
% beware line wrap
\Qref[question]{Lamport's book}{Q-books}\nothtml{)} lists various
parameters for the layout of list (things like \cs|topsep|,
\cs|itemsep| and \cs|parsep|), but fails to mention that they're set
automatically within the list itself.  It works by each list executes a
command \cs|@list|\texttt{\meta{depth}} (the depth appearing as a
lower-case roman numeral); what's more, \cs|@listi| is usually reset
when the font size is changed.  As a result, it's rather tricky for
the user to control list spacing; of course, the real answer is to use
a document class designed with more modest list spacing, but we all
know such things are hard to come by.

There are packages that provide some control of list spacing, but
they seldom address the separation from surrounding text (defined by
\cs|topsep|).  The \Package{expdlist} package, among its many controls
of the appearance of |description| lists, offers a compaction
parameter (see the documentation); the \Package{mdwlist} package
offers a \cs|makecompactlist| command for users' own list definitions,
and uses it to define compact lists |itemize*|, |enumerate*| and
|description*|.  In fact, you can write lists such as these commands
define pretty straightforwardly~--- for example:
\begin{quote}
\begin{verbatim}
\newenvironment{itemize*}%
  {\begin{itemize}%
    \setlength{\itemsep}{0pt}%
    \setlength{\parskip}{0pt}}%
  {\end{itemize}}
\end{verbatim}
\end{quote}
The \Package{paralist} package provides several approaches to list
compaction:
\begin{itemize}
\item its \environment{asparaenum} environment formats each item as if
  it were a paragraph introduced by the enumeration label (which saves
  space if the item texts are long);
\item its \environment{compactenum} environment is the same sort of
  compact list as is provided in \Package{expdlist} and
  \Package{mdwlist}; and
\item its \environment{inparaenum} environment produces a list ``in
  the paragraph'', i.e., with no line break between items, which is a
  great space-saver if the list item texts are short.
\end{itemize}
The package will manipulate its \environment{enumerate} environment
labels just like the \Qref*{\Package{enumerate} package}{Q-enumerate}
does.

\Package{Paralist} also provides \environment{itemize} equivalents
(\environment{asparaitem}, etc.), and \environment{description}
equivalents (\environment{asparadesc}, etc.).

The ultimate in compaction (of every sort) is offered by the
\Package{savetrees} package; compaction of lists is included.  The
package's prime purpose is to save space at every touch and turn:
don't use it if you're under any design constraint whatever!

The \Package{expdlist}, \Package{mdwlist} and \Package{paralist}
packages all offer other facilities for list configuration: you should
probably not try the ``do-it-yourself'' approaches outlined below if
you need one of the packages for some other list configuration
purpose.

For ultimate flexibility (including manipulation of \cs|topsep|), the
\Package{enumitem} package permits adjustment of list parameters using
a ``\emph{key}\latexhtml{\ensuremath{=}}{=}\meta{value}'' format; so
for example, one might write
\begin{quote}
\begin{verbatim}
\usepackage{enumitem}
...
\begin{enumerate}[topsep=0pt, partopsep=0pt]
\item ...
...
\end{enumerate}
\end{verbatim}
\end{quote}
to suppress all spacing above and below your list.  \Package{Enumitem}
also permits manipulation of the label format in a more ``basic''
manner than the \Qref*{\Package{enumerate} package}{Q-enumerate} does.
%% If you want to adjust \cs|topsep|, the most sensible approach (at
%% present) is to define your list `from first principles' using the
%% \cs|list| command; its invocation is
%% % beware line break
%% \cmdinvoke{list}{\meta{item stuff}}{\meta{list stuff}}; the
%% \texttt{\meta{list stuff}} is executed \emph{after} the
%% \cs|@list|\texttt{\meta{depth}}, and can therefore be used to adjust
%% all the parameters, including \cs|topsep|.
%%
%% An alternative is to redefine \cs|@list|\texttt{\meta{depth}} (and the
%% size-changing commands that alter \cs|@listi|), but this is not
%% recommended unless you're building your own class or package, in which
%% case one hopes you're capable of analysing the way in which the
%% standard classes do things (as recommended in
%% % beware line wrap
%% \Qref[question]{writing your own package}{Q-writecls}).
\begin{ctanrefs}
\item[enumerate.sty]Distributed as part of \CTANref{2etools}
\item[enumitem.sty]Distributed as part of \CTANref{bezos}
\item[expdlist.sty]\CTANref{expdlist}
\item[mdwlist.sty]Distributed as part of \CTANref{mdwtools}
\item[paralist.sty]\CTANref{paralist}
\item[savetrees.sty]\CTANref{savetrees}
\end{ctanrefs}

\Question[Q-interruptlist]{Interrupting enumerated lists}

It's often convenient to have commentary text, `outside' the list,
between successive entries of a list.  In the case of
\environment{itemize} lists this is no problem, since there's never
anything to distinguish successive items, while in the case of
\environment{description} lists, the item labels are under the user's
control so there's no automatic issue of continuity.

For \environment{enumerate} lists, the labels are generated
automatically, and are context-sensitive, so the context (in this
case, the state of the enumeration counter) needs to be preserved.

The belt-and-braces approach is to remember the state of the
enumeration in your own counter variable, and then restore it when
restarting enumerate:
\begin{verbatim}
\newcounter{saveenum}
 ...
\begin{enumerate}
 ...
 \setcounter{saveenum}{\value{enumi}}
\end{enumerate}
<Commentary text>
\begin{enumerate}
 \setcounter{enumi}{\value{saveenum}}
 ...
\end{enumerate}
\end{verbatim}

This is reasonable, in small doses\dots{} Problems (apart from sheer
verbosity) are getting the level right (``should I use counter
\texttt{enumi}, \texttt{enumii}, \dots{}'') and remembering not to
nest the interruptions (i.e., not to have a separate list, that is
itself interrupted) in the ``commentary text'').

The \Package{mdwlist} package defines commands \cs|suspend| and
\cs|resume| that simplify the process:
\begin{verbatim}
\newcounter{saveenum}
 ...
\begin{enumerate}
 ...
\suspend{enumerate}
<Commentary text>
\resume{enumerate}
 ...
\end{enumerate}
\end{verbatim}
The package allows an optional name (as in
\cmdinvoke{suspend}[id]{enumerate}) to allow you to identify a
particular suspension, and hence provide a handle for manipulating
nested suspensions.

If you're suspending a \nothtml{fancy-enumeration list (}%
\Qref{fancy-enumeration list}{Q-enumerate}\nothtml{)}, you need to
re-supply the optional ``item label layout'' parameters required by
the \Package{enumerate} package when resuming the list, whether by the
belt-and-braces approach, or by the \cmdinvoke{resume}{enumerate}
technique.
\begin{ctanrefs}
\item[enumerate.sty]Distributed as part of \CTANref{2etools}
\item[mdwlist.sty]Distributed as part of \CTANref{mdwtools}
\item[paralist.sty]\CTANref{paralist}
\item[savetrees.sty]\CTANref{savetrees}
\end{ctanrefs}

\subsection{Tables, figures and diagrams}

\Question[Q-destable]{The design of tables}

In recent years, several authors have argued that the
examples, set out by Lamport in his \Qref*{\LaTeX{} manual}{Q-books},
have cramped authors' style 
and have led to extremely poor table design.  It is in fact difficult
even to work out what many of the examples in Lamport's book ``mean''.

The criticism focuses on the excessive use of rules (both horizontal
and vertical) and on the poor vertical spacing that Lamport's macros
offer.

The problem of vertical spacing is plain for all to see, and is
addressed in several packages~--- see % beware line breaks
\htmlonly{``}\Qref[question]{spacing of lines in tables}{Q-struttab}\htmlonly{''}.

The argument about rules is presented in the excellent essay that
prefaces the documentation of Simon Fear's \Package{booktabs} package.

Lamport's \LaTeX{} was also inflexibly wrong in ``insisting'' that
captions should come at the bottom of a table.  Since a table may
extend over several pages, traditional typography places the caption
at the top of a table float.  The \cs|caption| command will get its
position wrong (by |10pt|) if you simply write:
\begin{verbatim}
\begin{table}
  \caption{Example table}
  \begin{tabular}{...}
    ...
  \end{tabular}
\end{table}
\end{verbatim}
The \Package{topcapt} package solves this problem:
\begin{verbatim}
\usepackage{topcaption}
...
\begin{table}
  \topcaption{Example table}
  \begin{tabular}{...}
    ...
  \end{tabular}
\end{table}
\end{verbatim}
Doing the job yourself is pretty easy: \Package{topcapt} switches the
values of the \LaTeXe{} parameters \cs|abovecaptionskip| (default
value |10pt|) and \cs|belowcaptionskip| (default value |0pt|), so:
\begin{verbatim}
\begin{table}
  \setlength{\abovecaptionskip}{0pt}
  \setlength{\belowcaptionskip}{10pt}
  \caption{Example table}
  \begin{tabular}{...}
    ...
  \end{tabular}
\end{table}
\end{verbatim}
does the job.  (The package is very slightly more elaborate\dots{})
\begin{ctanrefs}
\item[booktabs.sty]\CTANref{booktabs}
\item[topcapt.sty]\CTANref{topcapt}
\end{ctanrefs}

\Question[Q-fixwidtab]{Fixed-width tables}

There are two basic techniques for making fixed-width tables in
\LaTeX{}: you can make the gaps between the columns stretch, or you
can stretch particular cells in the table.

Basic \LaTeX{} can make the gaps stretch: the \environment{tabular*}
environment 
takes an extra argument (before the |clpr| layout one) which takes a
length specification: you can say things like ``|15cm|'' or
``\cs|columnwidth|'' here.  You must also have an \cs|extracolsep|
command in the |clpr| layout argument, inside an |@{}| directive.  So,
for example, one might have
\begin{htmlversion}
\begin{verbatim}
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}lllr}
\end{verbatim}
\end{htmlversion}
\htmlignore
\ifpdf
\begin{verbatim}
\begin{tabular*}{\columnwidth}{@{\extracolsep{\fill}}lllr}
\end{verbatim}
\else
\begin{verbatim}
\begin{tabular*}{\columnwidth}%
                {@{\extracolsep{\fill}}lllr}
\end{verbatim}
\fi
\endhtmlignore
The \cs|extracolsep| applies to all inter-column gaps to its right as
well; if you don't want all gaps stretched, add
\cmdinvoke{extracolsep}{0pt} to cancel the original.

The \Package{tabularx} package defines an extra |clpr| directive, |X|;
|X| columns behave as |p| columns which expand to fill the space
available.  If there's more than one |X| column in a table, the spare
space is distributed between them.

The \Package{ltxtable} combines the features of the
\Package{longtable} and \Package{tabularx} packages: it's important to
read the documentation, since usage is distinctly odd.
\begin{ctanrefs}
\item[ltxtable.sty]Distributed as part of \CTANref{carlisle}
\item[tabularx.sty]Distributed as part of \CTANref{2etools}
\end{ctanrefs}

\Question[Q-struttab]{Spacing lines in tables}

\AllTeX{} mechanisms for maintaining the space between lines (the
``\emph{leading}'') rely on \TeX{}'s paragraph builder, which compares
the shape of consecutive lines and adjusts the space between them.

These mechanisms can't work in exactly the same way when \AllTeX{} is
building a table, because the paragraph builder doesn't get to see the
lines themselves.  As a result, tables sometimes typeset with lines
uncomfortably close together (or occasionally ridiculously far apart).

Traditional (moving metal type) typographers would adjust the spacing
between lines of a table by use of a ``\emph{strut}'' (a metal
spacer).  A \TeX{} user can do exactly the same thing: most macro
packages define a \cs|strut| command, that defines a space appropriate
to the current size of the text; placing a \cs|strut| command at the
end of a troublesome row is the simplest solution to the problem~---
if it works.  Other solutions below are \LaTeX{}-specific, but some
may be simply translated to Plain~\TeX{} commands.

If your table exhibits a systematic problem (i.e., every row is wrong
by the same amount) use \cs|extrarowheight|, which is defined by the
\Package{array} package:
\begin{verbatim}
\usepackage{array}% in the preamble
...
\setlength{\extrarowheight}{length}
\begin{tabular}{....}
\end{verbatim}

To correct a single row whose maladjustment isn't corrected by a
\cs|strut| command, you can define your own, using
\cmdinvoke{rule}{0pt}{length}~--- which is a near approximation to the
command that goes inside a \cs|strut|.  The \Package{bigstrut} package
defines a strut command that you can use for this purpose:
\cs|bigstrut| on its own opens up both above and below the current
line; \cmdinvoke{bigstrut}[t] opens up above the line,
\cmdinvoke{bigstrut}[b] opens up below the line.

General solutions are available, however.  The \Package{tabls} package
automatically generates an appropriately-sized strut at the end of
each row.  Its disadvantages are that it's really rather slow in
operation (since it gets in the way of everything within tables) and
its (lack of) compatibility with other packages.

The \Package{booktabs} package comes with a thought-provoking essay
about how tables should be designed.  Since table row-spacing problems
most often appear in collisions with rules, the author's thesis,
that \LaTeX{} users tend too often to rule their tables, is
interesting.  The package provides rule commands to support the
author's scheme, but deals with inter-row spacing too.  The most
recent release of \Package{booktabs} sports compatibility with
packages such as \Package{longtable}.

Documentation of both \Package{bigstrut} and \Package{tabls} may be
found as comments in the package files themselves.
\begin{ctanrefs}
\item[array.sty]Distributed as part of \CTANref{2etools}
\item[bigstrut.sty]Distributed as part of \CTANref{multirow}
\item[booktabs.sty]\CTANref{booktabs}
\item[tabls.sty]\CTANref{tabls}
\end{ctanrefs}

\Question[Q-longtab]{Tables longer than a single page}

Tables are, by default, set entirely in boxes of their own: as a
result, they won't split over a page boundary.  Sadly, the world keeps
turning up tables longer than a single page that we need to typeset.

For simple tables (whose shape is highly regular), the simplest
solution may well be to use the \environment{tabbing} environment,
which is slightly tedious to set up, but which doesn't force the whole aligment
onto a single page.

The \Package{longtable} package builds the whole table (in chunks), in
a first pass, and then uses information it has written to the |.aux|
file during later passes to get the setting ``right'' (the package
ordinarily manages to set tables in just two passes).  Since the
package has overview of the whole table at the time it's doing
``final'' setting, the table is set ``uniformly'' over its entire
length, with columns matching on consecutive pages.
\Package{longtable} has a reputation for failing to interwork with
other packages, but it does work with \Package{colortbl}, and its
author has provided the \Package{ltxtable} package to provide (most
of) the facilities of \Package{tabularx} (see
% beware line wrap
\Qref[question]{fixed-width tables}{Q-fixwidtab}) for long tables:
beware of its rather curious usage constraints~--- each long table
should be in a file of its own, and included by
\cmdinvoke*{LTXtable}{width}{file}.  Since \Package{longtable}'s
multiple-page tables can't possibly live inside floats, the package
provides for captions within the \environment{longtable} environment
itself.

A seeming alternative to \Package{ltxtable} is \Package{ltablex}; but
it is outdated and not fully functional.  Its worst problem is its
strictly limited memory capacity (\Package{longtable} is not so
limited, at the cost of much complication in its code);
\Package{ltablex} can only deal with relatively small tables, it doesn't seem
likely that support is available; but its user interface is much
simpler than \Package{ltxtable}, so if its restrictions aren't a
problem for you, it may be worth a try.

The \Package{supertabular} package starts and stops a
\environment{tabular} environment for each page of the table.  As a
result, each `page worth' of the table is compiled independently, and
the widths of corresponding columns may differ on successive pages.
However, if the correspondence doesn't matter, or if your columns are
fixed-width, \Package{supertabular} has the great advantage of doing
its job in a single run.

Both \Package{longtable} and \Package{supertabular} allow definition
of head- and footlines for the table; \Package{longtable} allows
distinction of the first and last head and foot.

The \Package{xtab} package fixes some infelicities of
\Package{supertabular}, and also provides a ``last head'' facility
(though this, of course, destroys \Package{supertabular}'s advantage
of operating in a single run).

The \Package{stabular} package provides a simple-to-use ``extension to
\environment{tabular}'' that allows it to typeset tables that run over
the end of a page; it also has usability extensions, but doesn't have
the head- and footline capabilities of the major packages.

Documentation of \Package{ltablex} is to be found in the package file.
\begin{ctanrefs}
\item[longtable.sty]Distributed as part of \CTANref{2etools}
\item[ltablex.sty]\CTANref{ltablex}
\item[ltxtable.sty]Generate by running \CTANref{ltxtable}
\item[stabular.sty]Distributed as part of \CTANref{sttools}
\item[supertabular.sty]\CTANref{supertabular}
\item[xtab.sty]\CTANref{xtab}
\end{ctanrefs}

\Question[Q-tabcellalign]{How to alter the alignment of tabular cells}

One often needs to alter the alignment of a tabular |p| (`paragraph')
cell, but problems at the end of a table row are common.  If we have a
|p| cell that looks like
\begin{verbatim}
... & \centering blah ... \\
\end{verbatim}
one is liable to encounter errors that complain about a ``misplaced
\cs|noalign|'' (or the like).
The problem is that the command |\||\| means different things in
different circumstances: the \environment{tabular} environment
switches the meaning to a value for use in the table, and
\cs|centering|, \cs|flushright| and \cs|flushleft| all change the
meaning to something incompatible.  Note that the problem only
arises in the last cell of a row: since each cell is set into a box,
its settings are lost at the |&| (or |\||\|) that terminates it.

The simple (old) solution is to preserve the meaning of |\||\|:
\begin{verbatim}
\def\PBS#1{\let\temp=\\%
  #1%
  \let\\=\temp
}
\end{verbatim}
which one uses as:
\begin{verbatim}
... & \PBS\centering blah ... \\
\end{verbatim}
(for example).

The technique using \cs|PBS| was developed in the days of \LaTeXo{}
because the actual value of |\||\| that the \environment{tabular}
environment used was only available as an internal command.  Nowadays,
the value is a public command, and you can in principle use it
explicitly:
\begin{verbatim}
... & \centering blah ... \tabularnewline
\end{verbatim}
but the old trick has the advantage of extreme compactness.

The \cs|PBS| trick also serves well in \Package{array} package ``field
format'' preamble specifications:
\begin{verbatim}
\begin{tabular}{... >{\PBS\centering}p{50mm}}
...
\end{verbatim}
\begin{ctanrefs}
\item[array.sty]Distributed as part of \CTANref{2etools}
\end{ctanrefs}

\Question[Q-textflow]{Flowing text around figures in \LaTeX{}}

There are several \LaTeX{} packages that purport to do this, but they
all have their limitations because the \TeX{} machine isn't really
designed to solve this sort of problem.  Piet van Oostrum has
conducted a survey of the available packages; he recommends:

\begin{description}
\item[\texttt{floatflt}] \Package{floatflt} is an improved version
  (for \LaTeXe{}) of \File|floatfig.sty|, and its syntax is:

\begin{htmlversion}
\begin{verbatim}
\begin{floatingfigure}[options]{width of figure}
   figure contents
\end{floatingfigure}
\end{verbatim}
\end{htmlversion}
  \htmlignore
  |\begin{floatingfigure}[|\emph{options}|]{|\emph{width of figure}|}|\\
  |   |\emph{figure contents}\\
  |\end{floatingfigure}|
  \endhtmlignore

  There is a (more or less similar) \environment{floatingtable} environment.

  The tables or figures can be set left or right, or alternating on
  even/odd pages in a double-sided document.

  The package works with the |multicol| package, but doesn't work well
  in the neighbourhood of list environments (unless you change your
  \LaTeX{} document).
\item[\texttt{wrapfig}] \Package{wrapfig} has syntax:

\begin{htmlversion}
\begin{verbatim}
\begin{wrapfigure}[height of figure in lines]{l|r}[overhang]{width}
  figure, caption, etc.
\end{wrapfigure}
\end{verbatim}
\end{htmlversion}
  \htmlignore
  \ifpdf
  |\begin{wrapfigure}[|\emph{height of figure in lines}|]|%
    |{l|,|r|,\emph{etc}|}|\\
  |                  [|\emph{overhang}|]{|\emph{width}|}|\\
  \else
  |\begin{wrapfigure}[|\emph{height of figure in lines}|]|\\
  |                  {l|,|r|,\emph{etc}|}[|\emph{overhang}|]{|\emph{width}|}|\\
  \fi
  |   |\emph{figure, caption, etc.}\\
  |\end{wrapfigure}|
  \endhtmlignore

  The syntax of the \environment{wraptable} environment is similar.

  Height can be omitted, in which case it will be calculated by the
  package; the package will use the greater of the specified and the
  actual width.  The |{l|\emph{,}|r|\emph{,etc}.|}| parameter can also be
  specified as |i|\emph{(nside)} or |o|\emph{(utside)} for two-sided
  documents, and uppercase can be used to indicate that the picture
  should float.  The overhang allows the figure to be moved into the
  margin.  The figure or table will entered into the list of figures
  or tables if you use the \cs|caption| command.

  The environments do not work within list environments that end
  before the figure or table has finished, but can be used in a parbox
  or minipage, and in twocolumn format.
\item[\texttt{picins}] \Package{Picins} is part of a large bundle
  that allows inclusion of pictures (e.g., with
  shadow boxes, various \MSDOS{} formats, etc.).  The command is:

\begin{htmlversion}
    |\parpic(width,height)(x-off,y-off)[Options][Position]{Picture}|\\
\end{htmlversion}
  \htmlignore
  \ifpdf
  |\parpic(|\emph{width}|,|\emph{height}|)(|\emph{x-off}\kern-.125em|,|\emph{y-off}|)|%
  |[|\emph{Options}|][|\emph{Position}|]|\\
  \else
  |\parpic(|\emph{width}|,|\emph{height}|)(|\emph{x-off}\kern-.125em|,|\emph{y-off}|)|\\
  |       [|\emph{Options}|][|\emph{Position}|]|\\
  \fi
  |       {|\emph{Picture}|}|\\
  \endhtmlignore
  \emph{Paragraph text}

  All parameters except the \emph{Picture} are optional.  The picture
  can be positioned left or right, boxed with a rectangle, oval,
  shadowbox, dashed box, and a caption can be given which will be
  included in the list of figures.

%    This is the only package that I tried that correctly works inside an
%    enumerate/itemize item. It does not, however work with
%    enumerate/itemize besides the picture (i.e. started after the \parpic
%    command) but neither does any of the other packages as far as I could
%    discern.

  Unfortunately (for those of us whose understanding of German is not
  good), the documentation is in German.  Piet van Oostrum has written
  an English summary.
\end{description}
\begin{ctanrefs}
\item[floatflt.sty]\CTANref{floatflt}
\item[picins.sty]\CTANref{picins}
\item[picins \nothtml{\rmfamily}documentation summary]\CTANref{picins-summary}
\item[wrapfig.sty]\CTANref{wrapfig}
\end{ctanrefs}

\Question[Q-slashbox]{Diagonal separation in corner cells of tables}

You want to label both the top or bottom row and the left- or
rightmost column, somewhere at the corner of the table where the row
and column meet.  A simple way to achieve the result is to construct
the table with an arrangement of rules (and possibly \cs|multicolumn|
entries), to look like:
\begin{verbatim}
  -----------------
  x  y
     --------------
     1  2  3  4  5
  -----------------
  1
  2
  3
  4
  5
  -----------------
\end{verbatim}
However, this doesn't satisfy everyone: many want the labelling in a
single cell at the top left of the table.  It sounds a simple enough
requirement, yet it calls for some slightly tricky \LaTeX{} coding.
The \Package{slashbox} package does the job for you: it defines
commands \cs|slashbox| and \cs|backslashbox|, each taking the two
labels as arguments.  It draws a picture with the two labels on either
side of a slanting line; the command (and hence the picture) may be
placed in the corner cell, where the labelled row and column meet.

Documentation of \Package{slashbox} is less than satisfactory: a
\LaTeX{} source file of rather startling starkness accompanies the
package file in the distribution.  It does, however, process to a
\acro{DVI} file that gives some idea of how the \cs|slashbox| may be
expected to look.
\begin{ctanrefs}
\item[slashbox.sty]\CTANref{slashbox}
\end{ctanrefs}

\Question[Q-wholerow]{How to change a whole row of a table}

Each cell of a table is set in a box, so that a change of font style
(or whatever) only lasts to the end of the cell.  If one has a
many-celled table, or a long one which needs lots of rows emphasising,
putting a font style change command in every cell will be impossibly
tedious.

With the \Package{array} package, you can define column modifiers
which will change the font style for a whole \emph{column}.  However,
with a bit of subtlety, one can make such modifiers affect rows rather
than columns.  So, we set things up by:
\begin{quote}
\begin{narrowversion}
\begin{verbatim}
\usepackage{array}
\newcolumntype{$}{>{%
  \global\let\currentrowstyle\relax}%
}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]{%
  \gdef\currentrowstyle{#1}%
  #1\ignorespaces
}
\end{verbatim}
\end{narrowversion}
\begin{wideversion}
\begin{verbatim}
\usepackage{array}
\newcolumntype{$}{>{\global\let\currentrowstyle\relax}}
\newcolumntype{^}{>{\currentrowstyle}}
\newcommand{\rowstyle}[1]{\gdef\currentrowstyle{#1}%
  #1\ignorespaces
}
\end{verbatim}
\end{wideversion}
\end{quote}
Now, we put `|$|' before the first column specifier; and we put `|^|'
before the modifiers of subsequent ones.  We then use \cs|rowstyle| at
the start of each row we want to modify:
\begin{quote}
\begin{verbatim}
\begin{tabular}{|$l|^l|^l|}   \hline
  \rowstyle{\bfseries}
  Heading & Big and & Bold \\ \hline
  Meek & mild & entry      \\
  Meek & mild & entry      \\
  \rowstyle{\itshape}
  Strange & and & italic   \\
  Meek & mild & entry      \\ \hline
\end{tabular}
\end{verbatim}
\end{quote}
The \Package{array} package works with several other
\environment{tabular}-like environments from other packages (for
example \environment{longtable}), but unfortunately this trick won't
always work.
\begin{ctanrefs}
\item[array.sty]Distributed as part of \CTANref{2etools}
\end{ctanrefs}

\Question[Q-multirow]{Merging cells in a column of a table}

It's easy to come up with a table design that requires a cell that
spans several rows.  An example is something where the left-most
column labels the rest of the table; this can be done (in simple
cases) by using % beware line break
\Qref*{diagonal separation in corner cells}{Q-slashbox}, but that
technique rather strictly limits what can be used as the content of
the cell.

The \Package{multirow} package enables you to construct such multi-row
cells, in a very simple manner.  For the simplest possible use, one
might write:
\begin{quote}
\begin{verbatim}
\begin{tabular}{|c|c|}
\hline
\multirow{4}*{Common g text} 
      & Column g2a\\
      & Column g2b \\
      & Column g2c \\
      & Column g2d \\
\hline
\end{tabular}
\end{verbatim}
\end{quote}
and \Package{multirow} will position ``Common g text'' at the vertical
centre of the space defined by the other rows.  Note that the rows
that don't contain the ``multi-row'' specification must have empty
cells where the multi-row is going to appear.

The ``|*|'' may be replaced by a column width specification.  In this
case, the argument may contain forced line-breaks:
\begin{quote}
\begin{verbatim}
\begin{tabular}{|c|c|}
\hline
\multirow{4}{25mm}{Common\\g text} 
      & Column g2a\\
      & Column g2b \\
      & Column g2c \\
      & Column g2d \\
\hline
\end{tabular}
\end{verbatim}
\end{quote}
A similar effect (with the possibility of a little more
sophistication) may be achieved by putting a smaller table that lines
up the text into a |*|-declared \cs|multirow|.

The \cs|multirow| command may also used to write labels vertically
down one or other side of a table (with the help of the
\Package{graphics} or \Package{graphicx} package, which provide the
\cs|rotatebox| command):
\begin{quote}
\begin{verbatim}
\begin{tabular}{|l|l|}
\hline
\multirow{4}*{\rotatebox{90}{hi there}}
      & Column g2a\\
      & Column g2b \\
      & Column g2c \\
      & Column g2d \\
\hline
\end{tabular}
\end{verbatim}
\end{quote}
(which gives text going upwards; use angle |-90| for text going
downwards, of course).

\Package{Multirow} is set up to interact with the \Package{bigstrut}
package (which is also discussed in the answer to % beware line break
\Qref[question]{spacing lines in tables}{Q-struttab}).  You use an
optional argument to the \cs|multirow| command to say how many
of the rows in the multi-row have been opened up with \cs|bigstrut|.

The documentation of both \Package{multirow} and \Package{bigstrut} is
to be found, as comments, in the package files themselves.
\begin{ctanrefs}
\item[bigstrut.sty]Distributed as part of \CTANref{multirow}
\item[multirow.sty]\CTANref{multirow}
\end{ctanrefs}

\subsection{Floating tables, figures, etc.}

\Question[Q-floatpages]{Floats on their own on float pages}

It's sometimes necessary to force a float to live on a page by itself.
(It's sometimes even necessary for \emph{every} float to live on a
page by itself.)  When the float fails to `set', and waits for the end
of a chapter or of the document, the natural thing to do is to declare
the float as
\begin{verbatim}
  \begin{figure}[p!]
\end{verbatim}
but the overriding |!| modifier has no effect on float page floats; so
you have to make the float satisfy the parameters.
\Qref[Question]{Moving tables and figures}{Q-floats} offers some
suggestions, but doesn't solve the one-float-per-page question.

The `obvious' solution, using the counter |totalnumber| (``total
number of floats per page'') doesn't work:
|totalnumber| only applies to floats on `text' pages (pages containing
text as well as one or more float).  So, to allow any
size float to take a whole page, set \cs|floatpagefraction| really
small, and to ensure that no more than one float occupies a page, make
the separation between floats really big:
\begin{verbatim}
  \renewcommand\floatpagefraction{.001}
  \makeatletter
  \setlength\@fpsep{\textheight}
  \makeatother
\end{verbatim}

\Question[Q-vertspacefloat]{Extra vertical space in floats}

A common complaint is that extra vertical space has crept into
\environment{figure} or \environment{table} floating environments.
More common still are users who post code that introduces this extra
space, and \emph{haven't noticed the problem}!

The trouble arises from the fact that the \environment{center}
environment (and its siblings \environment{flushleft} and
\environment{flushright}) are actually based on \LaTeX{}'s
list-handling code; and lists always separate themselves from the
material around them.  Meanwhile, there are parameters provided to
adjust the spacing between floating environments and their
surroundings; so if we have:
\begin{verbatim}
\begin{figure}
 \begin{center}
  \includegraphics{...}
  \caption{...}
 \end{center}
\end{figure}
\end{verbatim}
\nothtml{\noindent}or worse still:
\begin{verbatim}
\begin{figure}
 \begin{center}
  \includegraphics{...}
 \end{center}
 \caption{...}
\end{figure}
\end{verbatim}
unwarranted vertical space is going to appear.

The solution is to let the float and the objects in it position
themselves, and to use ``generic'' layout commands rather than their
list-based encapsulations.
\begin{verbatim}
\begin{figure}
 \centering
 \includegraphics{...}
 \caption{...}
\end{figure}
\end{verbatim}
(which even involves less typing).

This alternative code will work with any \LaTeX{} package.  It will
not work with obsolete (pre-\LaTeXe{}) packages such as
\Package{psfig} or \Package{epsf}~--- see % beware line break
\Qref[question]{graphics inclusion}{Q-impgraph} for discussion of the
genesis of \cs|includegraphics|.

\Question[Q-2colfloat]{Placing two-column floats at bottom of page}

You specified placement `|[htbp]|' for your full-width figure or
table, but they always get placed at the top of the page\dots{}  Well,
it \emph{is} what the documentation says: \LaTeX{}, unadorned, only
allows full-width floats at the top of a page, or occupying (part of) a
float page.

The \Package{stfloats} package ameliorates the situation somewhat, and
makes \LaTeX{} honour `[b]' placement as well.

The \acro{FAQ} team doesn't know of any package that will make
\LaTeX{} honour `[h]' placement of double-column floats, but the
\Package{midfloat} package can be pressed into service to provide
something approximating the effect it would have.
\begin{ctanrefs}
\item[stfloats.sty, midfloat.sty]Distributed as part of \CTANref{sttools}
\end{ctanrefs}

\Question[Q-mcfloat]{Floats in multicolumn setting}

If you use
\begin{verbatim}
\begin{figure}
  ...
\end{figure}
\end{verbatim}
in a \environment{multicols} environment, the figure won't appear.  If
instead you use
\begin{verbatim}
\begin{figure*}
  ...
\end{figure*}
\end{verbatim}
the figure will stretch right across the page (just the same as a
\environment{figure*} in standard \LaTeX{}'s |twocolumn| option).

It's possible to have single-column figures and tables with captions,
using the `|[H]|' placement option introduced by the \Package{float}
package but you might have to fiddle with the placement because they
won't `float', and exhibit other strange behaviours (such as silently
running off the end of the column at the end of the
\environment{multicols} environment.
\begin{ctanrefs}
\item[float.sty]\CTANref{float}
\item[multicol.sty]Distributed as part of \CTANref{2etools}
\end{ctanrefs}

\Question[Q-dpfloat]{Facing floats on 2-page spread}

If a pair of floats are to be forced to form a 2-page spread (in a
book, or whatever), the first must lie on the left side of the spread,
on an even-numbered page.  The \Package{dpfloat} package provides for
this: the construction to use is:
\begin{quote}
\begin{verbatim}
\begin{figure}[p]
  \begin{leftfullpage}
    <left side figure>
  \end{leftfullpage}
\end{figure}
\begin{figure}[p]
  \begin{fullpage}
    <right side figure>
  \end{fullpage}
\end{figure}
\end{verbatim}
\end{quote}
The construction has no effect unless the standard class option
\pkgoption{twoside} is in effect.

Full documentation of the package (such as it is) is to be found in
\File|README.dpfloat|
\begin{ctanrefs}
\item[dpfloat.sty]\CTANref{dpfloat}
\end{ctanrefs}

\Question[Q-vertposfp]{Vertical layout of float pages}

By default, \LaTeX{} vertically centres the floats on a float page;
the present author is not alone in not liking this arrangement.
Unfortunately, the control of the positioning is ``buried'' in
\LaTeX{}-internal commands, so some care is needed to change the
layout.

Float pages use three \LaTeX{} lengths (i.e., \TeX{} skips) to define
their layout:
\begin{description}
\item[\nothtml{\normalfont}\cs|@fptop|] defines the distance from the top of
  the page to the top of the first float,
\item[\nothtml{\normalfont}\cs|@fpsep|] defines the separation between floats,
  and
\item[\nothtml{\normalfont}\cs|@fpbot|] defines the distance from the bottom
  of the last float on the page to the bottom of the page.
\end{description}
(In fact, the output routine places \cs|@fpsep| above each float, so
\cs|@fptop| ordinarily contains a correction for that.)

The \LaTeX{} defaults are:\\
\cs|@fptop| = (|0pt + 1fil|) \latexhtml{$-$}{-} \cs|@fpsep|\\
\cs|@fpsep| = |8pt + 2fil|\\
\cs|@fpbot| = |0pt + 1fil|\\
so that the gaps expand to fill the space not occupied by floats, but
if there is more than one float on the page, the gap between them will
expand to twice the space at top and bottom.

Those who understand this stuff will be able to play elaborate games,
but the commonest requirement, that the floats start at the top of the
page, is a simple thing to do:
\begin{verbatim}
\makeatletter
\setlength{\@fptop}{-\@fpsep}
\makeatother
\end{verbatim}
Note that this is a ``global'' setting (best established in a class
file, or at worst in the document preamble); making the change for a
single float page is likely (at the least) to be rather tricky.

\subsection{Footnotes}

\Question[Q-footintab]{Footnotes in tables}

The standard \LaTeX{} \cs|footnote| command doesn't work in tables; the table
traps the footnotes and they can't escape to the bottom of the page.

If your table is floating, your best bet is (unfortunately) to put the
table in a \environment{minipage} environment and to put the notes
underneath the table, or to use Donald Arseneau's package
\Package{threeparttable} (which implements ``table notes'' proper).

The \Package{ctable} package extends the model of
\Package{threeparttable}, and also uses the ideas of the
\Package{booktabs} package.  The \cs|ctable| command does the complete
job of setting the table, placing the caption, and defining the
notes.  The ``table'' may consist of diagrams, and a parameter in
\cs|ctable|'s optional argument makes the float that is created a
``figure'' rather than a ``table''.

Otherwise, if your table is not floating (it's just a
`|tabular|' in the middle of some text), there are several
things you can do to fix the problem.
\begin{enumerate}
\item Use \cs|footnotemark| to position the little marker
  appropriately, and then put in \cs|footnotetext| commands to fill in
  the text once you've closed the \environment{tabular} environment.  This is
  described in Lamport's book, but it gets messy if there's more than
  one footnote.
\item Stick the table in a |minipage| anyway.  This provides
  all the ugliness of footnotes in a minipage with no extra effort.
\item Use \Package{threeparttable} anyway;
  the package is intended for floating tables, and the result might
  look odd if the table is not floating, but it will be reasonable.
\item Use \Package{tabularx} or \Package{longtable} from the \LaTeX{} tools
  distribution; they're noticeably less
  efficient than the standard \environment{tabular} environment, but they
  do allow footnotes.
\item Grab hold of \Package{footnote}, and put your \environment{tabular}
  environment inside a \environment{savenotes} 
  environment.  Alternatively, say \cmdinvoke{makesavenoteenv}{tabular} in
  the preamble of your document, and tables will all handle footnotes
  correctly.
\item Use \Package{mdwtab} from the same bundle; it will handle
  footnotes properly, and has other facilities to 
  increase the beauty of your tables.  It may also cause other
  table-related packages (not the standard `tools' ones, though) to
  become very unhappy and stop working.
\end{enumerate}

The documentation of \Package{threeparttable} appears in the package
file itself; that of \Package{ctable} is distributed as a \acro{PDF}
file (for convenience's sake).
\begin{ctanrefs}
\item[ctable.sty]\CTANref{ctable}
\item[footnote.sty]Distributed as part of \CTANref{mdwtools}
\item[longtable.sty]Distributed as part of \CTANref{2etools}
\item[mdwtab.sty]Distributed as part of \CTANref{mdwtools}
\item[threeparttable.sty]\CTANref{threeparttable}
\item[tabularx.sty]Distributed as part of \CTANref{2etools}
\end{ctanrefs}

\Question[Q-ftnsect]{Footnotes in \LaTeX{} section headings}

The \cs|footnote| command is fragile, so that simply placing the
command in \cs|section|'s arguments isn't satisfactory.  Using
\cs|protect|\cs|footnote| isn't a good idea either: the arguments of a
section command are used in the table of contents and (more
dangerously) potentially also in page headings.  Unfortunately,
there's no mechanism to suppress the footnote in the heading while
allowing it in the table of contents, though having footnotes in the
table of contents is probably unsatisfactory anyway.

To suppress the footnote in headings and table of contents:
\begin{itemize}
\item Take advantage of the fact that the mandatory argument doesn't
  `move' if the optional argument is present:
  |\section[title]{title|\cs|footnote||{title ftnt}}|
\item Use the \Package{footmisc} package, with package option
  |stable|~--- this modifies footnotes so that they softly and silently
  vanish away if used in a moving argument.
\end{itemize}
\begin{ctanrefs}
\item[footmisc.sty]\CTANref{footmisc}
\end{ctanrefs}

\Question[Q-ftncapt]{Footnotes in captions}

Footnotes in captions are especially tricky: they present problems of
their own, on top of the problems one experiences with
% beware line breaks (4 lines!)
\nothtml{footnotes in section titles (}%
\Qref{footnotes in section titles}{Q-ftnsect}\nothtml{)} and with
\nothtml{footnotes in tables (}%
\Qref{footnotes in tables}{Q-footintab}\nothtml{)}.

So \emph{as well as} using the optional argument of \cs|caption| (or
whatever) to avoid the footnote migrating to the List of \dots{}, and
putting the object whose caption bears the footnote in a minipage, one
\emph{also} has to deal with the tendency of the \cs|caption| command
to produce the footnote's text twice.  For this last problem, there is
no tidy solution this author is aware of.  If you're suffering the
problem, a well-constructed \cs|caption| command in a \environment{minipage}
environment within a float, such as:
\begin{verbatim}
\begin{figure}
  \begin{minipage}{\textwidth}
    ...
    \caption[Caption for LOF]%
      {Real caption\footnote{blah}}
  \end{minipage}
\end{figure}
\end{verbatim}
can produce \emph{two} copies of the footnote body ``blah''.  (In
fact, the effect occurs with captions that are long enough to require
two lines to be typeset, and so wouldn't appear with such a short
caption.)  The \Package{ccaption} package's documentation describes a
really rather awful work-around.
\begin{ctanrefs}
\item[ccaption.sty]\CTANref{ccaption}
\end{ctanrefs}

\Question[Q-repfootnote]{Footnotes whose texts are identical}

If the \emph{same} footnote turns up at several places within a
document, it's often inappropriate to repeat the footnote in its
entirety over and over again.  We can avoid repetition by
semi-automatic means, or by simply labelling footnotes that we know
we're going to repeat and then referencing the result.  There is no
completely automatic solution (that detects and suppresses repeats)
available.

If you know you only have one footnote, which you want to repeat, the
solution is simple: merely use the optional argument of
\cs|footnotemark| to signify the repeats:
\begin{verbatim}
  ...\footnote{Repeating note}
  ...
  ...\footnotemark[1]
\end{verbatim}
\dots{}\@ which is very easy, since we know there will only ever be a
footnote number 1.  A similar technique can be used once the footnotes
are stable, reusing the number that \LaTeX{} has allocated.  This can
be tiresome, though, as any change of typesetting could change the
relationships of footnote and repeat: labelling is inevitably better.

Simple hand-labelling of footnotes is possible, using a counter dedicated
to the job:
\begin{verbatim}
  \newcounter{fnnumber}
  ...
  ...\footnote{Text to repeat}%
  \setcounter{fnnumber}{\thefootnote}%
  ...
  ...\footnotemark[\thefnnumber]
\end{verbatim}
but this is somewhat tedious.  \LaTeX{}'s labelling mechanism can be
summoned to our aid, but there are ugly error messages before the
\cs|ref| is resolved on a second run through \LaTeX{}:
\begin{verbatim}
  ...\footnote{Text to repeat\label{fn:repeat}}
  ...
  ...\footnotemark[\ref{fn:repeat}]
\end{verbatim}
Alternatively, one may use the \cs|footref| command, which has the
advantage of working even when the footnote mark isn't expressed as a
number.  The command is defined in the \Package{footmisc} package and
in the \Class{memoir} class (at least); \cs|footref| reduces the above
example to:
\begin{verbatim}
  ...\footnote{Text to repeat\label{fn:repeat}}
  ...
  ...\footref{fn:repeat}
\end{verbatim}
This is the cleanest simple way of doing the job.  Note that the
\cs|label| command \emph{must} be inside the argument of
\cs|footnote|.

The \Package{fixfoot} package takes away some of the pain of the
matter: you declare footnotes you're going to reuse, typically in the
preamble of your document, using a \cs|DeclareFixedFoot| command, and
then use the command you've `declared' in the body of the document:
\begin{verbatim}
  \DeclareFixedFootnote{\rep}{Text to repeat}
  ...
  ...\rep{}
  ...\rep{}
\end{verbatim}
The package ensures that the repeated text appears at most once per
page: it will usually take more than one run of \LaTeX{} to get rid of
the repeats.
\begin{ctanrefs}
\item[fixfoot.sty]\CTANref{fixfoot}
\item[footmisc.sty]\CTANref{footmisc}
\item[memoir.cls]\CTANref{memoir}
\end{ctanrefs}

\Question[Q-multfoot]{More than one sequence of footnotes}

The need for more than one series of footnotes is common in critical
editions (and other literary criticism), but occasionally arises in
other areas.

Of course, the canonical critical edition macros, \Package{edmac},
offer the facility.

Multiple ranges of footnotes are offered to \LaTeX{} users by the
\Package{manyfoot} package.  The package provides a fair array of
presentation options, as well.
\begin{ctanrefs}
\item[edmac]\CTANref{edmac}
\item[manyfoot.sty]Distributed as part of the \CTANref{ncctools} bundle
\end{ctanrefs}

\Question[Q-footnpp]{Footnotes numbered ``per page''}

The obvious solution is to make the footnote number reset whenever the
page number is stepped, using the % ! line break
\Qref*{\LaTeX{} internal mechanism}{Q-addtoreset}.  Sadly, the place
in the document where the page number is stepped is unpredictable, not
(``tidily'') at the end of the printed page; so the link only ever
works by luck.

As a result, resetting footnotes is inevitably a two-pass process,
using labels of some sort.  It's nevertheless important, given the
common requirement for footnotes marked by symbols (with painfully
small symbol sets).  There are three packages that manage it, one way
or another.

The \Package{footnpag} package does per-page footnotes and nothing
else.

The \Package{perpage} package provides a general mechanism for
resetting counters per page, so can obviously be used for this task.
The interface is pretty simple: \cmdinvoke{MakePerPage}{footnote} will
do the job.  If you want to restart the counter at something other
than~1 (for example to avoid something in the \LaTeX{} footnote symbol
list), you can use: \cmdinvoke{MakePerPage}[2]{footnote}.

The \Package{footmisc} package provides a variety of means of
controlling footnote appearance, among them a package option
\pkgoption{perpage} that adjusts the numbering per page.

Documentation of \Package{footnpag} comes as a |.dvi| file
\File{footnpag-user} in the distribution.  Documentation of
\Package{perpage} appears in the package file, only: however, it
amounts to no more than appears above\dots
\begin{ctanrefs}
\item[footmisc.sty]\CTANref{footmisc}
\item[footnpag.sty]\CTANref{footnpag}
\item[perpage.sty]\CTANref{perpage}
\end{ctanrefs}

\subsection{Document management}

\Question[Q-filename]{What's the name of this file}

One might want this so as to automatically generate a page header or
footer recording what file is being processed.  It's not easy\dots{}

\TeX{} retains what it considers the name of the \emph{job}, only, in
the primitive \cs|jobname|; this is the name of the file first
handed to \TeX{}, stripped of its directory name and of any extension
(such as |.tex|).  If no file was passed (i.e., you're using \TeX{}
interactively), \cs|jobname| has the value |texput| (the name that's
given to |.log| files in this case).

This is fine, for the case of a small document, held in a single file;
most significant documents will be held in a bunch of files, and
\TeX{} makes no attempt to keep track of files input to the
\emph{job}.  So the user has to keep track, himself~--- the only way
is to patch the input commands and cause them to retain details of the
file name.  This is particularly difficult in the case of Plain
\TeX{}, since the syntax of the \cs|input| command is so peculiar.

In the case of \LaTeX{}, the input commands have pretty regular
syntax, and the simplest
% beware line-breaks (next two lines)
\nothtml{patching techniques (}%
\Qref{patching techniques}{Q-patch}\nothtml{)} can be used on them:
\begin{verbatim}
  \def\ThisFile{\jobname}
  \newcounter{FileStack}
  \let\OrigInput\input
  \renewcommand{\input}[1]{%
    \stepcounter{FileStack}
    \expandafter\let
      \csname NameStack\theFileStack\endcsname
      \ThisFile
    \def\ThisFile{#1}%
    \OrigInput{#1}%
    \expandafter\let\expandafter
      \ThisFile
      \csname NameStack\theFileStack\endcsname
    \addtocounter{FileStack}{-1}%
  }
\end{verbatim}
(And similarly for \cs|include|.)  The code assumes you always use
\LaTeX{} syntax for \cs|input|, i.e., always use braces around the
argument.

The \Package{FiNK} (``File Name Keeper'') package provides a
regular means of keeping track of the current file name (with its
extension), in a macro \cs|finkfile|.  The bundle includes a
\File|fink.el| that provides support under \ProgName{emacs} with
\acro{AUC}-\TeX{}.
\begin{ctanrefs}
\item[fink.sty]\CTANref{fink}
\end{ctanrefs}

\Question[Q-filesused]{All the files used by this document}

When you're sharing a document with someone else (perhaps as part of a
co-development cycle) it's as well to arrange that both correspondents
have the same set of auxiliary files, as well as the document in
question.  Your correspondent obviously needs the same set of files
(if you use the \Package{url} package, she has to have \Package{url}
too, for example).  But suppose you have a bug-free version of the
\Package{shinynew} package but her copy is still the unstable
original; until you both realise what is happening, such a situation
can be very confusing.

The simplest solution is the \LaTeX{} \cs|listfiles| command.  This
places a list of the files used and their version numbers in the log
file.  If you extract that list and transmit it with your file, it can
be used as a check-list in case that problems arise.

Note that \cs|listfiles| only registers things that are input by the
``standard'' \LaTeX{} mechanisms (\cs|documentclass|, \cs|usepackage|,
\cs|input|, \cs|include|, \cs|includegraphics| and so on).  But if you
use \TeX{} primitive syntax, as in
\begin{verbatim}
  \input mymacros
\end{verbatim}
\File|mymacros.tex| \emph{won't} be listed by \cs|listfiles|, since
you've bypassed the mechanism that records its use.

The \Package{snapshot} package helps the owner of a \LaTeX{} document
obtain a list of the external dependencies of the document, in a form
that can be embedded at the top of the document.  The intended use of
the package is the creation of archival copies of documents, but it
has application in document exchange situations too.

The \ProgName{bundledoc} system uses \cs|listfiles| to produce an
archive (e.g., |.tar.gz| or |.zip|) of the files needed by your
document; it comes with configuration files for use with
\ProgName{teTeX} and \ProgName{mikTeX}.  It's plainly useful when
you're sending the first copy of a document.
\begin{ctanrefs}
\item[bundledoc]\CTANref{bundledoc}
\item[snapshot.sty]\CTANref{snapshot}
\end{ctanrefs}

\Question[Q-changebars]{Marking changed parts of your document}

One often needs clear indications of how a document has changed, but
the commonest technique, ``change bars'' (also known as ``revision
bars''), requires surprisingly much
trickery of the programmer (the problem being that \TeX{} `proper'
doesn't provide the programmer with any information about the
``current position'' from which a putative start- or end-point of a
bar might be calculated; \PDFTeX{} \emph{does} provide the
information, but we're not aware yet of any programmer taking
advantage of the fact to write a \PDFTeX{}-based changebar package).

The simplest package that offers change bars is Peter Schmitt's
\Package{backgrnd.tex}; this was written as a Plain \TeX{} application
that patches the output routine, but it appears to work at least on
simple \LaTeX{} documents.  Wise \LaTeX{} users will be alerted by the
information that \Package{backgrnd} patches their output routine, and
will watch its behaviour very carefully (patching the \LaTeX{} output
routine is not something to undertake lightly\dots{}).

The longest-established solution is the \Package{changebar} package,
which uses \cs|special| commands supplied by the driver you're using.
You need therefore to tell the package which driver to generate
\cs|special|s for (in the same way that you need to tell the
\Package{graphics} package); the list of available drivers is pretty
restricted, but does include \ProgName{dvips}.  The package comes with
a shell script \ProgName{chbar.sh} (for use on Unix machines) that
will compare two documents and generate a third which is marked-up
with \Package{changebar} macros to highlight changes.  The (excellent)
shareware \ProgName{WinEDT} editor has a macro that will generate
\Package{changebar} (or other) macros to show differences from an
earlier version of your file, stored in an
\ProgName{RCS}-controlled repository~--- see
\URL{http://www.winedt.org/Macros/LaTeX/RCSdiff.php}

The \Package{vertbars} package uses the techniques of the
\Package{lineno} package (which must be present); it's thus the
smallest of the packages for change bar marking, since it leaves all
the trickery to another package.
\begin{ctanrefs}
\item[backgrnd.tex]\CTANref{backgrnd}
\item[changebar.sty]\CTANref{changebar}
\item[lineno.sty]\CTANref{lineno}
\item[vertbars.sty]\CTANref{vertbars}
\end{ctanrefs}

\Question[Q-conditional]{Conditional compilation and ``comments''}

While \LaTeX{} (or any other \TeX{}-derived package) isn't really like a
compiler, people regularly want to do compiler-like things using it.
Common requirements are conditional `compilation' and `block
comments', and several \LaTeX{}-specific means to this end are available.

The simple \cmdinvoke{newcommand}{\cs|gobble|}[1]|{||}| and % beware line break
\cs|iffalse|| ... |\cs|fi| aren't really satisfactory (as a general
solution) for comments, since the matter being skipped is nevertheless
scanned by \TeX{}.  The scanning imposes restrictions one what you're
allowed to skip; this may not be a problem in \emph{today's} job, but
could return to bite you tomorrow.  Furthermore, \cs|gobble| is pretty
inefficient for any but trivial arguments, since all the matter to be
skipped is copied to the argument stack before being ignored.

If your requirement is for a document from which whole chapters (or
the like) are missing, consider the \LaTeX{}
\cs|include|/\cs|includeonly| system.  If you `\cs|include|' your
files (rather than \cs|input| them~--- see 
% beware line wrap here
\Qref[question]{What's going on in my \cs|include| commands?}{Q-include}),
\LaTeX{} writes macro traces of what's going on at the end of each
chapter to the |.aux| file; by using \cs|includeonly|, you can give
\LaTeX{} an exhaustive list of the files that are needed.  Files that
don't get \cs|include|d are skipped entirely, but the document
processing continues as if they \emph{were} there, and page, footnote,
and other numbers are not disturbed.  Note that you can choose which
sections you want included interactively, using the
\Package{askinclude} package.

The inverse can be done using the \Package{excludeonly} package: this
allows you to exclude a (list of) \cs|include|d files from your
document, by means of an \cs|excludeonly| command.

If you want to select particular pages of your document, use Heiko
Oberdiek's \Package{pagesel} or the \Package{selectp} packages.  You
can do something similar with an existing \acro{PDF} document (which
you may have compiled using \ProgName{pdflatex} in the first place),
using the \Package{pdfpages} package.  The job is then done with a
document looking like:
\begin{verbatim}
  \documentclass{article}
  \usepackage[final]{pdfpages}
  \begin{document}
  \includepdf[pages=30-40]{yoursource.pdf}
  \end{document}
\end{verbatim}
(To include all of the document, you write
\begin{verbatim}
  \includepdf[pages=-]{yoursource.pdf}
\end{verbatim}
omitting the start and end pages in the optional argument.)

If you want flexible facilities for including or excluding small
portions of a file, consider the \Package{comment}, \Package{version} or
\Package{optional} packages.

\Package{comment} allows you to declare areas of a document to be
included or excluded; you make these declarations in the preamble of
your file.  The command \cmdinvoke*{includeversion}{version-name}
declares an environment \environment{version-name} whose content will
be included in your document, while
\cmdinvoke*{excludeversion}{version-name} defines an environment whose
content will be excluded from the document.  The package uses a method
for exclusion that is pretty robust, and can cope with ill-formed
bunches of text (e.g., with unbalanced braces or \cs|if| commands).

\Package{version} offers similar facilities to \File{comment.sty}
(i.e., \cs|includeversion| and \cs|excludeversion| commands);
it's far ``lighter weight'', but is less robust (and in particular,
cannot deal with very large areas of text being included/excluded).

A significant development of \Package{version}, confusingly called
\Package{versions} (i.e., merely a plural of the old package name).
\Package{Versions} adds a command
\cmdinvoke*{markversion}{version-name} which defines an environment
that prints the included text, with a clear printed mark around it.

\Package{optional} defines a command \cs|opt|; its first argument is
an `inclusion flag', and its second is text to be included or
excluded.  Text to be included or excluded must be well-formed
(nothing mismatched), and should not be too big~--- if a large body of
text is needed, \cs|input| should be used in the argument.
The documentation (in the package file itself) tells you
how to declare which sections are to be included: this can be done in
the document preamble, but the documentation also suggests ways in
which it can be done on the command line that invokes \LaTeX{}, or
interactively.

Finally, \Package{verbatim} (which should be available
in any distribution) defines a \environment{comment} environment, which
enables the dedicated user of the source text editor to suppress bits of
a \LaTeX{} source file.
\begin{ctanrefs}
\item[askinclude.sty]\CTANref{askinclude}
\item[comment.sty]\CTANref{comment}
\item[excludeonly.sty]\CTANref{excludeonly}
\item[optional.sty]\CTANref{optional}
\item[pagesel.sty]Distributed with Heiko Oberdiek's packages
  \CTANref{oberdiek}
\item[pdfpages.sty]\CTANref{pdfpages}
\item[selectp.sty]\CTANref{selectp}
\item[verbatim.sty]Distributed as part of \CTANref{2etools}
\item[version.sty]\CTANref{version}
\item[versions.sty]\CTANref{versions}
\end{ctanrefs}

\Question[Q-docotherdir]{Bits of document from other directories}

A common way of constructing a large document is to break it into a
set of files (for example, one per chapter) and to keep everything
related to each of these subsidiary files in a subdirectory.

Unfortunately, \TeX{} doesn't have a changeable ``current directory'',
so that all files you refer to have to be specified relative to the
same directory as the main file.  Most people find this
counter-intuitive.

It may be appropriate to use the ``path extension'' technique
% beware line break
\Qref[of question]{used in temporary installations}{Q-tempinst} to deal with
this problem.  However, if there several files with the same name in
your document, such as \File{chapter1/fig1.eps} and
\File{chapter2/fig1.eps}, you're not giving \TeX{} any hint as to
which you're referring to when in the main chapter file you say
\cmdinvoke{input}{sect1}; while this is readily soluble in the case of
human-prepared files (just don't name them all the same),
automatically produced files have a way of having repetitious names,
and changing \emph{them} is a procedure prone to error.

The \Package{import} package comes to your help here: it defines an
\cs|import| command that accepts a full path name and the name of a
file in that directory, and arranges things to ``work properly''.
So, for example, if \File|/home/friend/results.tex| contains
\begin{verbatim}
  Graph: \includegraphics{picture}
  \input{explanation}
\end{verbatim}
then \cmdinvoke{import}{/home/friend/}{results} will include both
graph and explanation as one might hope.  A \cs|subimport| command
does the same sort of thing for a subdirectory (a relative path rather
than an absolute one), and there are corresponding \cs|includefrom|
and \cs|subincludefrom| commands.
\begin{ctanrefs}
\item[import.sty]\CTANref{import}
\end{ctanrefs}

\Question[Q-RCS]{Version control using \acro{RCS} or \acro{CVS}}

If you use \acro{RCS} or \acro{CVS} to maintain your \AllTeX{}
documents under version control, you may need some mechanism for
including the \acro{RCS} keywords in your document, in such a way that
they can be typeset (that is, rather than just hiding them inside a
comment).

The most complete solution is to use the (\LaTeX{}) package
\Package{rcs}, which allows you to parse and display the contents of
\acro{RCS} keyword fields in an extremely flexible way.  The package
rcsinfo is simpler, but does most of what you want, and some people
prefer it; it is explicitly compatible with \ProgName{LaTeX2HTML}.

If, however, you need a solution which works without using external
packages, or which will work in plain TeX, then you can use the
following minimal solution:
\htmlignore
\begin{pdfversion}
\begin{verbatim}
  \def\RCS$#1: #2 ${\expandafter\def\csname RCS#1\endcsname{#2}}
  \RCS$Revision: 1.124 $ % or any RCS keyword
  \RCS$Date: 2003/11/19 09:31:18 $
  ...
  \date{Revision \RCSRevision, \RCSDate}
\end{verbatim}
\end{pdfversion}
\begin{dviversion}
\begin{verbatim}
  \def\RCS$#1: #2 ${\expandafter
    \def\csname RCS#1\endcsname{#2}%
  }
  \RCS$Revision: 1.124 $ % or any RCS keyword
  \RCS$Date: 2003/11/19 09:31:18 $
  ...
  \date{Revision \RCSRevision, \RCSDate}
\end{verbatim}
\end{dviversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
  \def\RCS$#1: #2 ${\expandafter\def\csname RCS#1\endcsname{#2}}
  \RCS$Revision: 1.124 $ % or any RCS keyword
  \RCS$Date: 2003/11/19 09:31:18 $
  ...
  \date{Revision \RCSRevision, \RCSDate}
\end{verbatim}
\end{htmlversion}
\begin{ctanrefs}
\item[rcs.sty]\CTANref{rcs}
\item[rcsinfo.sty]\CTANref{rcsinfo}
\end{ctanrefs}

\Question[Q-make]{Makefiles for \LaTeX{} documents}

\LaTeX{} is a tricky beast for running \ProgName{make} on: the need to
instruct \LaTeX{} to run several times for essentially different
reasons (for example, ``get the table of contents stable'', ``get the
labels stable'', ``add the bibliography'', ``add the index'') is
actually rather difficult to express in the `ordinary' sort of
dependency graph that one constructs for \ProgName{make}.

For this reason, the only \ProgName{make}-like package on \acro{CTAN}
(for a long time) was \ProgName{latexmk}, which is a \ProgName{Perl}
script that analyses your \LaTeX{} source for its dependencies, runs
\BibTeX{} or \ProgName{makeindex} as and when it notices that those
programs' input (parts of the |.aux| file, or the |.idx| file,
respectively) has changed, and so on.  \ProgName{Latexmk} is a fine
solution (and was used in generating printable versions of these
\acro{FAQ}s for a long time); it has recently been upgraded and has
many bells and whistles that allow it to operate as if it were a poor
man's \WYSIWYG{} system.

The \nothtml{\Package{texinfo} system (}% beware line breaks
\Qref{\Package{texinfo} system}{Q-texinfo}\nothtml{)} comes with a
utility called \ProgName{texi2dvi}, which is capable of ``converting''
either \LaTeX{} or \Package{texinfo} files into \acro{DVI} (or into
\acro{PDF}, using \PDFTeX{}).

A later contribution is the bundle \Package{latexmake}, which
offers a set of \ProgName{make} rules that invoke \ProgName{texi2dvi}
as necessary.

The curious may examine the rules employed to run the present
\acro{FAQ} through \LaTeX{}: we don't present them as a complete
solution, but some of the tricks employed are surely re-usable.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\acro{FAQ} distribution]\CTANref{faq}
\item[\nothtml{\rmfamily}latexmake]\CTANref{latexmake}
\item[latexmk]\CTANref{latexmk}
\item[texi2dvi]Distributed as part of \CTANref{texinfo}
\end{ctanrefs}

\Question[Q-howmanypp]{How many pages are there in my document?}

Simple documents (those that start at page 1, and don't have any
breaks in their page numbering until their last page) present no
problem to the seeker after this truth.  The number of pages is
reported by the \Package{lastpage} package in its |LastPage| label.

For more complicated documents (most obviously, books with frontmatter
in a different series of page numbers) this simple approach will not
do.

The \Package{count1to} package defines a label |TotalPages|; this is
the value of its copy of \cs|count||1| (a reserved \TeX{} count
register) at the end of the document.

Package \Package{totpages} defines a label |TotPages|, but it also
makes the register it uses available as a \LaTeX{} counter,
|TotPages|, which you can also reference via \cs|theTotPages|.  Of
course, the counter |TotPages| is asynchronous in the same way that
apge numbers are, but snapshots may safely be taken in the output
routine.

Both \Package{count1to} and \Package{totpages} need the support of
the \Package{everyshi} package.
\begin{ctanrefs}
\item[count1to.sty \latexhtml{{\rmfamily and}}{and} everyshi.sty]% line break!!
  Distributed in \CTANref{ms}
\item[lastpage.sty]\CTANref{lastpage}
\item[totpages.sty]\CTANref{totpages}
\end{ctanrefs}

\Question[Q-inclplain]{Including Plain \TeX{} files in \LaTeX{}}

\LaTeX{}, though originally \nothtml{based on Plain \TeX{} (}% beware line brk
\Qref{based on Plain \TeX{}}{Q-LaTeXandPlain}\nothtml{)}, does not
contain all of Plain \TeX{}'s commands.  Worse, some Plain \TeX{}
command names appear in \LaTeX{}, with different semantics.  As a
result, special measures need to be taken to allow general Plain
\TeX{} documents (or parts of documents) to be typeset within
\LaTeX{}.

The truly reliable way is to translate the Plain \TeX{} commands, to
produce an equivalent of the original's semantics.  However, this is
not practical in many circumstances, and for those occasions, the
\Package{plain} package will often come to your aid.  The package
defines a \environment{plain} environment, in which a Plain \TeX{}
document may be processed:
\begin{verbatim}
\begin{plain}
  \input{plain-doc}
\end{plain}
\end{verbatim}
The package is known to fail, for example, with documents that use
\AMSTeX{}; no doubt it would also fail if asked to load \Eplain{}.
All these things can be overcome (although it's not often easy), but
the environment saves a lot of work on many occasions.
\begin{ctanrefs}
\item[plain.sty]Distributed as part of \CTANref{carlisle}
\end{ctanrefs}

\subsection{Hyphenation}

\Question[Q-nohyph]{My words aren't being hyphenated}

Let's assume you've selected the right \TeX{} `language'~--- as
explained in \Qref[question]{``how hyphenation works''}{Q-hyphen},
you're not likely to get the correct results typesetting one language
using the hyphenation rules of another.  (Select the proper language,
using \Package{babel} if you're a \LaTeX{} user.  This may reveal that
you need another set of hyphenation patterns; see
% beware line wrap
\Qref[question]{``using a new language''}{Q-newlang} for advice on how
to install it.)

So what else can go wrong?
\begin{itemize}
\item Since \TeX{} version~3.0, the limits on how near to either end
  of a word hyphenation may take place have been programmable (see
  \Qref[question]{``weird hyphenation''}{Q-weirdhyphen}), and for some
  reason the values in question may have been corrupted in some macros
  you are using.  \TeX{} won't hyphenate less than \cs|lefthyphenmin|
  characters after the start of a word, nor less than
  \cs|righthyphenmin| before the end of a word; thus it won't
  hyphenate a word shorter than the sum of the two minima, at all.
  For example, since the minima are 2 and 3 for English, \TeX{} won't
  hyphenate a word shorter than 5 letters long, if it believes the
  word to be English.
\item \TeX{} won't hyphenate a word that's already been hyphenated.
  For example, the (caricature) English surname Smyth-Postlethwaite
  wouldn't hyphenate, which could be troublesome.  This is correct
  English typesetting style (it may not be correct for other
  languages), but if needs must, you can replace the hyphen in the
  name with a \cs|hyph| command, defined
\begin{verbatim}
  \def\hyph{\penalty0\hskip0pt\relax}
\end{verbatim}
  This is \emph{not} the sort of thing this \acro{FAQ} would
  ordinarily recommend\dots{}  The \Package{hyphenat} package defines
  a bundle of such commands (for introducing hyphenation points at
  various punctuation characters).
\item There may be accents in the word.  The causes of and remedies
  for this effect are discussed in
  % beware line break
  \Qref[question]{``accents and hyphens''}{Q-hyphenaccents}.
\item The hyphenation may simply not have been spotted; while \TeX{}'s
  algorithm is good, it's not infallible, and it does miss perfectly
  good hyphenations in some languages.  When this happens, you need to
  give \TeX{} \emph{explicit} instructions on how to hyphenate.
\end{itemize}
The \cs|hyphenation| command allows you to give explicit instructions.
Provided that the word will hyphenate at all (that is, it is not
prevented from hyphenating by any of the other restrictions above),
the command will override anything the hyphenation patterns might
dictate.  The command takes one or more hyphenated words as
argument~--- \cmdinvoke{hyphenation}{ana-lysis pot-able}; note that
(as here, for analysis) you can use the command to overrule \TeX{}'s
choice of hyphenation (ana-lysis is the British etymological
hyphenation; some feel the American hyphenation feels
`unfortunate'\dots{}).
\begin{ctanrefs}
\item[hyphenat.sty]\CTANref{hyphenat}
\end{ctanrefs}

\Question[Q-weirdhyphen]{Weird hyphenation of words}

If your words are being h-yphenated, like this, with jus-t single
letters at the 
beginning or the end of the word, you may have a version mismatch
problem. \TeX{}'s hyphenation system changed between version~2.9
and~3.0, and macros written for use with version~2.9 can have this
effect with a version~3.0 system.  If you are using Plain \TeX{}, make
sure your \File|plain.tex| file has a version number which is at
least~3.0, and rebuild your format.  If you are using \LaTeXo{} your
best plan is to upgrade to \LaTeXe{}.  If for some reason you can't,
the last version of \LaTeXo{} (released on 25 March 1992) is still
available (for the time being at least) and ought to solve this
problem.

If you're using \LaTeXe{}, the problem probably arises from your
|hyphen.cfg| file, which has to be created if you're using a
multi-lingual version.

A further source of oddity can derive from the 1995 release of
\htmlignore
Cork-encoded fonts (\Qref{}{Q-ECfonts}),
\endhtmlignore
\begin{htmlversion}
  \Qref{Cork-encoded fonts}{Q-ECfonts},
\end{htmlversion}
which introduced an alternative hyphen character.  The \LaTeXe{}
configuration files in the font release specified use of the
alternative hyphen, and this could produce odd effects with words
containing an explicit hyphen.  The font configuration files in the
December 1995 release of \LaTeXe{} do \emph{not} use the alternative
hyphen character, and therefore removed this source of problems; the
solution, again, is to upgrade your \LaTeX{}.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\LaTeXo{}]\CTANref{latex209-base}
\item[plain.tex]\CTANref{plain}
\end{ctanrefs}

\Question[Q-oddhyphen]{(Merely) peculiar hyphenation}

You may have found that \TeX{}'s famed automatic word-division does
not produce the break-points recommended by your dictionary. This may be
because \TeX{} is set up for American English, whose rules for word
division (as specified, for example, in Webster's Dictionary) are
completely different from the British ones (as specified, for example,
in the Oxford Dictionaries). This problem is being addressed by the \acro{UK}
\TeX{} User community (see \BV{}, issue~4.4) but an entirely
satisfactory solution will take time; the current status is to be
found on \acro{CTAN} (see
% beware line-wrap
\Qref[question]{``using a new language''}{Q-newlang} for instructions
on adding this new ``language'').
\begin{ctanrefs}
\item[UK patterns]\CTANref{ukhyph}
\end{ctanrefs}

\Question[Q-hyphenaccents]{Accented words aren't hyphenated}

\TeX{}'s algorithm for hyphenation gives up when it encounters an
\cs|accent| command; there are good reasons for this, but it means
that quality typesetting in non-English languages can be difficult.

For \TeX{} macro packages, you can avoiding the effect by using an
appropriately encoded font (for example, a Cork-encoded font~--- see
\Qref[question]{the EC fonts}{Q-ECfonts}) which contains accented
letters as single glyphs.  \LaTeX{} users can achieve this end simply
by adding the command
\begin{verbatim}
  \usepackage[T1]{fontenc}
\end{verbatim}
to the preamble of their document.  Other encodings (notably
\acro{LY}1, promoted by \YandY{}~--- see
%beware line wrap
\Qref[question]{commercial implementations}{Q-commercial}) may be used
in place of \acro{T}1.  Indeed, most current 8-bit \TeX{} font
encodings will `work' with the relevant sets of hyphenation patterns. 

In the future, perhaps,
\nothtml{Omega (}\Qref{Omega}{Q-omega}\nothtml{)}
will provide a rather different solution.

\Question[Q-newlang]{Using a new language with Babel}

\Package{Babel} is capable of working with a large range of
languages, and a new user often wants to use a language that her
\TeX{} installation is not set up to employ.  Simply asking Babel to
use the language, with the command
\begin{verbatim}
  \usepackage[catalan]{babel}
\end{verbatim}
provokes the warning message
\begin{htmlversion}
\begin{verbatim}
Package babel Warning: No hyphenation patterns were loaded for
(babel)                the language `Catalan'
(babel)                I will use the patterns loaded for \language=0 instead.
\end{verbatim}
\end{htmlversion}
\htmlignore
\ifpdf
\begin{verbatim}
Package babel Warning: No hyphenation patterns were loaded for
(babel)                the language `Catalan'
(babel)                I will use the patterns loaded for
                                             \language=0 instead.
\end{verbatim}
(The last line of the above has been wrapped to fit on the page.)
\else
\begin{verbatim}
Package babel Warning: No hyphenation patterns
... were loaded for the language `Catalan'
... I will use the patterns loaded for
... \language=0 instead.
\end{verbatim}
(The layout of the error message isn't quite like this; the language
name \emph{is} capitalised, though.)
\fi
\endhtmlignore

The problem is that your \TeX{} system doesn't know how to hyphenate
Catalan text: you need to tell it how before Babel can do its work
properly.  To do this, for \LaTeX{} installations, one needs to change
\File|language.dat| (which is part of the Babel installation); it will
contain a line
\begin{verbatim}
%catalan         cahyphen.tex
\end{verbatim}
which, if you remove the comment marker, is supposed to instruct
\LaTeX{} to load Catalan hyphenation patterns when you tell it to build
a new format.

Unfortunately, in many Babel distributions, the line just isn't
right~--- you need to check the name of the file containing the
patterns you're going to use.  As you can see, in the author's system,
the name is supposed to be \File|cahyphen.tex|; however the file
actually present on the system is \File|cahyph.tex|~--- fortunately,
the error should prove little more than an inconvenience (most of the
files are in better distributions anyway, but an elusive one
may be found on \acro{CTAN}; if you have to retrieve
a new file, ensure that it's correctly installed, for which see
\Qref[question]{installing a new package}{Q-instpackages}).

Finally, you need to regenerate the formats used (in fact, most users
of Babel are using it in their \LaTeX{} documents, so regenerating the
\LaTeX{}-related formats will ordinarily be enough; however, the
author always generates the lot, regardless).
\begin{description}
\item[te\TeX{}, fp\TeX{}] To regenerate all formats, do: \\
  \texttt{fmtutil -\relax-all}
  
  If you're willing to think through what you're doing (this is
  \emph{not} for the faint-hearted), you can select a sequence of
  formats and for each one, run: \\
  \texttt{fmtutil -\relax-byfmt \meta{formatname}}\\
  where \emph{\texttt{formatname}} is something like `\texttt{latex}',
  or: \\
  \texttt{fmtutil -\relax-byhyphen \meta{hyphenfile}}\\
  where \emph{\texttt{hyphenfile}} is the file specifying hyphenation
  to the format~--- usually \texttt{language.dat}
\item[Mik\TeX{}] On a \Package{MikTeX} distribution earlier than v2.0, do: \\
  \texttt{Start}\arrowhyph{}%
  \texttt{Programs}\arrowhyph{}%
  \texttt{MikTeX}\arrowhyph{}%
  \texttt{Maintenance}\arrowhyph{}%
  \texttt{Create all format files}
% this sequence suggested for miktex 1.20e, 2000/12/22, by Giuseppe Bilotta

  or get a DOS window and run:\\
  \texttt{initexmf -\relax-dump}

  On a \Package{MikTeX} distribtution v2.0 or later, the whole
  procedure can be done via the \acro{GUI}.  To select the new
  language, do:\\
  \texttt{Start}\arrowhyph{}%
  \texttt{Programs}\arrowhyph{}%
  \texttt{MikTeX 2}\arrowhyph{}%
  \texttt{MikTeX Options}, and select the \texttt{Languages} tab.
  Select your language from the list, press the \texttt{Apply} button,
  and then the \texttt{OK} button.  Then select the \texttt{General}
  tab and press the \texttt{Update Now} button.

  Otherwise, edit the \File|language.dat| file (as outlined above),
  and then run:\\
  \texttt{initexmf -\relax-dump}\\
  just as for a pre-v2.0 system.
\end{description}

\nothtml{\noindent}\textbf{\emph{Caveat}:} It is (just) possible that
your \TeX{} system may run out of ``pattern memory'' while generating
the new format.  Most \TeX{} implementations have fixed-size arrays
for storing the details of hyphenation patterns, but although their
size is adjustable in most modern distributions, actually changing the
size is a fiddle.  If you \emph{do} find you've run out of memory,
it may be worth scanning the list of languages in your
\File|language.dat| to see whether any could reasonably be removed.
\begin{ctanrefs}
\item[babel]\CTANref{babel}
\item[hyphenation patterns]\CTANref{hyphenation}
\end{ctanrefs}

\Question[Q-hyphoff]{Stopping all hyphenation}

It may seem an odd thing to want to do (after all, one of \TeX{}'s
great advertised virtues is the quality of its hyphenation) but it's
sometimes necessary.  The real problem is, that the quality of
\TeX{}'s output is by default largely dependent on the presence of
hyphenation; if you want to abandon hyphenation, something has to
give.

\TeX{} (slightly confusingly) offers four possible mechanisms for
suppressing hyphenation (there were only two prior to the extensions
that arrived with \TeX{} version~3).

First, one can set the hyphenation penalties \cs|hyphenpenalty| and
\cs|exhyphenpenalty| to an `infinite' value (that is to say, 10000).
This means that all hyphenations will sufficiently penalise the line
that would contain them, that the hyphenation won't happen.  The
disadvantage of this method is that \TeX{} will re-evaluate any
paragraph for which hyphenations might help, which will slow \TeX{}
down.

Second, one can select a language for which no hyphenation patterns
exist.  Some distributions create a language |nohyphenation|,
and the \Package{hyphenat} package uses this technique for its
\cs|nohyphens| command which sets its argument without any
hyphenation.

Third, one can set \cs|left-| and/or \cs|righthyphenmin| to a
sufficiently large value that no hyphenation could possibly succeed,
since the minimum is larger than the the length of the longest word
\TeX{} is willing to hyphenate (the appropriate value is 62).

Fourth, one can suppress hyphenation for all text using the current
font by the command
\begin{verbatim}
  \hyphenchar\font=-1
\end{verbatim}
This isn't a particularly practical way for users to suppress
hyphenation~--- the command has to be issued for every font the
document uses~--- but it's how \LaTeX{} itself suppresses hyphenation
in |tt| and other fixed-width fonts.

Which of the techniques you should use depends on what you actually
want to do.  If the text whose hyphenation is to be suppressed runs
for less than a paragraph, your only choice is the no-hyphens
language: the language value is preserved along with the text (in the
same way that the current font is); the values for penalties and
hyphen minima active at the end of a paragraph are used when
hyphenation is calculated.

Contrariwise, if you are writing a multilanguage document using the
\Package{babel} package, you \emph{cannot} suppress hyphenation
throughout using either the no-hyphens language or the hyphen minima:
all those values get changed at a \Package{babel} language switch: use
the penalties instead.

If you simply switch off hyphenation for a good bit of text, the
output will have a jagged edge (with many lines seriously overfull),
and your \AllTeX{} run will bombard you with warnings about overfull
and underfull lines.  To avoid this you have two options.  You may use
\cs|sloppy| (or its environment version \environment{sloppypar}), and
have \TeX{} stretch what would otherwise be underfull lines to fill the space
offered, and wrap other lines, while prematurely wrapping overfull
lines and stretching the remainder.  Alternatively, you may set the
text \nothtml{ragged right (}%
% beware line wrap
\Qref{ragged right}{Q-ragright}\nothtml{)}, and at least get rid of
the overfull lines; this technique is `traditional' (in the sense that
typists do it) and may be expected to appeal to the specifiers of
eccentric document layouts (such as those for dissertations), but for
once their sense conforms with typographic style.  (Or at least, style
constrained in this curious way.)
\begin{ctanrefs}
\item[hyphenat.sty]\CTANref{hyphenat}
\end{ctanrefs}

\Question[Q-wdnohyph]{Preventing hyphenation of a particular word}

It's quite possible for (\emph{any}) hyphenation of a particular word
to seem ``completely wrong'', so that you want to prevent it being
hyphenated.

If the word occurs in just one place, put it in a box:
\begin{verbatim}
  \mbox{oddword}
\end{verbatim}
(Plain~\TeX{} users should use \cs|hbox|, and take care at the start
of paragraphs.)  However, boxing the word is not really advisable
unless you are sure it only occurs once.

If the word occurs commonly, the best choice is to assert a
non-hyphenation for it:
\begin{verbatim}
  \hyphenation{oddword}
\end{verbatim}
This hyphenation exception (with no break points) will be used in
preference to what \TeX{}'s hyphenation algorithm may come up with.

In a multilingual document, repeat the exception specification for
each language the word may appear in.  So:
\begin{verbatim}
  \usepackage[french,english]{babel}
  \selectlanguage{english}
  \hyphenation{oddword}
  \selectlanguage{french}
  \hyphenation{oddword}
\end{verbatim}
(note that \Package{babel} will select the default language for the
document~--- English, in this case~--- at \cmdinvoke{begin}{document}.)

\subsection{Odds and ends}

\Question[Q-logos]{Typesetting all those \TeX{}-related logos}

Knuth was making a particular point about the capabilities of \TeX{}
when he defined the logo.  Unfortunately, many believe, he thereby
opened floodgates to give the world a whole range of rather silly
`bumpy road' logos such as \AMSTeX{}, \PiCTeX{}, \BibTeX{}, and so on,
produced in a flurry of different fonts, sizes, and baselines~--- indeed,
everything one might hope to cause them to obstruct the reading process.
In particular, Lamport invented \LaTeX{}
\htmlignore
(silly enough in itself)
\endhtmlignore
\begin{htmlversion}
  (silly enough in itself, with a raised small `A' and a lowered `E')
\end{htmlversion}
and marketing input from Addison-Wesley led to the even
stranger current logo
\htmlignore
\LaTeXe{}.
\endhtmlignore
\begin{htmlversion}
  \LaTeXe{}, which appends a lowered single-stroke Greek letter epsilon.
\end{htmlversion}

Sensible users don't have to follow this stuff wherever it goes,
but, for those who insist, a large collection of logos is defined in
the \Package{texnames} package (but note that this set of macros isn't
entirely reliable in \LaTeXe{}).
The \MF{} and \MP{} logos can be set in fonts that \LaTeXe{}
knows about (so that they scale with the surrounding text) using the
\Package{mflogo} package; but be aware that booby-traps surround the
use of the Knuthian font for \MP{} (you might get
\htmlignore
\textlogo{META\hphantom{P}O\hphantom{S}T}).
\endhtmlignore
% the following htmlversion stuff seems to do roughly what's required,
% which is nice, given the feebleness of representing all these silly
% logos in html otherwise...
\begin{htmlversion}
something like `META&nbsp;O&nbsp;T').
\end{htmlversion}
You needn't despair, however~--- the author himself uses just `MetaPost'.

For those who don't wish to acquire the `proper' logos, the canonical
thing to do is to say |AMS-|\cs|TeX||{}|
\htmlignore
(\acro{AMS}-\TeX{})
\endhtmlignore
for \AMSTeX{}, |Pic|\cs|TeX||{}|
\htmlignore
(Pic\TeX{})
\endhtmlignore
for \PiCTeX{}, |Bib|\cs|TeX||{}|
\htmlignore
(Bib\TeX{})
\endhtmlignore
for \BibTeX{}, and so on.

While the author of this FAQ list can't quite bring himself to do away
with the bumpy-road logos herein, he regularly advises everyone else
to\dots{}
\begin{ctanrefs}
\item[mflogo.sty]\CTANref{mflogo}
\item[texnames.sty]\CTANref{texnames}
\end{ctanrefs}

\Question[Q-bold-extras]{How to do bold-tt or bold-sc}

\LaTeX{}, as delivered, offers no means of handling bold ``teletype''
or small-caps fonts.  There's a practical reason for this (Knuth never
designed such fonts), but there are typographical considerations too
(the ``medium weight'' |cmtt| font is already pretty bold (by
comparison with other fixed-width fonts), and bold small-caps is not
popular with many professional typographers).

There's a set of ``extra'' \MF{} files on \acro{CTAN} that provide bold
versions of both |cmtt| and |cmcsc| (the small caps font).  With
modern \TeX{} distributions, one may bring these fonts into use simply
% two dangerous long lines -- mustn't be allowed to break
by placing them in an \nothtml{appropriate place in the \emph{texmf} tree (}%
\Qref{appropriate place in the \emph{texmf} tree}{Q-wherefiles}\nothtml{)};
\TeX{} (and friends) will automatically build whatever font files they
need when you first make reference to them.  There's a jiffy package
\Package{bold-extra} that builds the necessary font data structures
so that you can use the fonts within \LaTeX{}.

If you need to use Type~1 fonts, you can't proceed with Knuth-style
fonts, since there are no Type~1 versions of the \Package{mf-extra}
set.  However, commercial fixed-width fonts (including the default
\Package{Courier}) almost always come with a bold variant, so that's
not a problem.  Furthermore \nothtml{\acro{PSNFSS} (}%
% beware line wrap
\Qref{\acro{PSNFSS}}{Q-usepsfont}\nothtml{)} typically provides
``faked'' small caps fonts, and has no compunctions about providing
them in a bold form.
\begin{ctanrefs}
\item[bold-extra.sty]\CTANref{bold-extra}
\item[bold tt and small caps fonts]\CTANref{bold}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Symbols, etc.}

\Question[Q-numbersets]{Symbols for the number sets}

It is a good idea to have commands such as \cs|R| for the real numbers and
other standard number sets. Traditionally these were typeset in bold.
Because mathematicians usually do not have access to bold chalk, they
invented the special symbols that are now often used for \cs|R|, \cs|C|,
\emph{etc}.  These symbols are known as ``blackboard bold''. Before
insisting on using them, consider whether going back to the old system
of ordinary bold might not be acceptable (it is certainly simpler).

A set of blackboard bold capitals is available in the \acro{AMS} 
``msbm'' fonts (``msbm'' is available at a range of design sizes, with
names such as ``msbm10''). The pair of font families (the other is
called ``msam'') have a large number of mathematical symbols to
supplement the ones in the standard \TeX{} distribution, and are
available in Type~1 format with most modern distributions.
Support files for using the fonts, both under Plain~\TeX{} and
\LaTeX{} (packages \Package{amssymb} and \Package{amsfonts}), are
available.

Another complete set of blackboard bold fonts written in \MF{} is the
\Package{bbold} family.  This set has the interesting property of
offering blackboard bold forms of lower-case letters, something rather
rarely seen on actual blackboards; the font source directory also
contains sources for a \LaTeX{} package that enables use of the fonts.
The fonts are not available in Type~1 format.

An alternative source of Type~1 fonts with blackboard bold characters
may be found in the steadily increasing set of complete families, both
commercial and free, that have been prepared for use with \AllTeX{}
% beware line break
(see \htmlonly{``}\Qref[question]{choice of outline fonts}{Q-psfchoice}\htmlonly{''}).
Of the free sets, the \Package{txfonts} and \Package{pxfonts} families
both come with replicas of \Package{msam} and \Package{msbm}, and the
\Package{mathpazo} family includes a ``mathematically significant''
choice of blackboard bold characters.

The ``lazy person's'' blackboard bold macros:
\begin{verbatim}
  \newcommand{\R}{{\sf R\hspace*{-0.9ex}%
    \rule{0.15ex}{1.5ex}\hspace*{0.9ex}}}
  \newcommand{\N}{{\sf N\hspace*{-1.0ex}%
    \rule{0.15ex}{1.3ex}\hspace*{1.0ex}}}
  \newcommand{\Q}{{\sf Q\hspace*{-1.1ex}%
    \rule{0.15ex}{1.5ex}\hspace*{1.1ex}}}
  \newcommand{\C}{{\sf C\hspace*{-0.9ex}%
    \rule{0.15ex}{1.3ex}\hspace*{0.9ex}}}
\end{verbatim}
work well at normal size if the surrounding text is |cmr10|. However, 
they are not part of a proper maths font, and so do not work in sub- and 
superscripts. Moreover, the size and position of the vertical bar can be
affected by the font of the surrounding text.
\checked{RAB}{1994/11/12}%
\begin{ctanrefs}
\item[AMS support files (Plain)]\CTANref{amsfonts-plain}
\item[AMS support files (LaTeX)]\CTANref{amsfonts-latex}
\item[AMS symbol fonts]\CTANref{amsfonts-symbols}
\item[AMS symbol fonts in Type~1 format]Browse \CTANref{ams-AMStype1}
\item[bbold fonts]\CTANref{bbold}
\item[mathpazo fonts]\CTANref{mathpazo}
\item[pxfonts]\CTANref{pxfonts}
\item[txfonts]\CTANref{txfonts}
\end{ctanrefs}

\Question[Q-scriptfonts]{Better script fonts for maths}

The font selected by \cs|mathcal| is the only script font `built
in'. However, there are other useful calligraphic fonts included with
modern \TeX{} distributions.
\begin{description}
\item[Euler] The \Package{eucal} package (part of most sensible \TeX{}
  distributions; the
  fonts are part of the \acro{AMS} font set) gives a slightly curlier
  font than the default. The package changes the font that is selected
  by \cs|mathcal|.

  Type 1 versions of the fonts are available in the \acro{AMS} fonts
  distribution.
\item[RSFS] The \Package{mathrsfs} package uses a really fancy script font
  (the name stands for ``Ralph Smith's Formal Script'') which is
  already part of most modern \TeX{} distributions.  The package
  creates a new command \cs|mathscr|.

  Type 1 versions of the font have been made available by Taco
  Hoekwater.
\item[Zapf Chancery] is the standard \PS{} calligraphic font.
  There is no package but you can easily make it available by means of
  the command
\begin{verbatim}
\DeclareMathAlphabet{\mathscr}{OT1}{pzc}%
                                 {m}{it}
\end{verbatim}
  in your preamble.  You may find the font rather too big; if so, you
  can use a scaled version of it like this:
\begin{verbatim}
\DeclareFontFamily{OT1}{pzc}{}
\DeclareFontShape{OT1}{pzc}{m}{it}%
             {<-> s * [0.900] pzcmi7t}{}
\DeclareMathAlphabet{\mathscr}{OT1}{pzc}%
                                 {m}{it}
\end{verbatim}

  Adobe Zapf Chancery (which the above examples use) is distributed in
  any but the most basic \PS{} printers.  A substantially
  identical font (to the the extent that the same metrics may be used)
  is available from \acro{URW} and is distributed with \ProgName{ghostscript}.
\end{description}
Examples of the available styles are available on \acro{CTAN}.
\begin{ctanrefs}
\item[eucal.sty]\CTANref{eucal}
\item[euler fonts]\CTANref{amsfonts-euler}
\item[euler fonts, in Type 1 format]\CTANref{ams-AMStype1}
\item[ghostscript]Browse \CTANref{ghostscript}
\item[mathrsfs.sty]Distributed as part of \CTANref{jknappen-macros}
\item[rsfs fonts]\CTANref{rsfs}
\item[rsfs fonts, in Type 1 format]\CTANref{rsfs-type1}
\item[Script font examples]\CTANref{mathscript}
\end{ctanrefs}

\Question[Q-boldgreek]{Setting bold Greek letters in \LaTeX{}}

The issue here is complicated by the fact that \cs|mathbf| (the
command for setting bold \emph{text} in \TeX{} maths) affects a select
few mathematical symbols (the uppercase Greek letters).  However
lower-case Greek letters behave differently from upper-case Greek
letters (due to Knuth's esoteric font encoding decisions).  However,
\cs|mathbf| \emph{can't} be used even for upper-case Greek letters in
the \AMSLaTeX{} \Package{amsmath} package, which
disables this font-switching and you must use one of the techniques
outlined below.

The Plain \TeX{} solution \emph{does} work, in a limited way:
\begin{verbatim}
  {\boldmath$\theta$}
\end{verbatim}
but \cs|boldmath| may not be used in maths mode, so this `solution'
requires arcana such as:
\begin{verbatim}
  $... \mbox{\boldmath$\theta$} ...$
\end{verbatim}
which then causes problems in superscripts, etc.

These problems may be addressed by using a bold mathematics package.
\begin{itemize}
\item The \Package{bm} package, which is part of the \LaTeX{} tools
  distribution, defines a command \cs|bm| which
  may be used anywhere in maths mode.
\item The \Package{amsbsy} package (which is part of \AMSLaTeX{})
  defines a command \cs|boldsymbol|, which
  (though slightly less comprehensive than \cs|bm|) covers almost all
  common cases.
\end{itemize}

All these solutions cover all mathematical symbols, not merely Greek
letters.
\begin{ctanrefs}
\item[bm.sty]Distributed as part of \CTANref{2etools}
\item[amsbsy.sty]Distributed as part of \AMSLaTeX{} \CTANref{amslatex}
\item[amsmath.sty]Distributed as part of \AMSLaTeX{} \CTANref{amslatex}
\end{ctanrefs}

\Question[Q-prinvalint]{The Principal Value Integral symbol}

This symbol (an integral sign, `crossed') does not appear in any of
the fonts ordinarily available to \AllTeX{} users, but it can be
created by use of the following macros:
\begin{htmlversion}
\begin{verbatim}
\def\Xint#1{\mathchoice
   {\XXint\displaystyle\textstyle{#1}}%
   {\XXint\textstyle\scriptstyle{#1}}%
   {\XXint\scriptstyle\scriptscriptstyle{#1}}%
   {\XXint\scriptscriptstyle\scriptscriptstyle{#1}}%
   \!\int}
\def\XXint#1#2#3{{\setbox0=\hbox{$#1{#2#3}{\int}$}
     \vcenter{\hbox{$#2#3$}}\kern-.5\wd0}}
\def\ddashint{\Xint=}
\def\dashint{\Xint-}
\end{verbatim}
\end{htmlversion}
\htmlignore
\ifpdf
\begin{verbatim}
\def\Xint#1{\mathchoice
   {\XXint\displaystyle\textstyle{#1}}%
   {\XXint\textstyle\scriptstyle{#1}}%
   {\XXint\scriptstyle\scriptscriptstyle{#1}}%
   {\XXint\scriptscriptstyle\scriptscriptstyle{#1}}%
   \!\int}
\def\XXint#1#2#3{{\setbox0=\hbox{$#1{#2#3}{\int}$}
     \vcenter{\hbox{$#2#3$}}\kern-.5\wd0}}
\def\ddashint{\Xint=}
\def\dashint{\Xint-}
\end{verbatim}
\else
\begin{verbatim}
\def\Xint#1{\mathchoice
   {\XXint\displaystyle\textstyle{#1}}%
   {\XXint\textstyle\scriptstyle{#1}}%
   {\XXint\scriptstyle\scriptscriptstyle{#1}}%
   {\XXint\scriptscriptstyle
                      \scriptscriptstyle{#1}}%
   \!\int}
\def\XXint#1#2#3{{%
     \setbox0=\hbox{$#1{#2#3}{\int}$}
     \vcenter{\hbox{$#2#3$}}\kern-.5\wd0}}
\def\ddashint{\Xint=}
\def\dashint{\Xint-}
\end{verbatim}
\fi
\endhtmlignore
\cs|dashint| gives a single-dashed integral sign, \cs|ddashint| a
double-dashed one.

\Question[Q-underscore]{How to use the underscore character}

The underscore character |_| is ordinarily used in \TeX{} to indicate a
subscript in maths mode; if you type |_| in the course of ordinary
text, \TeX{} will complain.  If you're writing a document which will
contain a large number of underscore characters, the prospect of
typing \cs|_| (or, worse, \cs|textunderscore|) for every one of them
will daunt most ordinary people.

Moderately skilled macro programmers can readily generate a quick hack
to permit typing |_| to mean `text underscore'.  However, the code
\emph{is} somewhat tricky, and more importantly there are significant
points where it's easy to get it wrong.  There is therefore a package
\Package{underscore} which provides a general solution to this
requirement.

There is a problem, though: \acro{OT}1 text fonts don't contain an
underscore character, unless they're in the typewriter version of the
encoding (used by fixed-width fonts such as \texttt{cmtt}).  So either
you must ensure that your underscore characters only occur in text set
in a typewriter font, or you must use a fuller encoding, such as
\acro{T}1, which has an underscore character in every font.

If the requirement is only for occasional uses of underscores, it may
be acceptable to use the following construct:
\begin{verbatim}
\def\us{\char`\_}
...
\texttt{create\us process}
\end{verbatim}
The construction isn't in the least robust (in the normal English
sense of the word), but it \emph{is} robust under expansion (i.e., the
\LaTeX{} sense of the word); so use it with care, but don't worry
about section headings and the like.
\begin{ctanrefs}
\item[underscore.sty]\CTANref{underscore}
\end{ctanrefs}

\Question[Q-atsign]{How to type an `@' sign?}

Long ago, some packages used to make the `@' sign active, so that
special measures were needed to type it.  While those packages are
still in principle available, few people use them, and those that do
use them have ready access to rather good documentation.

Ordinary people (such as the author of this \acro{FAQ}) need only type
`@'.

\Question[Q-euro]{Typesetting the Euro sign}

The European currency ``Euro'' is represented by a symbol of somewhat
dubious design, but it's an important currency and \AllTeX{} users
need to typeset it.

Note that the Commission of the European Community at first deemed
that the Euro symbol should always be set in a sans-serif font;
fortunately, this eccentric ruling has now been rescinded, and one may
apply best typesetting efforts to making it appear at least slightly
``respectable'' (typographically).

The \acro{TS}1-encoded fonts provided as part of the \acro{EC} font
distribution provide Euro glyphs.  The fonts are called Text Companion
(\acro{TC}) fonts, and offer the same range
of faces as do the \acro{EC} fonts themselves.  The
\Package{textcomp} package provides a \cs|texteuro| command for
accessing the symbol, which selects a symbol to match the surrounding
text.  The design of the symbol in the \acro{TC} fonts is not
universally loved\dots{}
Nevertheless, use the \acro{TC} font version of the symbol if you are
producing documents using Knuth's Computer Modern Fonts.

The \Package{latin9} input encoding defined by the \Package{inputenc}
package has a euro character defined (character position 164, occupied
in other \acro{ISO} Latin character sets by the ``currency symbol'').
The encoding uses the command \cs|texteuro| for the character; at
present that command is \emph{only} available from the
\Package{textcomp} package.  There is a MicroSoft code page position,
too, but standardisation of such things proceeds via rather different
routes and the \LaTeX{} project hasn't yet been given details of the
change.

Outline fonts which contain nothing but Euro symbols are available
(free) from
\href{ftp://ftp.adobe.com/pub/adobe/type/win/all/eurofont.exe}{Adobe}\nobreakspace---
the file is packaged as a \ProgName{Windows} self-extracting
executable, but it may be decoded as a |.zip| format achive on other
operating systems.
The \Package{euro} bundle contains metrics, \ProgName{dvips} map
files, and macros (for Plain \TeX{} and \LaTeX{}), for using these
fonts in documents.  \LaTeX{} users will find two packages in the
bundle: \Package{eurosans} only offers the sans-serif version (to
conform with the obsolete ruling about sans-serif-only symbols; the
package provides the
command \cs|euro|), whereas \Package{europs} matches the Euro symbol
with the surrounding text (providing the command \cs|EUR|).  To use
either package
with the \Package{latin9} encoding, you need to define \cs|texteuro|
as an alias for the euro command the package defines.

The Adobe fonts are probably the best bet for use in non-Computer
Modern environments.  They are apparently designed to fit with Adobe
Times, Helvetica and Courier, but can probably fit with a wider range
of modern fonts.

The \Package{eurofont} package provides a compendious analysis of the
``problem of the euro symbol'' in its documentation, and offers macros
for configuring the source of the glyphs to be used; however, it seems
rather large for everyday use.

The \Package{euro-ce} bundle is a rather pleasing \MF{}-only design
providing Euro symbols in a number of shapes.  The file
\File|euro-ce.tex|, in the distribution, offers hints as to how a
Plain~\TeX{} user might make use of the fonts.

Euro symbols are found in several other places, which we list here for
completeness.

The \Package{marvosym} fonts contain a Euro symbol among many other
good things; the font on \acro{CTAN} is not Adobe \ProgName{ATM}
compatible, but a compatible version is available free from
\href{http://www.YandY.com/download/marvosym.zip}{\YandY{}}.  The font
on \acro{CTAN} comes with a set of macros to typeset all the symbols
it contains.

Other \MF{}-based bundles containing Euro symbols are to be found in
\Package{china2e} (whose primary aim is Chinese dates and suchlike
matters) and the \Package{eurosym} fonts.
\begin{ctanrefs}
\item[china2e bundle]\CTANref{china2e}
\item[EC fonts]\CTANref{ec}
\item[euro fonts]\CTANref{euro-fonts}
\item[euro-ce fonts]\CTANref{euro-ce}
\item[eurofont.sty]\CTANref{eurofont}
\item[eurosym fonts]\CTANref{eurosym}
\item[marvosym fonts]\CTANref{marvosym-fonts}
\item[textcomp.sty]Part of the \LaTeX{} distribution.
\end{ctanrefs}

\Question[Q-tradesyms]{How to get copyright, trademark, etc.}

The ``\nothtml{Comprehensive symbol list'' (}% beware line break
\Qref{Comprehensive symbol list}{Q-symbols}\latexhtml{)}{''}, lists
the symbol commands \cs|textcopyright|,
\cs|textregistered| and \cs|texttrademark|, which are available in
\acro{TS}1-encoded fonts, and which are enabled using the
\Package{textcomp} package.

In fact, all three commands are enabled in default \LaTeX{}, but the
glyphs you get aren't terribly beautiful.  In particular,
\cs|textregistered| behaves oddly when included in bold text (for
example, in a section heading), since it is composed of a small-caps
letter, which typically degrades to a regular shape letter when asked
to set in a bold font.  This means that the glyph becomes a circled
``r'', whereas the proper symbol is a circled ``R''.

This effect is of course avoided by use of \Package{textcomp}.

Another problem arises if you want \cs|textregistered| in a
superscript position (to look similar to \cs|texttrademark|).
Using a maths-mode superscript to do this provokes lots of pointless
errors: you \emph{must} use
\begin{verbatim}
  \textsuperscript{\textregistered}
\end{verbatim}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Macro programming}

\subsection{``Generic'' macros and techniques}

\Question[Q-findwidth]{Finding the width of a letter, word, or phrase}

Put the word in a box, and measure the width of the box. For example,
\begin{verbatim}
  \newdimen\stringwidth
  \setbox0=\hbox{hi}
  \stringwidth=\wd0
\end{verbatim}
Note that if the quantity in the \cs|hbox| is a phrase, the actual
measurement only approximates the width that the phrase will occupy in
running text, since the inter-word glue can be adjusted in paragraph
mode.

The same sort of thing is expressed in \LaTeX{} by:
\begin{verbatim}
  \newlength{\gnat}
  \settowidth{\gnat}{\textbf{small}}
\end{verbatim}
This sets the value of the length command |\gnat| to the width of ``small''
in bold-face text.

\Question[Q-patch]{Patching existing commands}

In the general case (possibly sticking something in the middle of an
existing command) this is difficult.  However, the common requirement,
to add some code at the beginning or the end of an existing command,
is conceptually quite easy.  Suppose we want to define a version of a
command that does some small extension of its original definition: we
would naturally write:
\begin{verbatim}
  \renewcommand{\splat}{\mumble\splat}
\end{verbatim}
However, this would not work: a call to \cs|splat| would execute
\cs|mumble|, and the call the redefined \cs|splat| again; this is an
infinite recursive loop, that will quickly exhaust \TeX{}'s memory.

Fortunately, the \TeX{} primitive \cs|let| command comes to our
rescue; it allows us to take a ``snapshot'' of the current state of a
command, which we can then use in the redefinition of the command.
So:
\begin{verbatim}
  \let\OldSmooth\smooth
  \renewcommand{\smooth}{\mumble\OldSmooth}
\end{verbatim}
effects the required patch, safely.  Adding things at the end of a
command works similarly.  If \cs|smooth| takes arguments, one must
pass them on:
\begin{htmlversion}
\begin{verbatim}
  \renewcommand{\smooth}[2]{\mumble\OldSmooth{#1}{#2}}
\end{verbatim}
\end{htmlversion}
\htmlignore
\ifpdf
\begin{verbatim}
  \renewcommand{\smooth}[2]{\mumble\OldSmooth{#1}{#2}}
\end{verbatim}
\else
\begin{verbatim}
  \renewcommand{\smooth}[2]%
               {\mumble\OldSmooth{#1}{#2}}
\end{verbatim}
\fi
\endhtmlignore

The general case may be achieved in two ways.  First, one can use the
\LaTeX{} command \cs|CheckCommand|; this compares an existing command
with the definition you give it, and issues a warning if two don't
match.  Use is therefore:\\
|  \CheckCommand{\complex}{|\meta{original definition}|}|\\
|  \renewcommand{\complex}{|\meta{new definition}|}|\\
This technique is obviously somewhat laborious, but if the original
command comes from a source that's liable to change under the control
of someone else, it does at least warn you that your patch is in
danger of going wrong.

Otherwise, \LaTeX{} users may use one of the \Package{patch} or
\Package{patchcmd} systems.

\Package{Patch} gives you an ingenious (and difficult to understand)
mechanism, and comes as an old-style \LaTeX{} documented macro file.
Sadly the old-style \Package{doc} macros are no longer available, but
the file (\File|patch.doc|) may be input directly, and the
documentation may be read (un-typeset).  Roughly speaking, one gives
the command a set of instructions analagous to \ProgName{sed}
substitutions, and it regenerates the command thus amended.  The
author of this \acro{FAQ} has (slightly reluctantly) given up using
\Package{patch}\dots{}

The \Package{patchcmd} package addresses a slightly simpler task, by
restricting the set of commands that you may patch; you mayn't patch
any command that has an optional argument, though it does deal with
the case of commands defined with \cs|DeclareRobustCommand|.  The
package defines a \cs|patchcommand| command, that takes three
arguments: the command to patch, stuff to stick at the front of its
definition, and stuff to stick on the end of its definition.  So, if
\cs|b| contains ``|b|'', then
\cs|patchcommand|\nothtml{\penalty-150\hskip0pt\relax}\cmdinvoke{b}{a}{c}
will produce a new version of \cs|b| that contains ``|abc|''.
\begin{ctanrefs}
\item[patch.doc]\CTANref{patch}
\item[patchcommand.sty]\CTANref{patchcmd}
\end{ctanrefs}

\Question[Q-compjobnam]{Comparing the ``job name''}

The token \cs|jobname| amusingly produces a sequence of characters
whose category code is 12 (`other'), regardless of what the characters
actually are.  Since one inevitably has to compare a macro with the
contents of another macro (using \cs|ifx|, somewhere) one needs to
create a macro whose expansion looks the same as the expansion of
\cs|jobname|.  We find we can do this with \cs|meaning|, if we strip
the ``\cs|show| command'' prefix.

The full command looks like:
\htmlignore
\begin{pdfversion}
\begin{verbatim}
\def\StripPrefix#1>{}
\def\jobis#1{FF\fi
  \def\predicate{#1}%
  \edef\predicate{\expandafter\StripPrefix\meaning\predicate}%
  \edef\job{\jobname}%
  \ifx\job\predicate
}
\end{verbatim}
\end{pdfversion}
\begin{dviversion}
\begin{verbatim}
\def\StripPrefix#1>{}
\def\jobis#1{FF\fi
  \def\predicate{#1}%
  \edef\predicate{\expandafter\StripPrefix
                    \meaning\predicate}%
  \edef\job{\jobname}%
  \ifx\job\predicate
}
\end{verbatim}
\end{dviversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
\def\jobis#1{FF\fi
  \def\predicate{#1}%
  \edef\predicate{\expandafter\StripPrefix\meaning\predicate}%
  \edef\job{\jobname}%
  \ifx\job\predicate
}
\end{verbatim}
\end{htmlversion}
And it's used as:
\begin{verbatim}
\if\jobis{mainfile}%
  \message{YES}%
\else
  \message{NO}%
\fi
\end{verbatim}
Note that the command \cs|StripPrefix| need not be defined if you're
using \LaTeX{}~--- there's already an \nothtml{internal command (}%
\Qref{internal command}{Q-atsigns}\nothtml{)}
\cs|strip@prefix| that you can use.

\Question[Q-isitanum]{Is the argument a number?}

\TeX{}'s own lexical analysis doesn't offer the macro programmer
terribly much support: while category codes will distinguish letters
(or what \TeX{} currently thinks of as letters) from everything else,
there's no support for analysing numbers.

The simple-minded solution is to compare numeric characters with the
characters of the argument, one by one, by a sequence of direct tests,
and to declare the argument ``not a number'' if any character fails
all comparisons:
\begin{verbatim}
\ifx1#1
\else\ifx2#1
...
\else\ifx9#1
\else\isanumfalse
\fi\fi...\fi
\end{verbatim}
which one would then use in a tail-recursing macro to gobble an
argument.  One could do slightly better by assuming (pretty safely)
that the digits' character codes are consecutive:
\begin{verbatim}
\ifnum`#1<`0 \isanumfalse
\else\ifnum`#1>`9 \isanumfalse
     \fi
\fi
\end{verbatim}
again used in tail-recursion.  However, these forms aren't very
satisfactory: getting the recursion ``right'' is troublesome (it has a
tendency to gobble spaces in the argument), and in any case \TeX{}
itself has mechanisms for reading numbers, and it would be nice to use
them.

Donald Arseneau's \Package{cite} package offers the following test
for an argument being a strictly positive integer:
\begin{verbatim}
\def\IsPositive#1{%
  TT\fi
  \ifcat_\ifnum0<0#1 _\else A\fi
}
\end{verbatim}
which can be adapted to a test for a non-negative integer thus:
\begin{verbatim}
\def\IsNonNegative{%
  \ifcat_\ifnum9<1#1 _\else A\fi
}
\end{verbatim}
or a test for any integer:
\begin{verbatim}
\def\gobble#1{}
\def\gobbleminus{\futurelet\temp\gobm}
\def\gobm{\ifx-\temp\expandafter\gobble\fi}
\def\IsInteger#1{%
  TT\fi
  \ifcat_\ifnum9<1\gobbleminus#1 _\else A\fi
}
\end{verbatim}
but this surely stretches the technique further than is reasonable.

If we don't care about the sign, we can use \TeX{} to remove the
entire number (sign and all) from the input stream, and then look at
what's left:
\htmlignore
\begin{dviversion}
\begin{verbatim}
\def\testnum#1{\afterassignment\testresult
               \count255=#1 \end}
\def\testresult#1\end{\ifx\end#1\end}
\def\IsInteger#1{TT\fi \testnum{#1}}
\end{verbatim}
\end{dviversion}
\begin{pdfversion}
\begin{verbatim}
\def\testnum#1{\afterassignment\testresult\count255=#1 \end}
\def\testresult#1\end{\ifx\end#1\end\isanumtrue\else\isanumfalse\fi}
\end{verbatim}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
\def\testnum#1{\afterassignment\testresult\count255=#1 \end}
\def\testresult#1\end{\ifx\end#1\end\isanumtrue\else\isanumfalse\fi}
\end{verbatim}
\end{htmlversion}
(which technique is due to David Kastrup).  In a later thread on the same
topic, Michael Downes offered:
\begin{verbatim}
\def\IsInteger#1{%
  TT\fi
  \begingroup \lccode`\-=`\0 \lccode`+=`\0
    \lccode`\1=`\0 \lccode`\2=`\0 \lccode`\3=`\0
    \lccode`\4=`\0 \lccode`\5=`\0 \lccode`\6=`\0
    \lccode`\7=`\0 \lccode`\8=`\0 \lccode`\9=`\0
  \lowercase{\endgroup
    \expandafter\ifx\expandafter\delimiter
    \romannumeral0\string#1}\delimiter
}
\end{verbatim}
which relies on \cs|romannumeral| producing an empty result if its
argument is zero.

All the complete functions above are designed to be used in \TeX{}
conditionals written ``naturally''~--- for example:
\begin{verbatim}
\if\IsInteger{<subject of test>}%
  <deal with integer>%
\else
  <deal with non-integer>%
\fi
\end{verbatim}

\Question[Q-hash]{Defining macros within macros}

The way to think of this is that |##| gets replaced by |#| in just the
same way that |#1| gets replaced by `whatever is the first argument'.

So if you define a macro and use it as:
\begin{verbatim}
  \def\a#1{+++#1+++#1+++#1+++}  \a{b}
\end{verbatim}
the macro expansion produces `+++b+++b+++b+++',
which people find normal.  However, if we now replace part of the macro:
\begin{verbatim}
  \def\a#1{+++#1+++\def\x #1{xxx#1}}
\end{verbatim}
\cs|a{b}| will expand to `+++b+++|\def\x b{xxxb}|'.  This
defines \cs|x| to be a macro \emph{delimited} by |b|, and taking no
arguments, which people may find strange, even though it is just a
specialisation of the example above.  If you want \cs|a| to
define \cs|x| to be a macro with one argument, you need to write:
\begin{verbatim}
  \def\a#1{+++#1+++\def\x ##1{xxx##1}}
\end{verbatim}
and \cs|a{b}| will expand to 
`+++b+++|\def\x #1{xxx#1}|', because |#1| gets replaced by `b'
and |##| gets replaced by |#|.

To nest a definition inside a definition inside a definition then
you need |####1|, as at each stage |##| is replaced by
|#|.  At the next level you need 8~|#|s each time, and so on.

\Question[Q-spinmacro]{Spaces in macros}

It's very easy to write macros that produce space in the typeset
output where it's neither desired nor expected.  Spaces introduced by
macros are particularly insidious because they don't amalgamate with
spaces around the macro (unlike consecutive spaces that you
type), so your output can have a single bloated space that proves
to be made up of two or even more spaces that haven't amalgamated.
And of course, your output can also have a space where none was wanted
at all.

Spaces are produced, inside a macro as elsewhere, by space or tab
characters, or by end-of-line characters.  There are two basic rules
to remember when writing a macro: first, the rules for ignoring spaces
when you're typing macros are just the same as the rules that apply
when you're typing ordinary text, and second, rules for ignoring
spaces do \emph{not} apply to spaces produced while a macro is being
obeyed (``expanded'').

Spaces are ignored in vertical mode (between paragraphs), at the
beginning of a line, and after a command name.  Since sequences of
spaces are collapsed into one, it `feels as if' spaces are ignored if
they follow another space.  Space can have syntactic meaning after
certain sorts of non-braced arguments (e.g., \emph{count} and
\emph{dimen} variable assignments in Plain \TeX{}) and after certain
control words (e.g., in \cs|hbox| |to|, so again we have instances
where it `feels as if' spaces are being ignored when they're merely
working quietly for their living.

Consider the following macro, fairly faithfully adapted from one that
appeared on \Newsgroup|comp.text.tex|:
\htmlignore
\ifpdf
\begin{verbatim}
\newcommand{\stline}[1]{ \bigskip \makebox[2cm]{ \textbf{#1} } }
\end{verbatim}
\else
\begin{verbatim}
\newcommand{\stline}[1]
      { \bigskip \makebox[2cm]{ \textbf{#1} } }
\end{verbatim}
(the original appeared on a single line: it's wrapped here to fit in
the printed \acro{FAQ}'s narrow columns).

\noindent
\fi
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
\newcommand{\stline}[1]{ \bigskip \makebox[2cm]{ \textbf{#1} } }
\end{verbatim}
\end{htmlversion}
The macro definition contains five spaces:
\begin{itemize}
\item after the opening |{| of the macro body; this space will be
  ignored, not because ``because the macro appears at the start of a
  line'', but rather because the macro was designed to operate between
  paragraphs
\item after \cs|bigskip|; this space will be ignored (while the macro
  is being defined) because it follows a command name
\item after the |{| of the mandatory argument of \cs|makebox|; even
  though this space will inevitably appear at the start of an output
  line, it will \emph{not} be ignored
\item after the |}| closing the argument of \cs|textbf|; this space
  will not be ignored, but may be overlooked if the argument is well
  within the |2cm| allowed for it
\item after the |}| closing the mandatory argument of \cs|makebox|;
  this space will not be ignored
\end{itemize}
The original author of the macro had been concerned that the starts of
his lines with this macro in them were not at the left margin, and
that the text appearing after the macro wasn't always properly
aligned.  These problems arose from the space at the start of the
mandatory argument of \cs|makebox| and the space immediately after the
same argument.  He had written his macro in that way to emphasise the
meaning of its various parts; unfortunately the meaning was rather
lost in the problems the macro caused.

The principal technique for suppressing spaces is the use of
\texttt{\textpercent} characters: everything after a
\texttt{\textpercent} is ignored, even the end of line itself (so
that not even the end of line can contribute an unwanted space).  The
secondary technique is to ensure that the end of line is preceded by a
command name (since the end of line behaves like a space, it will be
ignored following a command name).  Thus the above command would be
written (by an experienced programmer with a similar eye to
emphasising the structure):
\begin{verbatim}
\newcommand{\stline}[1]{%
  \bigskip
  \makebox[2cm]{%
    \textbf{#1}\relax
  }%
}
\end{verbatim}
Care has been taken to ensure that every space in the revised
definition is ignored, so none appears in the output.  The revised
definition takes the ``belt and braces'' approach, explicitly dealing
with every line ending (although, as noted above, a space introduced
at the end of the first line of the macro would have been ignored in
actual use of the macro.  This is the best technique, in fact~--- it's
easier to blindly suppress spaces than to analyse at every point
whether you actually need to.  Three techniques were used to suppress
spaces:
\begin{itemize}
\item placing a \texttt{\textpercent} character at the end of a line
  (as in the 1st, 3rd and 5th lines),
\item ending a line `naturally' with a control sequence, as in line 2,
  and
\item ending a line with an `artificial' control sequence, as in line
  4; the control sequence in this case (\cs|relax|) is a no-op in many
  circumstances (as here), but this usage is deprecated~--- a
  \texttt{\textpercent} character would have been better.
\end{itemize}
Beware of the (common) temptation to place a space \emph{before} a
\texttt{\textpercent} character: if you do this you might as well omit
the \texttt{\textpercent} altogether.

In ``real life'', of course, the spaces that appear in macros are far
more cryptic than those in the example above.  The most common spaces
arise from unprotected line ends, and this is an error that
occasionally appears even in macros written by the most accomplished
programmers.

\Question[Q-moren9]{How to break the 9-argument limit}

If you think about it, you will realise that Knuth's command
definition syntax:
\begin{verbatim}
  \def\blah#1#2 ... #9{<macro body>}
\end{verbatim}
is intrinsically limited to just 9 arguments.  There's no direct way
round this: how would you express a 10th argument?~--- and ensure that
the syntax didn't gobble some other valid usage?

If you really must have more than 9 arguments, the way to go is:
\begin{verbatim}
  \def\blah#1#2 ... #9{%
    \def\ArgI{{#1}}%
    \def\ArgII{{#2}}%
    ...
    \def\ArgIX{{#9}}%
    \BlahRelay
  }
  \def\BlahRelay#1#2#3{%
    % arguments 1-9 are now in
    %   \ArgI-\ArgIX
    % arguments 10-12 are in
    %   #1-#3
    <macro body>%
  }
\end{verbatim}
This technique is easily extendible by concert pianists of the \TeX{}
keyboard, but is really hard to recommend.

\LaTeX{} users have the small convenience of merely giving a number of
arguments in the \cs|newcommand| that defines each part of the
relaying mechanism: Knuth's restriction applies to \cs|newcommand|
just as it does to \cs|def|.  However, \LaTeX{} users also have the
way out of such barbarous command syntax: the \Package{keyval}
package.  With \Package{keyval}, and a bit of programming, one can
write really quite sophisticated commands, whose invocation might look
like:
\begin{verbatim}
  \flowerinstance{species=Primula veris,
    family=Primulaceae,
    location=Coldham's Common,
    locationtype=Common grazing land,
    date=1995/04/24,
    numplants=50,
    soiltype=alkaline
  }
\end{verbatim}
The merit of such verbosity is that it is self-explanatory: the typist
doesn't have to remember that argument twelve is |soiltype|, and so
on: the commands may be copied from field notes quickly and
accurately.
\begin{ctanrefs}
\item[keyval.sty]Distributed as part of \CTANref{graphics}
\end{ctanrefs}

\Question[Q-activechars]{Defining characters as macros}

Single characters can act as macros (defined commands), and both
Plain~\TeX{} and \LaTeX{} define the character
``\texttt{\textasciitilde}'' as a ``non-breakable space''.  A
character is made definable, or ``active'', by setting its
\emph{category code} (catcode) to be \cs|active| (13):
|\catcode`_=\active|.

Any character could, in principle, be activated this way and defined
as a macro (|\def_{|\cs|_||}|~--- the simple answer to
% beware line break
\Qref[question]{using underscores}{Q-underscore}), but you must be
wary: whereas people expect an active tilde, other active characters
may be unexpected and interact badly with other macros.  Furthermore,
by defining an active character, you preclude the character's use for
other purposes, and there are few characters ``free'' to be subverted
in this way.

To define the character ``|z|'' as a command, one would say something
like:
\begin{verbatim}
  \catcode`\z=\active
  \def z{Yawn, I'm tired}%
\end{verbatim}
and each subsequent ``|z|'' in the text would become a yawn. This would be
an astoundingly bad idea for most documents, but might have special
applications. (Note that, in ``|\def z|'', ``|z|'' is no longer interpreted as
a letter; the space is therefore not necessary~--- ``|\defz|'' would do; we
choose to retain the space, for what little clarity we can manage.)
Some \LaTeX{} packages facilitate such definitions. For example, the
\Package{shortvrb} package with its \cs|MakeShortVerb| command.

\TeX{} uses category codes to interpret characters as they are read 
from the input.
% beware line break
\emph{Changing a catcode value will not affect characters that have already been read}.
Therefore, it is best if characters have fixed category codes for the
duration of a document.  If catcodes are changed for particular
purposes (the \cs|verb| command does this), then the altered
characters will not be interpreted properly when they  appear in the
argument to another command (as, for example, in
% beware line-break
\htmlonly{``}\Qref[question]{\cs|verb| in command arguments}{Q-verbwithin}\htmlonly{''}).
An exemplary case is the \Package{doc} package, which processes .dtx
files using the \Package{shortvrb} package to define
\texttt{\textbar\dots{}\textbar} as a shorthand for
\cs|verb|\texttt{\textbar\dots{}\textbar}. But \texttt{\textbar} is
also used in the preambles of tabular environments, so that tables in
|.dtx| files can only have vertical line separation between columns by
employing special measures of some sort.

Another consequence is that catcode assignments made
in macros often don't work as expected % beware linebreak
(\htmlonly{see ``}\Qref{Active characters in command arguments}{Q-actinarg}\htmlonly{''}).
For example, the definition
\begin{verbatim}
\def\mistake{%
  \catcode`_=\active
  \def_{\textunderscore\-}%
}
\end{verbatim}
does not work because it attemts to define an ordinary |_| character:
When the macro is used, the category change does not apply to the 
underscore character already in the macro definition.  Instead, one may
use:
\begin{verbatim}
\begingroup
  \catcode`_=\active
  \gdef\works{%         note the global \gdef
    \catcode`_=\active
    \def_{\textunderscore\-}%
   }
\endgroup
\end{verbatim}

The alternative (``tricksy'') way of creating such an isolated
definition depends on the curious properties of \cs|lowercase|, which
changes characters without altering their catcodes.  Since there is
always \emph{one} active character (``\texttt{\textasciitilde}''), we
can fool \cs|lowercase| into patching up a definition without ever
explicitly changing a catcode:
\begin{verbatim}
\begingroup
  \lccode`\~=`\_
  \lowercase{\endgroup
    \def~{\textunderscore\-}%
  }%
\end{verbatim}

The two definitions have the same overall effect (the character is
defined as a command, but the character does not remain active),
except that the first defines a \cs|global| command.

For active characters to be used only in maths mode, it is much better
to leave the character having its ordinary catcode, but assign it a
special active \emph{maths code}, as with
\begin{verbatim}
\begingroup
  \lccode`~=`x
  \lowercase{\endgroup
    \def~{\times}%
  }%
\mathcode`x="8000
\end{verbatim}
The special character does not need to be redefined whenever it is
made active~--- the definition of the command persists even if the
character's catcode reverts to its original value; the definition
becomes accessible again if the character once again becomes active.
\begin{ctanrefs}
\item[doc.sty]Distributed as part of the source of \LaTeX{}, \CTANref{latex}
\item[shortvrb.sty]Distributed as part of \CTANref{2etools}
\end{ctanrefs}


\Question[Q-actinarg]{Active characters in command arguments}

Occasionally, it's nice to make one or two characters active in the
argument of a command, to make it easier for authors to code the
arguments.

Active characters \emph{can} be used safely in such situations; but
care is needed.

An example arose while this answer was being considered: an aspirant
macro writer posted to \Newsgroup|comp.text.tex| asking for help to
make |#| and |b| produce musical sharp and flat signs, respectively,
in a macro for specifying chords.

The first problem is that both |#| and |b| have rather important uses
elsewhere in \TeX{} (to say the least!), so that the characters can
only be made active while the command is executing.

Using the techniques discussed in % beware line break, next line
\htmlonly{``}\Qref[question]{characters as commands}{Q-activechars}\htmlonly{''},
we can define:
\begin{verbatim}
\begingroup
  \catcode`\#=\active
  \gdef#{$\sharp$}
\endgroup
\end{verbatim}
and:
\begin{verbatim}
\begingroup
  \lccode`\~=`\b
  \lowercase{\endgroup
    \def~{$\flat$}%
  }
\end{verbatim}

The second problem is one of timing: the command has to make each
character active \emph{before} its arguments are read: this means that
the command can't actually ``have'' arguments itself, but must be
split in two.  So we write:
\begin{verbatim}
\def\chord{%
  \begingroup
    \catcode`\#=\active
    \catcode`\b=\active
    \Xchord
}
\def\Xchord#1{%
    \chordfont#1%
  \endgroup
}
\end{verbatim}
and we can use the command as \cmdinvoke{chord}{F\#} or
\cmdinvoke{chord}{Bb minor}.

Two features of the coding are important:
\begin{itemize}
\item \cs|begingroup| in \cs|chord| opens a group that is closed by
  \cs|endgroup| in \cs|Xchord|; this group limits the change of
  category codes, which is the \emph{raison d'\^etre} of the whole
  exercise.
\item Although |#| is active while \cs|Xchord| is executed, it's
  \emph{not} active when it's being defined, so that the use of |#1|
  doesn't require any special attention.
\end{itemize}

Note that the technique used in such macros as \cs|chord|, here, is
analagous to that used in such commands as \cs|verb|; and, in just the
same way as \cs|verb| (see
% beware breaking long line
\htmlonly{``}\Qref[question]{\cs|verb| doesn't work in arguments}{Q-verbwithin}\htmlonly{''}),
\cs|chord| won't work inside the argument of another command (the
error messages, if they appear at all, will probably be rather odd).


\Question[Q-csname]{Defining a macro from an argument}

It's common to want a command to create another command: often one
wants the new command's name to derive from an argument.  \LaTeX{}
does this all the time: for example, \cs|newenvironment| creates
start- and end-environment commands whose names are derived from the
name of the environment command.

The (seemingly) obvious approach:
\begin{verbatim}
\def\relay#1#2{\def\#1{#2}}
\end{verbatim}
doesn't work (the \TeX{} engine interprets it
as a rather strange redefinition of |\#|).  The trick is to use
\cs|csname|, which is a \TeX{} primitive for generating command names
from random text, together with \cs|expandafter|.  The definition
above should read:
\begin{verbatim}
\def\relay#1#2{%
  \expandafter\def\csname #1\endcsname{#2}%
}
\end{verbatim}
With this definition, \cmdinvoke{relay}{blah}{bleah} is equivalent to
\cs|def|\cmdinvoke{blah}{bleah}.

Note that the definition of \cs|relay| omits the braces round the
`command name' in the \cs|newcommand| it executes.  This is
because they're not necessary (in fact they seldom are), and in this
circumstance they make the macro code slightly more tedious.

The name created need not (of course) be \emph{just} the argument:
\begin{verbatim}
\def\newrace#1#2#3{%
  \expandafter\def\csname start#1\endcsname{%
    #2%
  }%
  \expandafter\def\csname finish#1\endcsname{%
    #3%
  }%
}
\end{verbatim}
With commands
\begin{verbatim}
\def\start#1{\csname start#1\endcsname}
\def\finish#1{\csname finish#1\endcsname}
\end{verbatim}
these `races' could behave a bit like \LaTeX{} environments.

\Question[Q-cvtlatex]{Transcribing \LaTeX{} command definitions}

At several places in this \acro{FAQ}, questions are answered in terms
of how to program a \LaTeX{} macro.  Sometimes, these macros might
also help users of Plain \TeX{} or other packages; this answer
attempts to provide a rough-and-ready guide to transcribing such macro
definitions for use in other packages.

The reason \LaTeX{} has commands that replace \cs|def|, is that
there's a general philosophy within \LaTeX{} that the user should be
protected from himself: the user has different commands according to
whether the command to be defined exists (\cs|renewcommand|) or not
(\cs|newcommand|), and if its status proves not as the user expected,
an error is reported.  A third definition command,
\cs|providecommand|, only defines if the target is not already
defined; \LaTeX{} has no direct equivalent of \cs|def|, which ignores
the present state of the command.  The final command of this sort is
\cs|DeclareRobustCommand|, which creates a command which is ``robust''
(i.e., will not expand if subjected to \LaTeX{} ``protected
expansion''); from the Plain~\TeX{} user's point of view,
\cs|DeclareRobustCommand| should be treated as a non-checking version
of \cs|newcommand|.

\LaTeX{} commands are, by default, defined \cs|long|; an optional |*|
between the \cs|newcommand| and its (other) arguments specifies that
the command is \emph{not} to be defined \cs|long|.  The |*| is
detected by a command \cs|@ifstar| which uses \cs|futurelet| to switch
between two branches, and gobbles the |*|: \LaTeX{} users are
encouraged to think of the |*| as part of the command name.

\LaTeX{}'s checks for unknown command are done by \cs|ifx| comparison
of a \cs|csname| construction with \cs|relax|; since the command name
argument is the desired control sequence name, this proves a little
long-winded.  Since |#1| is the requisite argument, we have:
\begin{narrowversion}
\begin{quote}
\begin{verbatim}
\expandafter\ifx
  \csname
    \expandafter\@gobble\string#1%
  \endcsname
  \relax
    ...
\end{verbatim}
\end{quote}
\end{narrowversion}
\begin{wideversion}
\begin{quote}
\begin{verbatim}
\expandafter\ifx
  \csname\expandafter\@gobble\string#1\endcsname
  \relax
    ...
\end{verbatim}
\end{quote}
\end{wideversion}
(\cs|@gobble| simply throws away its argument).

The arguments of a \LaTeX{} command are specified by two optional
arguments to the defining command: a count of arguments (0--9: if the
count is 0, the optional count argument may be omitted), and a default
value for the first argument, if the defined command's first command
is to be optional.  So:
\begin{quote}
\begin{verbatim}
\newcommand\foo{...}
\newcommand\foo[0]{...}
\newcommand\foo[1]{...#1...}
\newcommand\foo[2][boo]{...#1...#2...}
\end{verbatim}
\end{quote}
In the last case, \cs|foo| may be called as \cmdinvoke{foo}{goodbye},
which is equivalent to \cmdinvoke{foo}[boo]{goodbye} (employing the
default value given for the first argument), or as
\cmdinvoke{foo}[hello]{goodbye} (with an explicit first argument).

Coding of commands with optional arguments is exemplified by the
coding of the last \cs|foo| above:
\begin{quote}
\begin{verbatim}
\def\foo{\futurelet\next\@r@foo}
\def\@r@foo{\ifx\next[%
    \let\next\@x@foo
  \else
    \def\next{\@x@foo[boo]}%
  \fi
  \next
}
\def\@x@foo[#1]#2{...#1...#2...}
\end{verbatim}
\end{quote}

\Question[Q-empty]{Detecting that something is empty}

Suppose you need to know that the argument of your command is empty:
that is, to distinguish between \cmdinvoke{cmd}{} and
\cmdinvoke{cmd}{blah}.  This is pretty simple:
\begin{quote}
\begin{verbatim}
\def\cmd#1{%
  \def\tempa{}%
  \def\tempb{#1}%
  \ifx\tempa\tempb
    <empty case>
  \else
    <non-empty case>
  \fi
}
\end{verbatim}
\end{quote}
The case where you want to ignore an argument that consists of nothing
but spaces, rather than something completely empty, is more tricky.
It's solved in the code fragment \Package{ifmtarg}, which defines
commands \cs|@ifmtarg| and \cs|@ifnotmtarg|, which distinguish (in
opposite directions) between a second and third argument.  The
fragment makes challenging reading; there's also a discussion of the
issue in number two of the ``around the bend'' articles by the late
lamented Mike Downes.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}Around the bend series]\CTANref{aro-bend}
\item[ifmtarg.sty]\CTANref{ifmtarg}
\end{ctanrefs}

\subsection{\LaTeX{} macros}

\Question[Q-fixnam]{How to change \LaTeX{}'s ``fixed names''}

\LaTeX{} document classes define several typographic operations that
need `canned text' (text not supplied by the user).  In the earliest
days of \LaTeXo{} these bits of text were built in to the body of
\LaTeX{}'s macros and were rather difficult to change, but ``fixed
name'' macros were introduced for the benefit of those wishing to use
\LaTeX{} in languages other than English.
For example, the special section produced by the \cs|tableofcontents|
command is always called \cs|contentsname| (or rather, what
\cs|contentsname| is defined to mean).
Changing the canned text is now one of the easiest customisations a
user can do to \LaTeX{}.

The canned text macros are all of the form
|\|\texttt{\meta{thing}}|name|, and changing them is simplicity
itself.  Put:
\begin{quote}
  |\renewcommand{\|\texttt{\meta{thing}}|name}{Res minor}|
\end{quote}
in the preamble of your document, and the job is done.
(However, beware of the \Package{babel} package, which requires you to
use a different mechanism: be sure to check
% beware line wrap
\Qref[question]{changing \Package{babel} names}{Q-latexwords} if
you're using it.)

The names that are defined in the standard \LaTeX{} classes (and the
\Package{makeidex} package) are listed
below.  Some of the names are only defined in a subset of the classes
(and the \Class{letter} class has a set of names all of its own);
the list shows the specialisation of each name, where appropriate.

% tediously, our html tranlsator can't cope with tables...
\vspace*{3pt}\nothtml{\noindent}%
|\abstractname    |Abstract\\
|\alsoname        |see also (\Package{makeidx} package)\\
|\appendixname    |Appendix\\
|\bibname         |Bibliography (\Class{report},\Class{book})\\
|\ccname          |cc (\Class{letter})\\
|\chaptername     |Chapter (\Class{report},\Class{book})\\
|\contentsname    |Contents\\
|\enclname        |encl (\Class{letter})\\
|\figurename      |Figure (for captions)\\
|\headtoname      |To (\Class{letter})\\
|\indexname       |Index\\
|\listfigurename  |List of Figures\\
|\listtablename   |List of Tables\\
|\pagename        |Page (\Class{letter})\\
|\partname        |Part\\
|\refname         |References (\Class{article})\\
|\seename         |see (\Package{makeidx} package)\\
|\tablename       |Table (for captions)

\Question[Q-latexwords]{Changing the words \Package{babel} uses}

\LaTeX{} uses symbolic names for many of the automatically-generated
text it produces (special-purpose section headings, captions, etc.).
As noted in \Qref[question]{``\LaTeX fixed names''}{Q-fixnam} (which
includes a list of the names themselves),
this enables the user to change the
names used by the standard classes, which is particularly useful if
the document is being prepared in some language other than \LaTeX{}'s
default English.  So, for example, a Danish author may wish that her
table of contents was called ``Indholdsfortegnelse'', and so 
would expect to place a command
\begin{verbatim}
\renewcommand{\contentsname}%
    {Indholdsfortegnelse}
\end{verbatim}
in the preamble of her document.

However, it's natural for a user of a non-English language to use
\Package{babel}, because it offers many conveniences and typesetting
niceties for those preparing documents in those languages.  In
particular, when \Package{babel} is selecting a new language, it
ensures that \LaTeX{}'s symbolic names are translated appropriately
for the language in question.  Unfortunately, \Package{babel}'s choice
of names isn't always to everyone's choice, and there is still a need
for a mechanism to replace the `standard' names.

Whenever a new language is selected, \Package{babel} resets all the
names to the settings for that language.  In particular,
\Package{babel} selects the document's main language when
\cmdinvoke{begin}{document} is executed, which immediately destroys
any changes to these symbolic names made in the prologue of a document
that uses \Package{babel}. 

Therefore, babel defines a command to enable users to change the
definitions of the symbolic names, on a per-language basis:
\cs|addto|\cs|captions|\texttt{\meta{language}} is the thing
(\texttt{\meta{language}} being the language option you gave to
\Package{babel} in the first place).  For example:
\begin{verbatim}
\addto\captionsdanish{%
  \renewcommand{\contentsname}%
    {Indholdsfortegnelse}%
}
\end{verbatim}

\Question[Q-running-nos]{Running equation, figure and table numbering}

Many \LaTeX{} classes (including the standard \Class{book} class)
number things per chapter; so figures in chapter 1 are numbered 1.1,
1.2, and so on.  Sometimes this is not appropriate for the user's
needs.

Short of rewriting the whole class, one may use one of the
\Package{removefr} and \Package{remreset} packages; both define a
\cs|@removefromreset| command, and having included the package one
writes something like:
\begin{verbatim}
  \makeatletter
  \@removefromreset{figure}{chapter}
\end{verbatim}
and the automatic renumbering stops.  You then need to redefine the
way in which the figure number (in this case) is printed:
\begin{verbatim}
  \renewcommand{\thefigure}{\@arabic\c@figure}
  \makeatother
\end{verbatim}
(remember to do the whole job, for every counter you want to
manipulate, within \cs|makeatletter| \dots{}\@ \cs|makeatother|).

The technique may also be used to change where in a multilevel
structure a counter is reset.  Suppose your class numbers figures as
\meta{chapter}.\meta{section}.\meta{figure}, and you want figures
numbered per chapter, try:
\begin{htmlversion}
\begin{verbatim}
  \@removefromreset{figure}{section}
  \@addtoreset{figure}{chapter}
  \renewcommand{\thefigure}{\thechapter.\@arabic\c@figure}
\end{verbatim}
\end{htmlversion}
\htmlignore
\ifpdf
\begin{verbatim}
  \@removefromreset{figure}{section}
  \@addtoreset{figure}{chapter}
  \renewcommand{\thefigure}{\thechapter.\@arabic\c@figure}
\end{verbatim}
\else
\begin{verbatim}
  \@removefromreset{figure}{section}
  \@addtoreset{figure}{chapter}
  \renewcommand{\thefigure}%
               {\thechapter.\@arabic\c@figure}
\end{verbatim}
\fi
\endhtmlignore
(the command \cs|@addtoreset| is a part of \LaTeX{} itself).

The \Package{chngcntr} package provides a simple means to access the
two sorts of changes discussed, defining \cs|counterwithin| and
\cs|counterwithout| commands.
\begin{ctanrefs}
\item[chngcntr.sty]\CTANref{chngcntr}
\item[removefr.tex]\CTANref{removefr} (note, this is constructed as a
  ``fragment'' for use within other packages: load by
  \cmdinvoke{input}{removefr})
\item[remreset.sty]Distributed as part of \CTANref{carlisle}
\end{ctanrefs}

\Question[Q-atsigns]{\cs|@| and \texttt{@} in macro names}

Macro names containing \texttt{@} are \emph{internal} to \LaTeX{}, and
without special treatment just don't work in ordinary use.  An
exemplar of the problems caused is discussed in
\Qref[question]{``\cs|@| in vertical mode''}{Q-atvert}.

The problems users see are caused by copying bits of a class (|.cls| file) or
package (|.sty| file) into a document, or by including a class or
package file into a \LaTeX{} document by some means other than
\cs|documentclass| or \cs|usepackage|.  \LaTeX{} defines internal
commands whose names contain the character |@| to
avoid clashes between its internal names and names that we would
normally use in our documents.  In order that these commands may work
at all, \cs|documentclass| and \cs|usepackage| play around with the
meaning of |@|.

If you've included a file wrongly, you solve the problem by using the
correct command.

If you're using a fragment of a package or class, you may well feel
confused: books such as \nothtml{\emph{The \LaTeX{} Companion} (}%
\Qref{\emph{The \LaTeX{} Companion}}{Q-books}\nothtml{)} are full of
fragments of packages as examples for you to employ.

For example, there's a lengthy section in \emph{The Companion} about
\cs|@startsection| and how to use it to control the appearance of
section titles.  Page~15 discusses the problem; and
suggests that you make such changes in the document preamble, between
\cs|makeatletter| and \cs|makeatother|.  So the redefinition of
\cs|subsection| on page~26 could be:
\begin{verbatim}
  \makeatletter
  \renewcommand{\subsection}{\@startsection
    {subsection}%                    % name
    ...
    {\normalfont\normalsize\itshape}}% style
  \makeatother
\end{verbatim}

The alternative is to treat all these fragments as a package proper,
bundling them up into a |.sty| file and including them with
\cs|usepackage|.  (This approach is marginally preferable, from the
\LaTeX{} purist's point of view.)

\Question[Q-protect]{What's the reason for `protection'?}

Sometimes \LaTeX{} saves data it will reread later. These data are
often the argument of some command; they are the so-called moving
arguments.  (`Moving' because data are moved around.)  Places to look for
are all arguments that may go into table of contents, list of figures,
\emph{etc}.; namely, data that are written to an auxiliary file and
read in later.  Other places are those data that might appear in head-
or footlines.  Section headings and figure captions are the most
prominent examples; there's a complete list in Lamport's book
(see \Qref[question]{\TeX{}-related books}{Q-books}).

%You don't want to care about this stuff?  Simply |\protect| all
%\LaTeX{} commands within these moving arguments.

What's going on really, behind the scenes? The commands in the moving
arguments are already expanded to their internal structure during the
process of saving. Sometimes this expansion results in invalid \TeX{}
code when processed again. ``\cs|protect|\cs|cmd|'' tells \LaTeX{} to save
\cs|cmd| as \cs|cmd|, without expansion.

What is a `fragile command'?  It's a command that expands into illegal
\TeX{} code during the save process.

What is a `robust command'?  It's a command that expands into legal
\TeX{} code during the save process.

No-one (of course) likes this situation; the \LaTeX{}3 team have
removed the need for protection of some things in the production of
\LaTeXe{}, but the techniques available to them within current
\LaTeX{} mean that this is an expensive exercise.  It remains a
long-term aim of the team to remove all need for these things.

\Question[Q-edef]{\cs|edef| does not work with \cs|protect|}

Robust \LaTeX{} commands are either ``naturally robust''~--- meaning that
they never need \cs|protect|, or ``self-protected''~--- meaning that
they have \cs|protect| built in to their definition in some
way. Self-protected commands are robust only in a context where the
\cs|protect| mechanism is properly handled.  The body of an
\cs|edef| definition doesn't handle \cs|protect| properly, since
\cs|edef| is a \TeX{} primitive rather than a \LaTeX{} command.

This problem is resolved by a \LaTeX{} internal command
\cs|protected@edef|, which does the job of \cs|edef| while keeping the
\cs|protect| mechanism working.  There's a corresponding
\cs|protected@xdef| which does the job of \cs|xdef|.

Of course, these commands need to be tended carefully, since they're
% beware line break on next line
internal: see \Qref[question]{'@' in control sequence names}{Q-atsigns}.

\Question[Q-oarglikesect]{Optional arguments like \cs|section|}

Optional arguments, in macros defined using \cs|newcommand|, don't
quite work like the optional argument to \cs|section|.  The default
value of \cs|section|'s optional argument is the value of the
mandatory argument, but \cs|newcommand| requires that you `know' the
value of the default beforehand.

The requisite trick is to use a macro in the optional argument:
\begin{htmlversion}
\begin{verbatim}
\newcommand\thing[2][\DefaultOpt]{\def\DefaultOpt{#2} ...}
\end{verbatim}
\end{htmlversion}
\htmlignore
\ifpdf
\begin{verbatim}
\newcommand\thing[2][\DefaultOpt]{\def\DefaultOpt{#2} ...}
\end{verbatim}
\else
\begin{verbatim}
\newcommand\thing[2][\DefaultOpt]{%
  \def\DefaultOpt{#2}%
  ...%
}
\end{verbatim}
\fi
\endhtmlignore

\Question[Q-labelctr]{Making labels from a counter}

Suppose we have a \LaTeX{} counter, which we've defined with
\cmdinvoke{newcounter}{foo}.  We can increment the value of the counter
by \cmdinvoke{addtocounter}{foo}{1}, but that's pretty clunky for an
operation that happens so often \dots{}~so there's a command
\cmdinvoke{stepcounter}{foo} that does this special case of
increasing-by-one.

There's an internal \LaTeX{} variable, the ``current label'', that
remembers the last `labellable' thing that \LaTeX{} has processed.
You could (if you were to insist) set that value by the relevant
\TeX{} command (having taken the necessary precautions to ensure that
the internal command worked)~--- but it's not necessary.  If, instead
of either of the stepping methods above, you say
\cmdinvoke{refstepcounter}{foo}, the internal variable is set to the
new value, and (until something else comes along), \cs|label| will
refer to the counter.

\Question[Q-oddpage]{Finding if you're on an odd or an even page}

\Qref[Question]{Another question}{Q-marginparside} discusses the issue
of getting \cs|marginpar| commands to put their output in the correct
margin of two-sided documents.  This is an example of the general
problem of knowing where a particular bit of text lies: the output
routine is asynchronous, and \AllTeX{} will usually process quite a
bit of the ``next'' page before deciding to output any page.  As a
result, the |page| counter (known internally in \LaTeX{} as
\cs|c@page|) is normally only reliable when you're actually \emph{in}
the output routine.

The solution is to use some version of the \cs|label| mechanism to
determine which side of the page you're on; the value of the page
counter that appears in a \cs|pageref| command has been inserted in
the course of the output routine, and is therefore safe.

However, \cs|pageref| itself isn't reliable: one might hope that
\begin{verbatim}
\ifthenelse{\isodd{\pageref{foo}}}{odd}{even}
\end{verbatim}
would do the necessary, but both the \Package{babel} and
\Package{hyperref} packages have been known to interfere with the
output of \cs|pageref|; be careful!

The \Package{chngpage} package needs to provide this functionality for
its own use, and therefore provides a command \cs|checkoddpage|; this
sets a private-use label, and the page reference part of that label is
then examined (in a \Package{hyperref}-safe way) to set a conditional 
\cs|ifcpoddpage| true if the command was issued on an odd page.  Of
course, the \cs|label| contributes to \LaTeX{}'s ``Rerun to get
cross-references right'' error messages\dots{}
\begin{ctanrefs}
\item[chngpage.sty]\CTANref{chngpage}
\end{ctanrefs}

\Question[Q-labelformat]{How to change the format of labels}

By default, when a label is created, it takes on the appearance of the
counter labelled: specifically, it is set to
\cs|the<|\texttt{\textit{counter}}|>|~--- what would be used if you
asked to typeset the counter in your text.  This isn't always what you
need: for example, if you have nested enumerated lists with the outer
numbered and the inner labelled with letters, one might expect to want
to refer to items in the inner list as ``2(c)''.   (Remember, you can
\nothtml{change the structure of list items~--- }%
\Qref{change the structure of list items}{Q-enumerate}.)
The change is of course
possible by explicit labelling of the parent and using that label to
construct the typeset result~--- something like
\begin{quote}
\begin{verbatim}
\ref{parent-item}(\ref{child-item})
\end{verbatim}
\end{quote}
which would be both tedious and error-prone.  What's more, it would be
undesirable, since you would be constructing a visual representation
which is inflexible (you couldn't change all the references to elements
of a list at one fell swoop).

\LaTeX{} in fact has a label-formatting command built into every label
definition; by default it's null, but it's available for the user to
program.  For any label \meta{counter} there's a \LaTeX{} internal
command \cs|p@|\meta{\texttt{counter}}; for example, a label definition
on an inner list item is supposedly done using the command
\cmdinvoke{p@enumii}{\cs|theenumii|}.  Unfortunately, the internal
workings of this aren't quite right, and you need to patch the
\cs|refstepcounter| command:
\begin{quote}
\begin{verbatim}
\renewcommand*\refstepcounter[1]{\stepcounter{#1}%
  \protected@edef\@currentlabel{%
    \csname p@#1\expandafter\endcsname
      \csname the#1\endcsname
  }%
}
\end{verbatim}
\end{quote}
With the patch in place you can now, for example, change the labels on
all inner lists by adding the following code in your preamble:
\begin{quote}
\begin{verbatim}
\makeatletter
\renewcommand{\p@enumii}[1]{\theenumi(#1)}
\makeatother
\end{verbatim}
\end{quote}
This would make the labels for second-level enumerated lists appear as
``1(a)'' (and so on).  The analogous change works for any counter that
gets used in a \cs|label| command.

In fact, the \Package{fncylab} package does all the above (including
the patch to \LaTeX{} itself).  With the package, the code above is
(actually quite efficiently) rendered by the command:
\begin{quote}
\begin{verbatim}
\labelformat{enumii}{\theenumii(#1)}
\end{verbatim}
\end{quote}
In fact, the above example, which we can do in several different ways,
has been rendered obsolete by the appearance of the \Package{enumitem}
package, which is discussed in the answer about % ! line break
\Qref*{decorating enumeration lists}{Q-enumerate}.
\begin{ctanrefs}
\item[enumitem.sty]Distributed as part of \CTANref{bezos}
\item[fncylab.sty]\CTANref{fncylab}
\end{ctanrefs}

\Question[Q-twooptarg]{A command with two optional arguments}

% beware line breaks
If you've already read \nothtml{``breaking the 9-argument limit'' (}%
\htmlonly{``}\Qref[question]{breaking the 9-argument limit}{Q-moren9}\latexhtml{)}{''}
you can probably guess the solution to this problem: command relaying.

\LaTeX{} allows commands with a single optional argument thus:
\begin{verbatim}
  \newcommand{\blah}[1][Default]{...}
\end{verbatim}

You may legally call such a command either with its optional argument
present, as
\cmdinvoke{blah}[nonDefault] or as \cs|blah|; in the latter case, the
code of \cs|blah| will have an argument of |Default|.

To define a command with two optional arguments, we use the relaying
technique, as follows:
\begin{verbatim}
  \newcommand{\blah}[1][Default1]{%
    \def\ArgI{{#1}}%
    \BlahRelay
  }
  \newcommand\BlahRelay[1][Default2]{%
    % the first optional argument is now in
    %   \ArgI
    % the second is in #1
    ...%
  }
\end{verbatim}
Of course, \cs|BlahRelay| may have as many mandatory arguments as are
allowed, after allowance for the one taken up with its own
optional argument~--- that is, 8.

Variants of \cs|newcommand| (and friends), with names like
\cs|newcommandtwoopt|, are available in the \Package{twoopt} package.
However, if you can, it's probably better to learn to write the commands
yourself, just to see why they're not even a good idea from the
programming point of view.

A command with two optional arguments strains the limit of what's
sensible: obviously you can extend the technique to provide as many
optional arguments as your fevered imagination can summon.  However,
see the comments on the use of the \Package{keyval} package in 
% beware line breaks
\nothtml{``breaking the 9-argument limit'' (}%
\htmlonly{``}\Qref[question]{breaking the 9-argument limit}{Q-moren9}\latexhtml{)}{''},
which offer an alternative way forward.

An alternative approach is offered by Scott Pakin's
\ProgName{newcommand} program, which takes a command name and a
definition of a set of command arguments (in a fairly
readily-understood language), and emits \AllTeX{} macros which enable
the command to be defined.  The command requires that a
\ProgName{python} system be installed on your computer.

The distribution of \Package{twoopt} includes a file \File|twoopt.pdf|
file of its documentation; similarly the distribution of
\ProgName{newcommand} includes a file \File|newcommand.pdf| 
\begin{ctanrefs}
\item[newcommand.pdf]\CTANref{newcommand}
\item[twoopt.sty]Distributed as part of \CTANref{oberdiek}
\end{ctanrefs}

\Question[Q-seccntfmt]{Adjusting the presentation of section numbers}

The general issues of adjusting the appearance of section headings are
pretty complex, and are covered in % beware line breaks (2 lines)
\latexhtml{question}{the question on}
\Qref[\htmlonly]{the style of section headings}{Q-secthead}.

However, people regularly want merely to change the way the section
number appears in the heading, and some such people don't mind writing
out a few macros.  This answer is for \emph{them}.

The way the section number is typeset is determined by the 
\cs|@seccntformat| command, which is given the ``name'' (section,
subsection, \dots{}) of the heading, as argument.  Ordinarily, it
merely outputs the section number, and then a \cs|quad| of space.
Suppose you want to put a stop after every section (subsection,
subsubsection, \dots{}) number, a trivial change may be implemented by
simple modification of the command:
\begin{verbatim}
\renewcommand*{\@seccntformat}[1]{%
  \csname the#1\endcsname.\quad
}
\end{verbatim}

Most people (for some reason) just want a stop after a section
number.  To do this, one must make \cs|@seccntformat| switch according
to its argument.  The following technique for doing the job is
slightly wasteful, but is efficient enough:
\begin{verbatim}
\let\@@seccntformat\@seccntformat
\renewcommand*{\@seccntformat}[1]{%
  \expandafter\let\@tempa\expandafter
    \csname @seccntformat@#1\endcsname
  \ifx\@tempa\relax
    \expandafter\@@seccntformat
  \else
    \expandafter\@tempa
  \fi
    {#1}%
}
\end{verbatim}
which looks to see if a second-level command has been defined, and
uses it if so; otherwise it uses the original.  The second-level
command to define stops after section numbers (only) has the same
definition as the original ``all levels alike'' version:
\begin{verbatim}
\newcommand*{\@seccntformat@section}[1]{%
  \csname the#1\endcsname.\quad
}
\end{verbatim}

Note that all the command definitions of this answer are dealing in
\nothtml{\LaTeX{} internal commands (}% beware line break
\Qref{\LaTeX{} internal commands}{Q-atsigns}\nothtml{)}, so the above
code should be in a package file, for preference.

\Question[Q-cmdasenv]{Collect command arguments in an environment}

The inquisitive user, who examines the code of the \environment{lrbox}
environment, will find that, stripped of considerable complication
(which arises from the internal workings of \LaTeX{}), the environment
consists of:
\begin{verbatim}
\newenvironment{lrbox}[1]{%
  \setbox#1=\vbox\bgroup
}{%
  \egroup
}
\end{verbatim}
Which (even though it doesn't work as written here) might cause
optimism that one might redefine a command as an environment using
some elaboration of:
\begin{verbatim}
\newcommand{\fred}[1]{...}
\newenvironment{fredenv}{%
  \fred\bgroup
}{%
  \egroup
}
\end{verbatim}
Sadly, it doesn't work like that: not even
\begin{verbatim}
\fred\bgroup ... \egroup
\end{verbatim}
works.  Putting stuff on the argument stack crucially requires
\emph{real} braces.

To use an environment to collect the argument of a command, one really
needs to store the body of the environment separately.  Several
packages use such a technique, but the \Package{amsmath} package makes
it half-visible, as an internal command.  Use it as:
\begin{verbatim}
  \usepackage{amsmath}
  ...
  \makeatletter
  \newenvironment{fredenv}%
    {\collect@body \fred}%
    {}
  \makeatother
\end{verbatim}
With this definition, the body of the \environment{fredenv} will be
passed as an argument to the command \cs|fred|.

Note, however, that there's a tendency for stray spaces to appear in
the argument.  Judicious use of \cs|ignorespaces| before the argument,
and \cs|unskip| after the argument, in the macro \cs|fred|, may be
valuable.

If you want a command \cmdinvoke{jim}{arg1}{arg-to-collect}, the obvious
\begin{verbatim}
...
  {\collect@body{\jim{arg1}}}
...
\end{verbatim}
doesn't work; the argument of \cs|collect@body| has to be a single
token.  You achieve what you need by:
\begin{verbatim}
  \makeatletter
  \newcommand{\jimtemp}{}
  \newenvironment{jimenv}[1]%
    {%
      \renewcommand\jimtemp{\jim{#1}}
      \collect@body \jimtemp}%
    {}
  \makeatother
\end{verbatim}

Unfortunately, while the construction may be useful in some instances, it
does \emph{not} provide a means of avoiding restrictions on the use of
\cs|verb| in command arguments: the whole of the environment's body
passes through the argument of a command embedded in \cs|collect@body|.
\begin{ctanrefs}
\item[amsmath.sty]Distributed as part of the \AMSLaTeX{} bundle,
  \CTANref{amslatex}
\end{ctanrefs}

\Question[Q-spaftend]{There's a space added after my environment}

You've written your own environment \environment{env}, and it works
except that a space appears at the start of the first line of typeset
text after \cmdinvoke{end}{env}.  This doesn't happen with similar
\LaTeX{}-supplied environments.

You could impose the restriction that your users always put a
``\texttt{\textpercent}'' sign after the environment~\dots{}\nothtml{\@} but
\LaTeX{} environments don't require that, either.

The \LaTeX{} environments' ``secret'' is an internal flag which causes
the unwanted spaces to be ignored.  Fortunately, you don't have to use
the internal form: since 1996, \LaTeX{} has had a user command
\cs|ignorespacesafterend|, which sets the internal flag.

\Question[Q-labundef]{Finding if a label is undefined}

People seem to want to know (at run time) if a label is undefined (I
don't actually understand \emph{why}, particularly: it's a transient
state, and \LaTeX{} deals with it quite well).

A resolved label is simply a command:
\cs|r@|\meta{\texttt{label-name}}; determining if the label is set is
then simply a matter of detecting if the command exists.  The usual
\LaTeX{} internal way of doing this is to use the command
\cs|@ifundefined|:
\begin{quote}
  \cmdinvoke*{@ifundefined}{\texttt{r@}lab-name}{undef-cmds}{def-cmds}
\end{quote}
In which, \meta{lab-name} is exactly what you would use in
a \cs|label| command, and the remaining two arguments are command
sequences to be used if the label is undefined
(\meta{undef-cmds}) or if it is defined
(\texttt{\emph{def-cmds}}).

Note that any command that incorporates \cs|@ifundefined| is naturally
fragile, so remember to create it with \cs|DeclareRobustCommand| or to
use it with \cs|protect| in a moving argument.

If you're into this game, you may well not care about \LaTeX{}'s
warning about undefined labels at the end of the document; however,
if you are, include the command \cs|G@refundefinedtrue| in
\meta{\texttt{undef-cmds}}.

\Question[Q-ltxcmds]{The definitions of \LaTeX{} commands}

There are several reasons to want to know the definitions of \LaTeX{}
commands: from the simplest ``idle curiosity'', to the pressing need
to patch something to make it ``work the way you want it''.  None of
these are \emph{pure} motives, but knowledge and expertise seldom
arrive through the purest of motives.

The simple answer is to try \cs|show|, in a run of \LaTeX{} that is
taking commands from the terminal:
\begin{verbatim}
*\show\protected@edef
> \protected@edef=macro:
->\let \@@protect \protect
  \let \protect \@unexpandable@protect
  \afterassignment \restore@protect \edef .
\end{verbatim}
(I've rearranged the output there, from the rather confused version
\TeX{} itself produces.)  We may perhaps, now, wonder about
\cs|@unexpandable@protect|:
\begin{verbatim}
*\show\@unexpandable@protect
> \@unexpandable@protect=macro:
->\noexpand \protect \noexpand .
\end{verbatim}
and we're starting to see how one part of the \cs|protect|ion
mechanism works (one can probably fairly safely guess what
\cs|restore@protect| does).

Many kernel commands are declared robust:
\begin{verbatim}
*\show\texttt
> \texttt=macro:
->\protect \texttt  .
\end{verbatim}
so that \cs|show| isn't much help.  Define a command \cs|pshow| as
shown below, and use that instead:
\begin{verbatim}
*\def\pshow#1{{\let\protect\show #1}}
*\pshow\texttt
> \texttt =\long macro:
#1->\ifmmode \nfss@text {\ttfamily #1}%
    \else \hmode@bgroup \text@command {#1}%
          \ttfamily \check@icl #1\check@icr
    \expandafter \egroup \fi .
\end{verbatim}
Note that the command name that is protected is the `base' command,
with a space appended.  This is cryptically visible, in a couple of
places above.  (Again, the output has been sanitised.)

If one has a malleable text editor, the same investigation may more
comfortably be conducted by examining the file \File|latex.ltx| (which
is usually to be found, in a \acro{TDS} system, in directory
\path|tex/latex/base|).

In fact, \File|latex.ltx| is the product of a \ProgName{docstrip}
process on a large number of \nothtml{|.dtx| files (}% beware line break
\Qref{|.dtx| files}{Q-dtx}\nothtml{)}, and you can refer to those
instead.  The \LaTeX{} distribution includes a file
\File|source2e.tex|, and most systems retain it, again in
\path|tex/latex/base|.  \File|Source2e.tex| may be processed to
provide a complete source listing of the \LaTeX{} kernel (in fact the
process isn't entirely straightforward, but the file produces messages
advising you what to do).  The result is a huge document, with a
line-number index of control sequences the entire kernel and a
separate index of changes recorded in each of the files since the
\LaTeX{} team took over.

The printed kernel is a nice thing to have, but it's unwieldy and sits
on my shelves, seldom used.  One problem is that the comments are
patchy: the different modules range from well and lucidly documented,
through modules documented only through an automatic process that
converted the documentation of the source of \LaTeXo{}, to modules
that hardly had any useful documentation even in the \LaTeXo{} original.

In fact, each kernel module |.dtx| file will process separately
through \LaTeX{}, so you don't have to work with the whole of
\File|source2e|.  You can easily determine which module defines the
macro you're interested in: use your ``malleable text editor'' to find
the definition in \File|latex.ltx|; then search backwards from that
point for a line that starts |%%% From File:|~--- that line tells you 
the which |.dtx| file contains the definition you are interested in.
Doing this for \cs|protected@edef|, we find:
\begin{verbatim}
%%% From File: ltdefns.dtx
\end{verbatim}
When we come to look at it, \File|ltdefns.dtx| proves to contains
quite a dissertation on the methods of handling \cs|protect|ion; it
also contains some automatically-converted \LaTeXo{} documentation.

And of course, the kernel isn't all of \LaTeX{}: your command may be
defined in one of \LaTeX{}'s class or package files.  For example, we
find a definition of \cs|thebibliography| in \Class{article}, but
there's no \File|article.dtx|.  Some such files are generated from
parts of the kernel, some from other files in the distribution.  You
find which by looking at the start of the file: in \File|article.cls|,
we find:
\begin{verbatim}
%% This is file `article.cls',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% classes.dtx  (with options: `article')
\end{verbatim}
so we need to format \File|classes.dtx| to see the definition in
context.

All these .dtx files are on \acro{CTAN} as part of the main \LaTeX{}
distribution.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\LaTeX{} distribution]\CTANref{latex}
\end{ctanrefs}

\Question[Q-addtoreset]{Master and slave counters}

It's common to have things numbered ``per chapter'' (for example, in
the standard \Class{book} and \Class{report} classes, figures, tables
and footnotes are all numbered thus).  The process of resetting is
done automatically, when the ``master'' counter is stepped (when the
\cs|chapter| command that starts chapter \meta{n} happens, the
|chapter| counter is stepped, and all the dependent counters are set
to zero).

How would you do that for yourself?  You might want to number
algorithms per section, or corrolaries per theorem, for example.  If
you're defining these things by hand, you declare the relationship
when you define the counter in the first place:
\begin{quote}
\cmdinvoke*{newcounter}{new-name}[master]
\end{quote}
says that every time counter \meta{master} is stepped, counter
\meta{new-name} will be reset.

But what if you have an uncooperative package, that defines the
objects for you, but doesn't provide a programmer interface to make
the counters behave as you want?

The \cs|newcounter| command uses a \LaTeX{} internal command, and you
can also use it:
\begin{quote}
\cmdinvoke*{@addtoreset}{new-name}{master}
\end{quote}
(but remember that it needs to be between \cs|makeatletter| and
\cs|makeatother|, or in a package of your own).

The \Package{chngcntr} package encapsulates the \cs|@addtoreset|
command into a command \cs|counterwithin|.  So:
\begin{quote}
\begin{verbatim}
\counterwithin*{corrolary}{theorem}
\end{verbatim}
\end{quote}
will make the corrolary counter slave to theorem counters.  The
command without its asterisk:
\begin{quote}
\begin{verbatim}
\counterwithin{corrolary}{theorem}
\end{verbatim}
\end{quote}
will do the same, and also redefine \cs|thecorrolary| as % line brk!
\meta{theorem number}.\meta{corrolary number}, which is a good scheme
if you ever want to refer to the corrolaries~--- there are potentially
many ``corrolary~1'' in any document, so it's as well to tie its number
to the counter of the theorem it belongs to.  This is true of pretty
much any such counter-within-another; if you're not using the
\Package{chngcntr}, refer to the answer to % line break!
\Qref*{redefining counters' \csx{the-}commands}{Q-the-commands} for
the necessary techniques.

Note that the technique doesn't work if the master counter is |page|,
the number of the current page.  The |page| counter is stepped deep
inside the output routine, which usually gets called some time after
the text for the new page has started to appear: so special
techniques are required to deal with that.  One special case is dealt
with elsewhere: \Qref*{footnotes numbered per page}{Q-footnpp}.  One
of the techniques described there, using package \Package{perpage},
may be applied to any counter.  The command:
\begin{quote}
\cmdinvoke*{MakePerPage}{counter}
\end{quote}
will cause \meta{counter} to be reset for each page.  The package uses
a label-like mechanism, and may require more than one run of \LaTeX{}
to stabilise counter values~--- \LaTeX{} will generate the usual
warnings about labels changing.
\begin{ctanrefs}
\item[chngcntr.sty]\CTANref{chngcntr}
\item[perpage.sty]\CTANref{perpage}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Things are Going Wrong\dots{}}

\subsection{Getting things to fit}
\Question[Q-enlarge]{Enlarging \TeX{}}

The \TeX{} error message `capacity exceeded' covers a multitude of
problems.  What has been exhausted is listed in brackets after the
error message itself, as in:
\begin{verbatim}
  ! TeX capacity exceeded, sorry
..               [main memory size=263001].
\end{verbatim}
Most of the time this error can be fixed
\emph{without} enlarging \TeX{}. The most common causes are unmatched braces,
extra-long lines, and poorly-written macros. Extra-long lines are
often introduced when files are transferred incorrectly between
operating systems, and line-endings are not preserved properly (the
tell-tale sign of an extra-long line error is the complaint
that the `|buf_size|' has overflowed).

If you really need to extend your \TeX{}'s capacity, the proper method
depends on your installation.  There is no need (with modern \TeX{}
implementations) to change the defaults in Knuth's \acro{WEB} source;
but if you do need to do so, use a change file to modify the values set in
module 11, recompile your \TeX{} and regenerate all format files.

Modern implementations allow the sizes of the various bits of \TeX{}'s
memory to be changed semi-dynamically.  Some (such as em\TeX{}) allow
the memory parameters to be changed in command-line switches when
\TeX{} is started; most frequently, a configuration file is read which
specifies the size of the memory.  On \ProgName{web2c}-based systems,
this file is called \File|texmf.cnf|: see the documentation that comes
with the distribution for other implementations.  Almost invariably,
after such a change, the format files need to be regenerated after
changing the memory parameters.

\Question[Q-usepictex]{Why can't I load \PiCTeX{}?}

\PiCTeX{} is a resource hog; fortunately, most modern \TeX{}
implementations offer generous amounts of space, and most modern
computers are pretty fast, so users aren't too badly affected by its
performance.

However, \PiCTeX{} has the further unfortunate tendency to fill up
\TeX{}'s fixed-size arrays~--- notably the array of 256 `dimension'
registers.  This is a particular problem when you're using
\File|pictex.sty| with \LaTeX{} and some other packages that also need
dimension registers.  When this happens, you will see the \TeX{} error
message:
\begin{verbatim}
  ! No room for a new \dimen.
\end{verbatim}
There is nothing that can directly be done about this error: you
can't extend the number of available \cs|dimen| registers without
extending \TeX{} itself.
\begin{htmlversion}
  \Qref{\eTeX{}}{Q-NTS} and \Qref{Omega}{Q-omega} both do this, as
  does \Qref{MicroPress Inc's V\TeX{}}{Q-commercial}.
\end{htmlversion}
\htmlignore
  \eTeX{} and \ensuremath{\Omega}~--- \Qref[see questions]{}{Q-NTS}
  \Qref[and]{}{Q-omega} respectively~--- both do this, as does MicroPress Inc's
  V\TeX{}~--- \Qref{}{Q-commercial}.
\endhtmlignore

It's actually quite practical (with most modern distributions) to use
\eTeX{}'s extended register set: use package \Package{etex} (which
comes with \eTeX{} distributions) and the allocation mechanism is
altered to cope with the larger register set: \PiCTeX{} will now load.

If you're in some situation where you can't use \eTeX{}, you need to change
\PiCTeX{}; unfortunately \PiCTeX{}'s author is no longer active in the
\TeX{} world, so one must resort to patching.  There are two solutions
available.

The \CONTeXT{} module \File|m-pictex.tex| (for Plain \TeX{} and
variants) or the corresponding \LaTeX{} \Package{m-pictex} package provide
an ingenious solution to the problem based on hacking the code of
\cs|newdimen| itself.

Alternatively, Andreas Schell's \Package{pictexwd} and related
packages replace \PiCTeX{} with a version that uses 33 fewer
\cs|dimen| registers; so use \Package{pictexwd} in place of
\Package{pictex} (either as a \LaTeX{} package, or as a file to read
into Plain \TeX{}).

And how does one use \PiCTeX{} anyway, given that the
\Qref*{manual}{Q-docpictex} is so hard to come by?
Fortunately for \MSDOS{} and Windows users, the \ProgName{MathsPic}
system may be used to translate a somewhat different language into
\PiCTeX{} commands; and the \ProgName{MathsPic} manual is free (and
part of the distribution).  \ProgName{MathsPic} is written in
\ProgName{Basic}; a version written in \ProgName{Perl} is under
development, and should be available soon.
\begin{ctanrefs}
\item[m-pictex.sty]Distributed as part of \CTANref{context-tmf}
\item[m-pictex.tex]Distributed as part of \CTANref{context-tmf}
\item[MathsPic]\CTANref{mathspic}
\item[pictexwd.sty]Distributed as part of \CTANref{pictex-addon}
\end{ctanrefs}

% \Question[Q-miktexlatex]{Mik\TeX{} won't produce a \LaTeX{} format}
%
% Mik\TeX{} 1.20e, as distributed, ceased to work as from 1 December
% 2000.  Since 1.20e is not actively being developed, the 2000/06/01
% release of \LaTeX{} was not integrated into the distribution.  Since
% \LaTeX{} (prior to 2000/06/01) believed it should be upgraded every
% six months, the format making code sees a version that is nominally
% 18~months (three versions) old, and refuses to proceed.
%
% The solution is to be found by reading
% \URL{http://www.miktex.org/1.20/important.html}; in that page, there
% is a link to a replacement \File|latex.zip| for the distribution, and
% instructions for installing it.
%
% The problem has been fixed in versions of Mik\TeX{} released since 23
% January 2001.

\subsection{Making things stay where you want them}

\Question[Q-floats]{Moving tables and figures in \LaTeX{}}

Tables and figures have a tendency to surprise, by \emph{floating}
away from where they were specified to appear.  This is in fact
perfectly ordinary document design; any professional typesetting
package will float figures and tables to where they'll fit without
violating the certain typographic rules.  Even if you use the
placement specifier~|h| for `here', the figure or table will not be
printed `here' if doing so would break the rules; the rules themselves
are pretty simple, and are given on page~198, section~C.9 of the
\LaTeX{} manual.  In the worst case, \LaTeX{}'s rules can cause the
floating items to pile up to the extent that you get an error message
saying \nothtml{``Too many unprocessed floats'' (see }%
\Qref[question]{``Too many unprocessed floats''}{Q-tmupfl}\latexhtml{).}{.}
What follows is a simple checklist of things to do to solve these
problems (the checklist talks throughout about figures, but applies
equally well to tables, or to ``non-standard'' floats defined by the
\Package{float} or other packages).
\begin{itemize}
\item Do your figures need to float at all?  If not, consider the
  |[H]| placement option offered by the \Package{float} package:
  figures with this placement are made up to look as if they're
  floating, but they don't in fact float.  Beware outstanding floats,
  though: the \cs|caption| commands are numbered in the order they
  appear in the document, and a |[H]| float can `overtake' a float
  that hasn't yet been placed, so that figures numbers get out of
  order.
\item Are the placement parameters on your figures right?  The
  default (|tbp|) is reasonable, but you can reasonably change it (for
  example, to add an |h|).  Whatever you do, \emph{don't}
  omit the `|p|': doing so could cause \LaTeX{} to believe that if you
  can't have your figure \emph{here}, you don't want it
  \emph{anywhere}.  (\LaTeX{} does try hard to avoid being confused in
  this way\dots{})
\item \LaTeX{}'s own float placement parameters could be preventing
  placements that seem entirely ``reasonable'' to you~--- they're
  notoriously rather conservative.  To encourage \LaTeX{} not to move
  your figure, you need to loosen its demands.  (The most important
  ones are the ratio of text to float on a given page, but it's
  sensible to have a fixed set that changes the whole lot, to meet
  every eventuality.)
\begin{verbatim}
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
\end{verbatim}
  The meanings of these
  parameters are described on pages~199--200, section~C.9 of the
  \LaTeX{} manual.
\item Are there places in your document where you could `naturally'
  put a \cs|clearpage| command?  If so, do: the backlog of floats is
  cleared after a \cs|clearpage|.  (Note that the \cs|chapter|
  command in the standard \Class{book} and \Class{report} classes
  implicitly executes \cs|clearpage|, so you can't float past
  the end of a chapter.)
\item Try the \Package{placeins} package: it defines a
  \cs|FloatBarrier| command beyond which floats may not pass.  A
  package option allows you to declare that floats may not pass a
  \cs|section| command, but you can place \cs|FloatBarrier|s wherever
  you choose.
\item If you are bothered by floats appearing at the top of the page
  (before they are specified in your text), try the \Package{flafter}
  package, which avoids this problem by insisting that floats should
  always appear after their definition.
\item Have a look at the \LaTeXe{} |afterpage| package.
  Its documentation gives as an example the idea
  of putting \cs|clearpage| \emph{after} the current page (where it
  will clear the backlog, but not cause an ugly gap in your text), but
  also admits that the package is somewhat fragile.  Use it as a last
  resort if the other two possibilities below don't help.
\item If you would actually \emph{like} great blocks of floats at the
  end of each of your chapters, try the \Package{morefloats} package;
  this `simply' increases the number of floating inserts that \LaTeX{}
  can handle at one time (from~18 to~36).
\item If you actually \emph{wanted} all your figures to float to the
  end (\emph{e.g}., for submitting a draft copy of a paper), don't
  rely on \LaTeX{}'s mechanism: get the \Package{endfloat} package to do
  the job for you.
\end{itemize}
\begin{ctanrefs}
\item[afterpage.sty]Distributed as part of \CTANref{2etools}
\item[endfloat.sty]\CTANref{endfloat}
\item[flafter.sty]Part of the \LaTeX{} distribution
\item[float.sty]\CTANref{float}
\item[morefloats.sty]\CTANref{morefloats}
\item[placeins.sty]\CTANref{placeins}
\end{ctanrefs}

\Question[Q-underline]{Underlined text won't break}

Knuth made no provision for underlining text: he took the view that
underlining is not a typesetting operation, but rather one that
provides emphasis on typewriters, which typically offer but one
typeface.  The corresponding technique in typeset text is to switch
from upright to italic text (or vice-versa): the \LaTeX{} command
\cs|emph| does just that to its argument.

Nevertheless, typographically illiterate people (such as those that
specify double-spaced
\nothtml{thesis styles~--- }\Qref{thesis styles}{Q-linespace})
continue to require underlining of us, so \LaTeX{} as distributed
defines an \cs|underline| command that applies the mathematical
`underbar' operation to text.  This technique is not entirely
satisfactory, however: the text gets stuck into a box, and won't break
at line end.

Two packages are available that solve this problem.  The
\Package{ulem} package redefines the
\cs|emph| command to underline its argument; the underlined text thus
produced behaves as ordinary emphasised text, and will break over the
end of a line.  (The package is capable of other peculiar effects,
too: read its documentation, contained within the file itself.)
The \Package{soul} package defines an \cs|ul| command (after which the
package is, in part, named) that underlines running text.

Beware of \Package{ulem}'s default behaviour, which is to convert the
\cs|emph| command into an underlining command; this can be avoided by
loading the package with:
\begin{verbatim}
  \usepackage[normalem]{ulem}
\end{verbatim}
Documentation of \Package{ulem} is in the package itself.
\begin{ctanrefs}
\item[ulem.sty]\CTANref{ulem}
\item[soul.sty]\CTANref{soul}
\end{ctanrefs}

\Question[Q-widows]{Controlling widows and orphans}

Widows (the last line of a paragraph at the start of a page) and
orphans (the first line of paragraph at the end of a page) interrupt
the reader's flow, and are generally considered ``bad form'';
\AllTeX{} takes some precautions to avoid them, but completely
automatic prevention is often impossible.  If you are typesetting your
own text, consider whether you can bring yourself to change the
wording slightly so that the page break will fall differently.

The page maker, when forming a page, takes account of
\cs|widowpenalty| and \cs|clubpenalty| (which relates to orphans!).
These penalties are usually set to the moderate value of |150|; this
offers mild discouragement of bad breaks.  You can increase the values
by saying (for example) \cs|widowpenalty||=500|; however, vertical
lists (such as pages are made of) typically have rather little
stretchability or shrinkability, so if the page maker has to balance
the effect of stretching the unstretchable and being penalised, the
penalty will seldom win.  This dichotomy can be avoided by allowing
the pagemaker to run pages short, by using the \cs|raggedbottom|
directive; however, many publishers insist on the default
\cs|flushbottom|; it is seldom acceptable to introduce stretchability
into the vertical list, except at points (such as section headings)
where the document design explicitly permits it.

Once you've exhausted the automatic measures, and have a final draft
you want to ``polish'', you have to indulge in manual measures.  To
get rid of an orphan is simple: precede the paragraph with
\cs|clearpage| and the paragraph can't start in the wrong place.

Getting rid of a widow can be more tricky.  If the paragraph is a long
one, it may be possible to set it `tight': say |\looseness||=-1|
immediately after the last word of the paragraph.  If that doesn't
work, try adjusting the page size:
\cmdinvoke{enlargethispage}{\csx{baselineskip}} may do the job, and
get the whole paragraph on one page.  Reducing the size of the page by
\cmdinvoke{enlargethispage}{-\csx{baselineskip}} may produce a
(more-or-less) acceptable ``two-line widow''.  (Note: |\looseness||=1|,
increasing the line length by one, seldom seems to work~--- the looser
paragraph typically has a one-word final line, which doesn't look much
better than the straight widow.)

\subsection{Things have ``gone away''}

\Question[Q-oldfontnames]{Old \LaTeX{} font references such as \cs|tenrm|}

\LaTeXo{} defined a large set of commands for access to the fonts
that it had built in to itself.  For example, various flavours of
|cmr| could be found as \cs|fivrm|, \cs|sixrm|, \cs|sevrm|,
\cs|egtrm|, \cs|ninrm|, \cs|tenrm|, \cs|elvrm|, \cs|twlrm|,
\cs|frtnrm|, \cs|svtnrm|, \cs|twtyrm| and \cs|twfvrm|.
These commands were never documented, but certain packages
nevertheless used them to achieve effects they needed.

Since the commands weren't public, they weren't included in \LaTeXe{};
to use the unconverted \LaTeXo{} packages under \LaTeXe{}, you need
also to include the \Package{rawfonts} package (which is part of the
\LaTeXe{} distribution).

\Question[Q-missssymb]{Missing symbol commands}

You're processing an old document, and some symbol commands such as
\cs|Box| and \cs|lhd| appear no longer to exist.  These commands were
present in the core of \LaTeXo{}, but are not in current \LaTeX{}.
They are available in the \Package{latexsym} package (which is part of
the \LaTeX{} distribution), and in the \Package{amsfonts} package
(which is part of the \acro{AMS} distribution, and requires \acro{AMS}
symbol fonts).
\begin{ctanrefs}
\item[amsfonts.sty]\CTANref{amsfonts-latex}
\item[AMS symbol fonts]\CTANref{amsfonts-symbols}
\end{ctanrefs}

\Question[Q-msxy]{Where are the \texttt{msx} and \texttt{msy} fonts?}

The |msx| and |msy| fonts were designed by the American Mathematical
Society in the very early days of \TeX{}, for use in typesetting
papers for mathematical journals.  They were designed using the `old'
\MF{}, which wasn't portable and is no longer available; for a long
time they were only available in 300dpi versions which only
imperfectly matched modern printers.  The \acro{AMS} has now redesigned the
fonts, using the current version of \MF{}, and the new versions are
called the |msa| and |msb| families.

Nevertheless, |msx| and |msy| continue to turn up to plague us.  There
are, of course, still sites that haven't got around to upgrading; but,
even if everyone upgraded, there would still be the problem of old
documents that specify them.

If you have a |.tex| source that requests |msx| and |msy|, the best
technique is to edit it so that it requests |msa| and |msb| (you only
need to change the single letter in the font names).

If you have a \acro{DVI} file that requests the fonts, there is a package
of
\htmlignore
virtual fonts (\Qref{}{Q-virtualfonts})
\endhtmlignore
\begin{htmlversion}
\Qref{virtual fonts}{Q-virtualfonts}
\end{htmlversion}
to map the old to the new series.
\begin{ctanrefs}
\item[msa and msb fonts]\CTANref{amsfonts-symbols}
\item[virtual font set]\CTANref{msx2msa}
\end{ctanrefs}

\Question[Q-amfonts]{Where are the \texttt{am} fonts?}

One \emph{still} occasionally comes across a request for the |am|
series of fonts.  The initials stood for `Almost [Computer] Modern',
and they were the predecessors of the Computer Modern fonts that we
all know and love (or hate)%
\begin{footnoteenv}
  The fonts acquired their label `Almost' following the realisation
  that their first implementation in \MF{}79 still wasn't quite right;
  Knuth's original intention had been that they were the final answer
\end{footnoteenv}.
There's not a lot one can do with these
fonts; they are (as their name implies) almost (but not quite) the
same as the |cm| series; if you're faced with a document that requests
them, all you can reasonably do is to edit the document.  The
appearance of \acro{DVI} files that request them is sufficiently rare that
no-one has undertaken the mammoth task of creating a translation of
them by means of virtual fonts; however, most drivers let you have a
configuration file in which you can specify font substitutions. If you
specify that every |am| font should be replaced by its corresponding
|cm| font, the output should be almost correct.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Why does it \emph{do} that?}

\subsection{Common errors}

\Question[Q-crossref]{\LaTeX{} gets cross-references wrong}

Sometimes, however many times you run \LaTeX{}, the cross-references
are just wrong. Remember that
the |\label| command must come \emph{after} the |\caption| command, or
be part of it. For example,
\htmlignore
\par\noindent
\begin{tabular}{@{}lll}
|\begin{figure}|     &    & |\begin{figure}|\\
|\caption{A Figure}| & or & |\caption{A Figure%| \\
|\label{fig}|        &    & |      \label{fig}}| \\
|\end{figure}|       &    & |\end{figure}| \\
\end{tabular}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
\begin{figure}          \begin{figure}
\caption{A Figure}  or  \caption{A Figure%
\label{fig}                   \label{fig}}
\end{figure}            \end{figure}
\end{verbatim}
\end{htmlversion}

You can, just as effectively, shield the \cs|caption| command from its
associated \cs|label| command, by enclosing the caption in an
environment of its own.  For example, people commonly seek help after:
\begin{verbatim}
  \begin{center}
    \caption{A Figure}
  \end{center}
  \label{fig}
\end{verbatim}
has failed to label correctly.  If you really need this centring (and
those in the know commonly reject it), code it as:
\begin{verbatim}
  \begin{center}
    \caption{A Figure}
    \label{fig}
  \end{center}
\end{verbatim}

\Question[Q-newlineargs]{Start of line goes awry}

This answer concerns two sorts of problems: errors of the form
\begin{verbatim}
! Missing number, treated as zero.
<to be read again> 
                   g
<*> [grump]
\end{verbatim}
and those where a single asterisk at the start of a line mysteriously
fails to appear in the output.

Both problems arise because |\|{}|\| takes optional arguments.  The
command |\|{}|\*| means ``break the line here, and inhibit page break
following the line break''; the command |\|{}|\[|\meta{dimen}|]|
means ``break the line here and add \meta{dimen} extra vertical space
afterwards''.

So why does |\|{}|\| get confused by these things at the start of a
line?  It's looking for the first non-blank thing, and in the test it
uses ignores the end of the line in your input text.

The solution is to enclose the stuff at the start of the new line in
braces:
\begin{verbatim}
{\ttfamily
  /* C-language comment\\
  {[grump]} I don't like this format\\
  {*}/
}
\end{verbatim}
(The above text derives from an actual post to
\Newsgroup|comp.text.tex|; this particular bit of typesetting could
plainly also be done using the \environment{verbatim} environment.)

The problem also appears in maths mode, in arrays and so on.  In this
case, large-scale bracketing of things is \emph{not} a good idea; the
\TeX{} primitive \cs|relax| (which does nothing except to block
searches of this nature) may be used.  From another
\Newsgroup|comp.text.tex| example:
\begin{verbatim}
\begin{eqnarry}
  [a] &=& b \\
  \relax[a] &=& b
\end{eqnarry}
\end{verbatim}
which is a usage this \acro{FAQ} would not recommend, anyway: refer
to the \Qref*{reason not to use \environment{eqnarray}}{Q-eqnarray}.

\Question[Q-verbwithin]{Why doesn't \cs|verb| work within\dots{}?}

The \LaTeX{} verbatim commands work by changing category codes.  Knuth
says of this sort of thing ``Some care is needed to get the timing
right\dots{}'', since once the category code has been assigned to a
character, it doesn't change.  So \cs|verb| has to assume that it is
getting the first look at its parameter text; if it isn't, \TeX{} has
already assigned category codes so that \cs|verb| doesn't have a
chance.  For example:
\begin{verbatim}
    \verb+\error+
\end{verbatim}
will work (typesetting `\cs|error|'), but
\begin{verbatim}
    \newcommand{\unbrace}[1]{#1}
    \unbrace{\verb+\error+}
\end{verbatim}
will not (it will attempt to execute \cs|error|).  Other errors one
may encounter are `\cs|verb| ended by end of line', or even `\cs|verb|
illegal in command argument'.

This is why the \LaTeX{} book insists that verbatim
commands must not appear in the argument of any other command; they
aren't just fragile, they're quite unusable in any command parameter,
regardless of
\htmlignore
\cs|protect|ion (\Qref{}{Q-protect}).
\endhtmlignore
\begin{htmlversion}
\Qref{\cs|protect|ion}{Q-protect}.
\end{htmlversion}

The first question to ask yourself is: ``is \cs|verb| actually
necessary?''.
\begin{itemize}
\item If \cmdinvoke{texttt}{\emph{your text}} produces the same result
  as \cs|verb||+|\texttt{\emph{your text}}|+|, then there's no need of
  \cs|verb| in the first place.
\item If you're using \cs|verb| to typeset a \acro{URL} or email
  address or the like, then the \cs|url| command from the
  \Package{url} package will help: it doesn't suffer from the problems
  of \cs|verb|.
\item If you're putting \cs|verb| into the argument of a boxing
  command (such as \cs|fbox|), consider using the \environment{lrbox}
  environment:
\begin{verbatim}
  \newsavebox{\mybox}
  ...
  \begin{lrbox}{\mybox}
    \verb!VerbatimStuff!
  \end{lrbox}
  \fbox{\usebox{\mybox}}
\end{verbatim}
\end{itemize}

Otherwise, there are three partial solutions to the problem.
\begin{itemize}
\item The \Package{fancyvrb} package defines a command
  \cs|VerbatimFootnotes|, which redefines the \cs|footnotetext| (and
  hence the \cs|footnote|) commands in such a way that you can include
  \cs|verb| commands in its argument.  This approach could in
  principle be extended to the arguments of other commands, but it can
  clash with other packages: for example, \cs|VerbatimFootnotes|
  interacts poorly with the |para| option to the \Package{footmisc}
  package.
\item The \Package{fancyvrb} package defines a command \cs|SaveVerb|,
  with a corresponding \cs|UseVerb| command, that allow you to save
  and then to reuse the content of its argument; for details of this
  extremely powerful facility, see the package documentation.

  Rather simpler is the \Package{verbdef} package, which defines a
  (robust) command which expands to the verbatim argument given.
\item If you have a single character that is giving trouble (in
  its absence you could simply use \cs|texttt|), consider using
  \cs|string|.  |\texttt{my\string_name}| typesets the same as
  |\verb+my_name+|, and will work in the argument of a command.  It
  won't, however, work in a moving argument, and no amount of
  \nothtml{\cs|protect|ion (}%
  \Qref{\cs|protect|ion}{Q-protect}\nothtml{)} will make it work in
  such a case.
\end{itemize}
Documentation of both \Package{url} and \Package{verbdef} is in the
package files.
\begin{ctanrefs}
\item[fancyvrb.sty]\CTANref{fancyvrb}
\item[url.sty]\CTANref{url}
\item[verbdef.sty]\CTANref{verbdef}
\end{ctanrefs}

\Question[Q-noline]{No line here to end}

The error
\begin{htmlversion}
\begin{verbatim}
! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
\end{verbatim}
\end{htmlversion}
\htmlignore
\ifpdf
\begin{verbatim}
! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion for explanation.
\end{verbatim}
\else
\begin{verbatim}
! LaTeX Error: There's no line here to end.

See the LaTeX manual or LaTeX Companion
...                           for explanation.
\end{verbatim}
\fi
\endhtmlignore
comes in reaction to you giving \LaTeX{} a |\|{}|\| command at a time
when it's not expecting it.  The commonest case is where you've
decided you want the label of a list item to be on a line of its own,
so you've written (for example):
\begin{verbatim}
  \begin{description}
  \item[Very long label] \\
    Text...
  \end{description}
\end{verbatim}
|\|{}|\| is actually a rather bad command to use in this case (even if
it worked), since it would force the `paragraph' that's made up of the
text of the item to terminate a line which has nothing on it but the
label.  This would lead to an ``|Underfull \hbox|'' warning message
(usually with `infinite' badness of 10000); while this message doesn't
do any actual harm other than slowing down your \LaTeX{} run, any
message that doesn't convey any information distracts for no useful
purpose.

The proper solution to the problem is to write a new sort of
\environment{description} environment, that does just what you're after.  (The
\nothtml{\emph{\LaTeX{} Companion}~--- see }% beware line wrap
\Qref[question]{\LaTeX{} Companion}{Q-books}\nothtml{~---} offers a
rather wide selection of variants of these things.)

The quick-and-easy solution, which avoids the warning, is to write:
\begin{verbatim}
  \begin{description}
  \item[Very long label] \hspace*{\fill} \\
    Text...
  \end{description}
\end{verbatim}
which fills out the under-full line before forcing its closure.  The
\Package{expdlist} package provides the same functionality with its
\cs|breaklabel| command, and \Package{mdwlist} provides it via its
\cs|desclabelstyle| command.

The other common occasion for the message is when you're using the
\texttt{center} (or \environment{flushleft} or \environment{flushright})
environment, and have decided you need extra separation between lines
in the environment:
\begin{verbatim}
  \begin{center}
    First (heading) line\\
    \\
    body of the centred text...
  \end{center}
\end{verbatim}

The solution here is plain: use the |\|{}|\| command in the way it's
supposed to be used, to provide more than just a single line break
space.  |\|{}|\| takes an optional argument, which specifies how much
extra space to add; the required effect in the text above can be had
by saying:
\begin{verbatim}
  \begin{center}
    First (heading) line\\[\baselineskip]
    body of the centred text...
  \end{center}
\end{verbatim}
\begin{ctanrefs}
\item[expdlist.sty]\CTANref{expdlist}
\item[mdwlist.sty]Distributed as part of \CTANref{mdwtools}
\end{ctanrefs}

\Question[Q-2colfltorder]{Two-column float numbers out of order}

When \LaTeX{} can't place a float immediately, it places it on one of
several ``defer'' lists.  If another float of the same type comes
along, and the ``defer'' list for that type still has something in it,
the later float has to wait for everything earlier in the list.

Now, standard \LaTeX{} has different lists for single-column floats,
and double-column floats; this means that single-column figures can
overtake double-column figures (or vice-versa), and you observe later
figures appear in the document before early ones.  The same is true,
of course, for tables, or for any user-defined float.

The \LaTeX{} team recognise the problem, and provides a package
(\Package{fixltx2e}) to deal with it.  \Package{Fixltx2e} amalgamates
the two defer lists, so that floats don't get out of order.

For those who are still running an older \LaTeX{} distribution, the
package \Package{fix2col} should serve.  This package (also by a
member of the \LaTeX{} team) was the basis of the relevant part of
\Package{fixltx2e}.

Once you have loaded the package, no more remains to be done: the
whole requirement is to patch the output routine; no extra commands
are needed.
\begin{ctanrefs}
\item[fix2col.sty]Distributed as part of \CTANref{carlisle}
\item[fixltx2e.sty]Part of the \LaTeX{} distribution.
\end{ctanrefs}

\subsection{Common misunderstandings}

\Question[Q-include]{What's going on in my \cs|include| commands?}

The original \LaTeX{} provided the \cs|include| command to address the
problem of long documents: with the relatively slow computers of the
time, the companion \cs|includeonly| facility was a boon.  With the
vast increase in computer speed, \cs|includeonly| is less valuable
(though it still has its place in some very large projects).
Nevertheless, the facility is retained in current \LaTeX{}, and causes
some confusion to those who misunderstand it.

In order for \cs|includeonly| to work, \cs|include| makes a separate
|.aux| file for each included file, and makes a `checkpoint' of
important parameters (such as page, figure, table and footnote
numbers); as a direct result, it \emph{must} clear the current page
both before and after the \cs|include| command.  What's more, this
mechanism doesn't work if a \cs|include| command appears in a file
that was \cs|include|d itself: \LaTeX{} diagnoses this as an error.

So, we can now answer the two commonest questions about \cs|include|:
\begin{itemize}
\item Why does \LaTeX{} throw a page before and after \cs|include|
  commands?

  Answer: because it has to.  If you don't like it, replace the
  \cs|include| command with \cs|input|~--- you won't be able to use
  \cs|includeonly| any more, but you probably don't need it anyway, so
  don't worry.
\begin{htmlversion}

\end{htmlversion}
\item Why can't I nest \cs|include|d files?~--- I always used to be
  able to under \LaTeXo{}.

  Answer: in fact, you couldn't, even under \LaTeXo{}, but the failure
  wasn't diagnosed.  However, since you were happy with the behaviour
  under \LaTeXo{}, replace the \cs|include| commands with \cs|input|
  commands (with \cs|clearpage| as appropriate).
\end{itemize}


\Question[Q-paraparam]{Why does it ignore paragraph parameters?}

When \TeX{} is laying out text, it doesn't work from word to word, or
from line to line; the smallest complete unit it formats is the
paragraph.  The paragraph is laid down in a buffer, as it appears, and
isn't touched further until the end-paragraph marker is processed.
It's at this point that the paragraph parameters have effect; and it's
because of this sequence that one often makes mistakes that lead to
the paragraph parameters not doing what one would have hoped (or
expected).

Consider the following sequence of \LaTeX{}:
\begin{verbatim}
  {\raggedright % declaration for ragged text
  Here's text to be ranged left in our output,
  but it's the only such paragraph, so we now
  end the group.}

  Here's more that needn't be ragged...
\end{verbatim}
\TeX{} will open a group, and set the ragged-setting parameters within
that group; it will then save a couple of sentences of text and
close the group (thus restoring the previous value of the
ragged-setting parameters).  Then it encounters a blank line, which it
knows to treat as a \cs|par| token, so it typesets the two sentences;
but because the enclosing group has now been closed, the parameter
settings have been lost, and the paragraph will be typeset normally.

The solution is simple: close the paragraph inside the group, so that
the setting parameters remain in place.  An appropriate way of doing
that is to replace the last three lines above with:
\begin{verbatim}
  end the group.\par}
  Here's more that needn't be ragged...
\end{verbatim}
In this way, the paragraph is completed while the setting parameters
are still in force within the enclosing group.

Another alternative is to define an environment that does the
appropriate job for you.  For the above example, \LaTeX{} already
defines an appropriate one:
\begin{verbatim}
\begin{flushleft}
  Here's text to be ranged left...
\end{flushleft}
\end{verbatim}

\Question[Q-casechange]{Case-changing oddities}

\TeX{} provides two primitive commands \cs|uppercase| and
\cs|lowercase| to change the case of text; they're not much used, but
are capable creating confusion.

The two commands do not expand the text that is their parameter~---
the result of \cs|uppercase{abc}| is `|ABC|', but |\uppercase{\abc}|
is always `|\abc|', whatever the meaning of \cs|abc|.  The commands
are simply interpreting a table of equivalences between upper- and
lowercase characters.
They have (for example) no mathematical sense, and
\begin{verbatim}
  \uppercase{About $y=f(x)$}
\end{verbatim}
will produce
\begin{verbatim}
  ABOUT $Y=F(X)$
\end{verbatim}
which is probably not what is wanted.

In addition, \cs|uppercase| and \cs|lowercase| do not deal very well
with non-American characters, for example |\uppercase{\ae}| is the
same as \cs|ae|.

\LaTeX{} provides commands \cs|MakeUppercase| and \cs|MakeLowercase|
which fixes the latter problem.  These commands are used in the
standard classes to produce upper case running heads for chapters
and sections.

Unfortunately \cs|MakeUppercase| and \cs|MakeLowercase| do not solve
the other problems with \cs|uppercase|, so for example a section
title containing \cs|begin{tabular}| \dots{} \cs|end{tabular}| will
produce a running head containing \cs|begin{TABULAR}|.  The simplest
solution to this problem is using a user-defined command, for
example: 
\begin{verbatim}
   \newcommand{\mytable}{\begin{tabular}...
      \end{tabular}}
   \section{A section title \protect\mytable{}
       with a table}
\end{verbatim}
Note that \cs|mytable| has to be protected, otherwise it will be
expanded and made upper case; you can achieve the same result by
declaring it with \cs|DeclareRobustCommand|, in which case the
\cs|protect| won't be necessary.

David Carlisle's \Package{textcase} package
addresses many of these problems in a transparent way.  It defines
commands \cs|MakeTextUppercase| and \cs|MakeTextLowercase| which do
upper- or lowercase, with the fancier features of the \LaTeX{}
standard \cs|Make*|-commands but without the problems
mentioned above.  Load the package with
\cmdinvoke{usepackage}[overload]{textcase}, and it will redefine the \LaTeX{}
commands (\emph{not} the \TeX{} primitive commands \cs|uppercase| and
\cs|lowercase|), so that section headings and the like don't produce
broken page headings.
\begin{ctanrefs}
\item[textcase.sty]Distributed as part of \CTANref{carlisle}
\end{ctanrefs}

\Question[Q-splitfoot]{Why does \LaTeX{} split footnotes across pages?}

\LaTeX{} splits footnotes when it can think of nothing better to do.
Typically, when this happens, the footnote mark is at the bottom of
the page, and the complete footnote would overfill the page.  \LaTeX{}
could try to salvage this problem by making the page short of both the
footnote and the line with the footnote mark, but its priorities told
it that splitting the footnote would be preferable.

As always, the best solution is to change your text so that the
problem doesn't occur in the first place.  Consider whether the text
that bears the footnote could move earlier in the current page, or on
to the next page.

If this isn't possible, you might want to change \LaTeX{}'s perception
of its priorities: they're controlled by
\cs|interfootnotelinepenalty|~--- the larger it is, the less willing
\LaTeX{} is to split footnotes.

Setting
\begin{verbatim}
  \interfootnotelinepenalty=10000
\end{verbatim}
inhibits split footnotes altogether, which will cause `|Underfull|
\cs|vbox|' messages unless you also specify \cs|raggedbottom|.  The
default value of the penalty is 100, which is rather mild.

An alternative technique is to juggle with the actual size of the
pages.  \cs|enlargethispage| changes the size of the current page by
its argument (for example, you might say
|\enlargethispage{\baselineskip}| to add a single line to the page,
but you can use any ordinary \TeX{} length such as |15mm| or |-20pt|
as argument).  Reducing the size of the current page could force the
offending text to the next page; increasing the size of the page may
allow the footnote to be included in its entirety.  It may be
necessary to change the size of more than one page.

The \Package{fnbreak} package detects (and generates warnings about)
split footnotes.
\begin{ctanrefs}
\item[fnbreak.sty]\CTANref{fnbreak}
\end{ctanrefs}

\Question[Q-marginparside]{Getting \cs|marginpar| on the right side}

In an ideal world, marginal notes would be in ``analagous'' places on
every page: notes on an even-side page would be in the left margin,
while those on an odd-side page would be in the right margin.  A
moment's thought shows that a marginal note on the left needs to be
typeset differently from a marginal not on the right.  The \LaTeX{}
\cs|marginpar| command therefore takes two arguments in a
\texttt{twoside} documents: % beware line break
\cmdinvoke*{marginpar}[left text]{right text}.  \LaTeX{} tries hard to
get the \cs|marginpar|s in the correct margin, but a booby-trap arises
because \TeX{} runs its page maker asynchronously.  If a
\cs|marginpar| is processed while page $n$ is being being built, but
doesn't get used until page $n$+1, then the \cs|marginpar| will turn
up on the wrong side of the page.  This is an instance of a general
problem: see
% beware line break
\htmlonly{``}\Qref[question]{finding if you're on an odd or an even page}{Q-oddpage}\htmlonly{''}.

The solution to the problem is for \LaTeX{} to `remember' which side
of the page each \cs|marginpar| \emph{should} be on.  The
\Package{mparhack} package does this, using label-like marks stored in
the |.aux| file.
\begin{ctanrefs}
\item[mparhack.sty]\CTANref{mparhack}
\end{ctanrefs}

\Question[Q-misschar]{Where have my characters gone?}

You've typed some apparently reasonable text and processed it, but the
result contains no sign of some of the characters you typed.  A likely
reason is that the font you selected just doesn't have a
representation for the character in question.

For example, if I type ``that will be \pounds{}44.00'' into an ordinary
\AllTeX{} document, or if I select the font |rsfs10| (which contains
uppercase letters only) and type pretty much anything, the \pounds{}
sign, or any lowercase letters or digits will not appear in the
output.  There's no actual error message, either: you have to read the
log file, where you'll find cryptic little messages like
\begin{htmlversion}
\begin{verbatim}
Missing character: There is no ^^a3 in font cmr10!
Missing character: There is no 3 in font rsfs10!
\end{verbatim} 
\end{htmlversion}
\htmlignore
\ifpdf
\begin{verbatim}
Missing character: There is no ^^a3 in font cmr10!
Missing character: There is no 3 in font rsfs10!
\end{verbatim} 
\else
\begin{verbatim}
Missing character:
                There is no ^^a3 in font cmr10!
Missing character:
                  There is no 3 in font rsfs10!
\end{verbatim} 
\fi
\endhtmlignore
(the former demonstrating my \TeX{}'s unwillingness to deal in characters
which have the eighth bit set, while the |rsfs10| example shows that
\TeX{} will log the actual character in error, if it thinks it's
possible).

Somewhat more understandable are the diagnostics you may get from
\Package{dvips} when using the \acro{OT}1 and \acro{T}1 versions of
fonts that were supplied in Adobe standard encoding:
\begin{verbatim}
dvips: Warning: missing glyph `Delta'
\end{verbatim}
The process that generates the metrics for using the fonts generates
an instruction to \Package{dvips} to produce these diagnostics, so
that their non-appearance in the printed output is less surprising
than it might be.  Quite a few glyphs available in Knuth's text
encodings and in the Cork encoding are not available in the Adobe
fonts.  In these cases, there \emph{is} a typeset sign of the
character: \ProgName{dvips} produces a black rectangle of whatever
size the concocted font file has specified.

\Question[Q-rerun]{``Rerun'' messages won't go away}

The \LaTeX{} message ``Rerun to get crossreferences right'' is
supposed to warn the user that the job needs to be processed again,
since labels seem to have changed since the previous run.  (\LaTeX{}
compares the labels it has created this time round with what it found
from the previous run when it started; it does this comparison at
\cmdinvoke{end}{document}.)

Sometimes, the message won't go away: however often you reprocess your
document, \LaTeX{} still tells you that ``Label(s) may have
changed''.  This can sometimes be caused by a broken package: both
\Package{footmisc} (with the |perpage| option) and \Package{hyperref}
have been known to give trouble, in the past: if you are using either,
check you have the latest version, and upgrade if possible.

However, there \emph{is} a rare occasion when this error can happen
as a result of pathological structure of the document itself.  Suppose
you have pages numbered in roman, and you add a reference to a label
on page ``ix'' (9).  The presence of the reference pushes the thing
referred to onto page ``x'' (10), but since that's a shorter reference
the label moves back to page ``ix'' at the next run.  Such a sequence
can obviously not terminate.

The only solution to this problem is to make a small change to your
document (something as small as adding or deleting a comma will often
be enough).
\begin{ctanrefs}
\item[footmisc.sty]\CTANref{footmisc}
\item[hyperref.sty]\CTANref{hyperref}
\end{ctanrefs}

\Question[Q-xspace]{Commands gobble following space}

People are forever surprised that simple commands gobble the space
after them: this is just the way it is.  The effect arises from the
way \TeX{} works, and Lamport describes a solution (place a pair of braces
after a command's invocation) in the description of \LaTeX{} syntax.
Thus the requirement is in effect part of the definition of \LaTeX{}.

This \acro{FAQ},
for example, is written with definitions that \emph{require} one to
type \cmdinvoke{fred}{\relax} % the \relax prevents {} being gobbled
                              % in html production (sigh)
for almost all macro invocations, regardless
of whether the following space is required: however, this \acro{FAQ}
is written by highly dedicated (and, some would say, eccentric)
people.  Many users find all those braces become very tedious very
quickly, and would really rather not type them all.

An alternative structure, that doesn't violate the design of \LaTeX{},
is to say \cs|fred|\cs| |~--- the \cs| | command is ``self
terminating'' (like |\|{}|\|) and you don't need braces after
\emph{it}.  Thus one can reduce to one the extra characters one needs
to type.

If even that one character is too many, the package \Package{xspace}
defines a command \cs|xspace| that guesses whether there should have
been a space after it, and if so introduces that space.  So
% beware line wrap
``\texttt{fred\cs|xspace| jim}'' produces ``fred jim'', while
``\texttt{fred\cs|xspace|.\@ jim}'' produces ``fred. jim''.  Which
usage would of course be completely pointless; but you can incorporate
\cs|xspace| in your own macros:
\htmlignore
\ifpdf
\begin{verbatim}
\usepackage{xspace}
...
\newcommand{\restenergy}{\ensuremath{mc^2}\xspace}
...
and we find \restenergy available to us...
\end{verbatim}
\else
\begin{verbatim}
\usepackage{xspace}
...
\newcommand{\restenergy}%
           {\ensuremath{mc^2}\xspace}
...
and we find \restenergy available to us...
\end{verbatim}
\fi
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
\usepackage{xspace}
...
\newcommand{\restenergy}{\ensuremath{mc^2}\xspace}
...
and we find \restenergy available to us...
\end{verbatim}
\end{htmlversion}
The \cs|xspace| command must be the last thing in your macro
definition (as in the example); it's not completely foolproof, but it
copes with most obvious situations in running text.

The \Package{xspace} package doesn't save you anything if you only use
a modified macro once or twice within your document, and in any case
be careful with usage of \cs|xspace|~--- it offers a change in your
input syntax which can be confusing, particularly if you retain some
commands which don't use it.   (Of course, any command 
built into \LaTeX{} or into any class or package you use won't use
\cs|xspace|: you need to think every time you use such a command.)
And of course, be careful to explain what you're doing to any
collaborating author!
\begin{ctanrefs}
\item[xspace.sty]Distributed as part of \CTANref{2etools}
\end{ctanrefs}

\Question[Q-overfull]{\AllTeX{} makes overfull lines}

When \TeX{} is building a paragraph, it can make several attempts to
get the line-breaking right; on each attempt it runs the same
algorithm, but gives it different parameters.  You can affect the way
\TeX{}'s line breaking works by adjusting the parameters: this answer
deals with the ``tolerance'' and stretchability parameters.  The other
vital `parameter' is the set of hyphenations to be applied: see
% beware line wrap
\htmlonly{``}\Qref[question]{my words aren't being hyphenated}{Q-nohyph}\htmlonly{''}
(and the questions it references) for advice.

If you're getting an undesired ``overfull box'', what has happened is
that \TeX{} has given up: the parameters you gave it don't allow it to
produce a result that \emph{doesn't} overfill.  In this circumstance,
Knuth decided the best thing to do was to produce a warning, and to
allow the user to solve the problem.  (The alternative, silently to go
beyond the envelope of ``good taste'' defined for this run of \TeX{},
would be distasteful to any discerning typographer.)  The user can
almost always address the problem by rewriting the text that's
provoking the problem~--- but that's not always possible, and in some
cases it's impossible to solve the problem without adjusting the
parameters.  This answer discusses the approaches one might take to
resolution of the problem, on the assumption that you've got the
hyphenation correct.

The simplest case is where a `small' word fails to break at the end of
a line; pushing the entire word to a new line isn't going to make much
difference, but it might make things just bad enough that \TeX{} won't
do it by default.  In such a case on can \emph{try} the \LaTeX{}
\cs|linebreak| command: it may solve the problem, and if it does, it
will save an awful lot of fiddling.  Otherwise, one needs to adjust
parameters: to do that we need to recap the details of \TeX{}'s line
breaking mechanisms.

\TeX{}'s first attempt at breaking lines is performed without even
trying hyphenation: \TeX{} sets its ``tolerance'' of line breaking
oddities to the internal value \cs|pretolerance|, and sees what
happens.  If it can't get an acceptable break, \TeX{} adds the
hyphenation points allowed by the current patterns, and tries again
using the internal \cs|tolerance| value.  If this pass also fails, and
the internal \cs|emergencystretch| value is positive, \TeX{} will try
a pass that allows \cs|emergencystretch| worth of extra stretchability
to the spaces in each line.

In principle, therefore, there are three parameters (other than
hyphenation) that you can change: \cs|pretolerance|, \cs|tolerance|
and \cs|emergencystretch|.  Both the \texttt{tolerance} values are
simple numbers, and should be set by \TeX{} primitive count
assignment~--- for example
\begin{verbatim}
  \pretolerance=150
\end{verbatim}
For both, an ``infinite'' tolerance is represented by the value
|10|\nothtml{\,}|000|, but infinite tolerance is rarely
appropriate, since it can lead to very bad line breaks indeed.

\cs|emergencystretch| is a \TeX{}-internal `dimen' register, and can
be set as normal for dimens in Plain~\TeX{}; in \LaTeX{}, use
\cs|setlength|~--- for example:
\begin{verbatim}
  \setlength{\emergencystretch}{3em}
\end{verbatim}

The the choice of method has time implications~--- each of the
passes takes time, so adding a pass (by changing
\cs|emergencystretch|) is less desirable than suppressing one (by
changing \cs|pretolerance|).  However, it's unusual nowadays to find a
computer that's slow enough that the extra passes are really
troublesome.

In practice, \cs|pretolerance| is rarely used other than to manipulate
the use of hyphenation; Plain~\TeX{} and \LaTeX{} both set its value
to |100|.  To suppress the first scan of paragraphs, set
\cs|pretolerance| to |-1|.

\cs|tolerance| is often a good method for adjusting spacing;
Plain~\TeX{} and \LaTeX{} both set its value to |200|.  \LaTeX{}'s
\cs|sloppy| command sets it to |9999|, as does the
\environment{sloppypar} environment.  This value is the largest
available, this side of infinity, and can allow pretty poor-looking
breaks (this author rarely uses \cs|sloppy| ``bare'', though he does
occasionally use \environment{sloppypar}~--- that way, the change of
\cs|tolerance| is confined to the environment).  More satisfactory is
to make small changes to \cs|tolerance|, incrementally, and then to look to
see how the change affects the result; very small increases can often
do what's necessary.  Remember that \cs|tolerance| is a paragraph
parameter, so you need to ensure it's actually applied~--- see
% beware line wrap
\htmlonly{``}\Qref[question]{ignoring paragraph parameters}{Q-paraparam}\htmlonly{''}.
\LaTeX{} users could use an environment like:
\begin{verbatim}
  \newenvironment{tolerant}[1]{%
    \par\tolerance=#1\relax
  }{%
    \par
  }
\end{verbatim}
enclosing entire paragraphs (or set of paragraphs) in it.

\cs|emergencystretch| is a slightly trickier customer to understand.
The example above set it to |3em|; the Computer Modern fonts
ordinarily fit three space skips to the em, so the change would
allow anything up to the equivalent of nine extra spaces in each
line.  In a line with lots of spaces, this could be reasonable, but
with (say) only three spaces on the line, each could stretch to four
times its natural width.

\Question[Q-exscale]{Maths symbols don't scale up}

By default, the ``large'' maths symbols stay at the same size
regardless of the font size of the text of the document.  There's good
reason for this: the \FontName{cmex} fonts aren't really designed to
scale, so that \TeX{}'s maths placement algorithms don't perform as
well as they might when the fonts are scaled.

However, this behaviour confounds user expectations, and can lead to
slightly odd-looking documents.  If you want the fonts to scale,
despite the warning above, use the \Package{exscale} package~--- just
loading it is enough.
%%
%% (Note: if you are using bitmap versions of the \FontName{cmex} fonts,
%% you will find extra bitmaps are generated.  The extended sizes are not
%% ordinarily generated for any other purpose.)
\begin{ctanrefs}
\item[exscale.sty]Part of the \LaTeX{} distribution.
\end{ctanrefs}

\subsection{Why shouldn't I?}

\Question[Q-t1enc]{Why use \Package{fontenc} rather than \Package{t1enc}?}

In the very earliest days of \LaTeXe{}, the only way to use the
\acro{T}1 encoding was \Package{t1enc}; with the summer 1994
``production'' release, the \Package{fontenc} package appeared, and
provided comprehensive support for use of the encoding.

Nevertheless, the \Package{t1enc} package remains (as part of the
\LaTeXo{} compatibility code), but it does very little: it merely
selects font encoding \acro{T}1, and leaves to the user the business
of generating the character codes required.

Generating such character codes could be a simple matter, \emph{if}
the \acro{T}1 encoding matched any widely-supported encoding standard,
since in that case, one might expect one's keyboard to generate the
character codes.  However, the \acro{T}1 encoding is a mix of several
standard encodings, and includes code points in areas of the table
which standard encodings specifically exclude, so no \acro{T}1
keyboards have been (or ever will be) manufactured.

By contrast, the \Package{fontenc} package generates the \acro{T}1
code points from ordinary \LaTeX{} commands (e.g., it generates the
\texttt{\'e} character codepoint from the command |\'|{}|e|).  So, unless you
have program-generated \acro{T}1 input, use
\cmdinvoke{usepackage}[T1]{fontenc} rather than
\cmdinvoke{usepackage}{t1enc}.

\Question[Q-why-inp-font]{Why bother with \Package{inputenc} and \Package{fontenc}?}

The standard input encoding for Western Europe (pending the arrival of
Unicode) is \acro{ISO}~8859--1 (commonly known by the standard's
subtitle `Latin-1').  Latin-1 is remarkably close, in the codepoints
it covers, to the \AllTeX{} \acro{T}1 encoding.

In this circumstance, why should one bother with \Package{inputenc}
and \Package{fontenc}?  Since they're pretty exactly mirroring each
other, one could do away with both, and use just \Package{t1enc},
despite its \nothtml{shortcomings (}%
\Qref{shortcomings}{Q-t1enc}\nothtml{)}.

One doesn't do this for a variety of small reasons:
\begin{description}
\item[Confusion] You've been happily working in this mode, and for
  some reason find you're to switch to writing in German: the effect
  of using ``\texttt{\ss}'' is somewhat startling, since \acro{T}1
  and Latin-1 treat the codepoint differently.
\item[Compatibility] You find yourself needing to work with a
  colleague in Eastern Europe: their keyboard is likely to be set to
  produce Latin-2, so that the simple mapping doesn't work.
\item[Traditional \LaTeX{}] You lapse and write something like
  |\'|{}|e| rather than typing \texttt{\'e}; only \Package{fontenc}
  has the means to convert this \LaTeX{} sequence into the \acro{T}1
  character, so an \cs|accent| primitive slips through into the
  output, and hyphenation is in danger.
\end{description}
The \Package{inputenc}--\Package{fontenc} combination seems slow and
cumbersome, but it's safe.

\Question[Q-eqnarray]{Why not use \environment{eqnarray}?}

The environment \environment{eqnarray} is attractive for the
occasional user of mathematics in \LaTeX{} documents: it seems to
allow aligned systems of equations.  Indeed it \emph{does} supply such
things, but it makes a serious mess of spacing.  In the system:
\begin{quote}
\begin{verbatim}
\begin{eqnarray}
  a & = & b + c \\
  x & = & y - z
\end{eqnarray}
\end{verbatim}
\end{quote}
the spacing around the ``='' signs is \emph{not} that defined in the
metrics for the font from which the glyph comes~--- it's
\cs|arraycolsep|, which may be set to some very odd value for reasons
associated with real arrays elsewhere in the document.

The user is far better served by the \AMSLaTeX{} bundle, which
provides an \environment{align} environment, which is designed with
the needs of mathematicians in mind (as opposed to the convenience of
\LaTeX{} programmers).  For this simple case (align is capable of far
greater things), code as:
\begin{quote}
\begin{verbatim}
\begin{align}
  a & = b + c \\
  x & = y - z
\end{align}
\end{verbatim}
\end{quote}
\begin{ctanrefs}
\item[AMSLaTeX]\CTANref{amslatex}
\end{ctanrefs}

\Question[Q-dolldoll]{Why use \csx{[}\nothtml{\,}\dots{}\csx{]} in place of \texttt{\$\$}\dots{}\texttt{\$\$}?}

\LaTeX{} defines inline- and display-maths commands, apparently
analagous to those that derive from the \TeX{} primitive maths
sequences bracketing maths commands with single dollar signs (or pairs
of dollar signs).

As it turns out, \LaTeX{}'s inline maths grouping, |\( ... \)|, has
precisely the same effect as the \TeX{} primitive version |$ ... $|.
(Except that the \LaTeX{} version checks to ensure you don't put |\(|
and |\)| the wrong way round.)

In this circumstance, one often finds \LaTeX{} users, who have some
experience of using Plain \TeX{}, merely assuming that \LaTeX{}'s
display maths grouping |\[ ... \]| may be replaced by the \TeX{}
primitive display maths |$$ ... $$|.

Unfortunately, they are wrong: if \LaTeX{} is going to patch display
maths, they can only do so by patching \cs|[| and \cs|]|.  The most
obvious way this turns up, is that the class option \pkgoption{fleqn}
simply does not work for equations coded using |$$ ... $$|, whether
you're using the standard classes alone, or using package
\Package{amsmath}.

There are more subtle effects (especially with package
\Package{amsmath}), and the simple rule is |\[ ... \]| whenever
unadorned displayed maths is needed in \LaTeX{}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{The joy of \TeX{} errors}

\Question[Q-erroradvice]{How to approach errors}

Since \TeX{} is a macroprocessor, its error messages are often
difficult to understand; this is a (seemingly invariant) property of
macroprocessors.  Knuth makes light of the problem in the \TeX{}book,
suggesting that you acquire the sleuthing skills of a latter-day
Sherlock Holmes; while this approach has a certain romantic charm to
it, it's not good for the `production' user of \AllTeX{}.  This
answer (derived, in part, from an article by Sebastian Rahtz in
\TUGboat{} 16(4)) offers some general guidance in dealing with \TeX{}
error reports, and other answers in this section deal with common (but
perplexing) errors that you may encounter.  There's a long list of
``hints'' in Sebastian's article, including the following:
\begin{itemize}
\item Look at \TeX{} errors; those messages may seem cryptic at first,
  but they often contain a straightforward clue to the problem.  See
  \Qref[question]{the structure of errors}{Q-errstruct} for further
  details. 
\item Read the |.log| file; it contains hints to things you may not
  understand, often things that have not even presented as error
  messages.
\item Be aware of the amount of context that \TeX{} gives you.  The
  error messages gives you some bits of \TeX{} code (or of the
  document itself), that show where the error ``actually happened'';
  it's possible to control how much of this `context' \TeX{} actually
  gives you.  \LaTeX{} (nowadays) instructs \TeX{} only to give you
  one line of context, but you may tell it otherwise by saying
\begin{verbatim}
  \setcounter{errorcontextlines}{999}
\end{verbatim}
  in the preamble of your document.  (If you're not a confident macro
  programmer, don't be ashamed of cutting that 999 down a bit; some
  errors will go on and \emph{on}, and spotting the differences
  between those lines can be a significant challenge.)
\item As a last resort, tracing can be a useful tool; reading a full
  \AllTeX{} trace takes a strong constitution, but once you know how,
  the trace can lead you quickly to the source of a problem.  You need
  to have read the \TeX{}book (see
% beware line break
  \Qref[question]{books about \TeX{}}{Q-books}) in some detail, fully
  to understand the trace.
  
  The command \cs|tracingall| sets up maximum tracing; it also sets
  the output to come to the interactive terminal, which is somewhat of
  a mixed blessing (since the output tends to be so vast~--- all but
  the simplest traces are best examined in a text editor after the event).

  The \LaTeX{} \Package{trace} package (first distributed with the
  2001 release of \LaTeX{}) provides more manageable tracing.  Its
  \cs|traceon| command gives you what \cs|tracingall| offers, but
  suppresses tracing around some of the truly verbose parts of
  \LaTeX{} itself.  The package also provides a \cs|traceoff|
  command (there's no ``off'' command for \cs|tracingall|), and a
  package option (|logonly|) allows you to suppress output to the
  terminal.
\end{itemize}
The best advice to those faced with \TeX{} errors is not to panic:
most of the common errors are plain to the eye when you go back to the
source line that \TeX{} tells you of.  If that approach doesn't work,
the remaining answers in this section deal with some of the odder
error messages you may encounter.  You should not ordinarily need to
appeal to the \nothtml{wider public (}%
\Qref[question]{wider public}{Q-maillists}\nothtml{)}
for assistance, but if you do, be sure to
report full backtraces (see |errorcontextlines| above) and so on.
\begin{ctanrefs}
\item[trace.sty]Distributed as part of \CTANref{2etools}
\end{ctanrefs}

\Question[Q-errstruct]{The structure of \TeX{} error messages}

\TeX{}'s error messages are reminiscent of the time when \TeX{} itself
was conceived (the 1970s): they're not terribly user-friendly, though
they do contain all the information that \TeX{} can offer, usually in
a pretty concise way.

\TeX{}'s error reports all have the same structure:
\begin{itemize}
\item An error message
\item Some `context'
\item An error prompt
\end{itemize}
The error message will relate to the \emph{\TeX{}} condition that is
causing a problem.  Sadly, in the case of complex macro packages such
as \LaTeX{}, the underlying \TeX{} problem may be superficially
difficult to relate to the actual problem in the ``higher-level''
macros.  Many \LaTeX{}-detected problems manifest themselves as
`generic' errors, with error text provided by \LaTeX{} itself (or by a
\LaTeX{} class or package).

The context of the error is a stylised representation of what \TeX{}
was doing at the point that it detected the error.  As noted in
\Qref[question]{approaching errors}{Q-erroradvice}, a macro package
can tell \TeX{} how much context to display, and the user may need to
undo what the package has done.  Each line of context is split at the
point of the error; if the error \emph{actually} occurred in a macro
called from the present line, the break is at the point of the call.
(If the called object is defined with arguments, the ``point of call''
is after all the arguments have been scanned.)  For example:
\begin{verbatim}
\blah and so on
\end{verbatim}
produces the error report
\begin{verbatim}
! Undefined control sequence.
l.4 \blah
          and so on
\end{verbatim}
while:
\begin{verbatim}
\newcommand{\blah}[1]{\bleah #1}
\blah{to you}, folks
\end{verbatim}
produces the error report
\begin{verbatim}
! Undefined control sequence.
\blah #1->\bleah 
                 #1
l.5 \blah{to you}
                 , folks
\end{verbatim}
If the argument itself is in error, we will see things such as
\begin{verbatim}
\newcommand{\blah}[1]{#1 to you}
\blah{\bleah}, folks
\end{verbatim}
producing
\begin{verbatim}
! Undefined control sequence.
<argument> \bleah 
                  
l.5 \blah{\bleah}
                 , folks
\end{verbatim}

The prompt accepts single-character commands: the list of what's
available may be had by typing |?|\@.  One immediately valuable
command is |h|, which gives you an expansion of \TeX{}s original
pr\'ecis message, sometimes accompanied by a hint on what to do to
work round the problem in the short term.  If you simply type `return'
(or whatever else your system uses to signal the end of a line) at the
prompt, \TeX{} will attempt to carry on (often with rather little
success).

\Question[Q-extrabrace]{An extra `\texttt{\cbracesymbol{}}'??}
You've looked at your \LaTeX{} source and there's no sign of a misplaced
\texttt{\cbracesymbol{}} on the line in question.

Well, no: this is \TeX{}'s cryptic way of hinting that you've put a
\begin{htmlversion}
\Qref{fragile command}{Q-protect} in a moving argument.
\end{htmlversion}
\htmlignore
fragile command in a moving argument (\Qref{}{Q-protect}).
\endhtmlignore

For example, \cs|footnote| is fragile, and if we put that in the
moving argument of a \cs|section| command, as
\begin{verbatim}
  \section{Mumble\footnote{%
      I couldn't think of anything better}}
\end{verbatim}
we get told
\begin{verbatim}
  ! Argument of \@sect has an extra }.
\end{verbatim}

The solution is usually to use a robust command in place of the one
you are using, or to force your command to be robust by prefixing it
with \cs|protect|, which in the above case would show as
\begin{verbatim}
  \section{Mumble\protect\footnote{%
      I couldn't think of anything better}}
\end{verbatim}

Note that, in some cases, simple \cs|protect|ion is \emph{not} the
answer;
\Qref[question]{Footnotes in \LaTeX{} section headings}{Q-ftnsect}
deals specifically with this case.

\Question[Q-semanticnest]{Capacity exceeded [semantic nest\dots{}]}
\htmlignore
\begin{dviversion}
\begin{verbatim}
! TeX capacity exceeded, sorry [semantic nest
                                      size=100].
...
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.
\end{verbatim}
\end{dviversion}
\begin{pdfversion}
\begin{verbatim}
! TeX capacity exceeded, sorry [semantic nest size=100].
...
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.
\end{verbatim}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
! TeX capacity exceeded, sorry [semantic nest size=100].
...
If you really absolutely need more capacity,
you can ask a wizard to enlarge me.
\end{verbatim}
\end{htmlversion}
Even though \TeX{} suggests (as always) that enlargement by a wizard
may help, this message usually results from a broken macro or bad
parameters to an otherwise working macro.

The ``semantic nest'' \TeX{} talks about is the nesting
of boxes within boxes.  A stupid macro can provoke the error pretty
easily:
\begin{verbatim}
\def\silly{\hbox{here's \silly being executed}}
\silly
\end{verbatim}
The extended traceback
% beware of filling this line...
(\Qref{see \emph{general advice} on errors}{Q-erroradvice})
\emph{does} help, though it does rather run on.  In the case above,
the traceback consists of
\begin{verbatim}
\silly ->\hbox {
                here's \silly being executed}
\end{verbatim}
followed by 100 instances of
\begin{verbatim}
\silly ->\hbox {here's \silly 
                              being executed}
\end{verbatim}
The repeated lines are broken at exactly the offending macro; of
course the loop need not be as simple as this~--- if \cs|silly| calls
\cs|dopy| which boxes \cs|silly|, the effect is just the same and
alternate lines in the traceback are broken at alternate positions.

\Question[Q-noroom]{No room for a new `\emph{thing}'}

The technology available to Knuth at the time \TeX{} was written is
said to have been particularly poor at managing dynamic storage; as a
result much of the storage used within \TeX{} is allocated as fixed
arrays, in the reference implementations.  Many of these fixed arrays
are expandable in modern \TeX{} implementations, but size of the
arrays of ``registers'' is written into the specification as being 256
(usually); this number may not be changed if you still wish to call
the result \TeX{}
%% beware line wrap
(see \Qref[question]{testing \TeX{} implementations}{Q-triptrap}).

If you fill up one of these register arrays, you get a \TeX{} error
message saying
\begin{verbatim}
  ! No room for a new \<thing>.
\end{verbatim}
The \cs|thing|s in question may be \cs|count| (the object underlying
\LaTeX{}'s \cs|newcounter| command), \cs|skip| (the object underlying
\LaTeX{}'s \cs|newlength| command), \cs|box| (the object underlying
\LaTeX{}'s \cs|newsavebox| command), or \cs|dimen|, \cs|muskip|,
\cs|toks|, \cs|read|, \cs|write| or \cs|language| (all types of object
whose use is ``hidden'' in \LaTeX{}; the limit on the number of
\cs|read| or \cs|write| objects is just 16).

There is nothing that can directly be done about this error, as you can't
extend the number of available registers without extending \TeX{}
itself.
\begin{htmlversion}
  Of course, \Qref{\eTeX{}}{Q-NTS} and \Qref{Omega}{Q-omega}
\end{htmlversion}
\htmlignore
% beware line wrap here
  Of course, \ensuremath{\Omega} and \eTeX{}~---
  \Qref[see questions]{}{Q-omega} \Qref[and]{}{Q-NTS} respectively~---
\endhtmlignore
 both do this, as does \Qref*{MicroPress Inc's V\TeX{}}{Q-commercial}.

The commonest way to encounter one of these error messages is to have
broken macros of some sort, or incorrect usage of macros (an example
is discussed in \Qref[question]{epsf problems}{Q-epsf}).

However, sometimes one just \emph{needs} more than \TeX{} can offer,
and when this happens, you've just got to work out a different way of
doing things.  An example is the % beware line wrap
\Qref*{difficulty of loading \PiCTeX{} with \LaTeX{}}{Q-usepictex}.
In cases like \PiCTeX{}, it may be possible to use
\Qref*{\eTeX{}}{Q-NTS} (all modern distributions provide it).  The
\LaTeX{} package \Package{etex} modifies the register allocation
mechanism to make use of \eTeX{}'s extended register sets (it's a
derivative of the Plain \TeX{} macro file \Package{etex.src}, which is
used in building the \eTeX{} Plain format; both files are part of the
\eTeX{} distribution).  Unfortunately, \eTeX{} doesn't help with
\cs|read| or \cs|write| objects.

\Question[Q-epsf]{\texttt{epsf} gives up after a bit}

Some copies of the documentation of \File|epsf.tex| seem to suggest
that the command
\begin{verbatim}
  \input epsf
\end{verbatim}
is needed for every figure included.  If you follow this suggestion
too literally, you get an error
\begin{verbatim}
  ! No room for a new \read .
\end{verbatim}
after a while; this is because each time \File|epsf.tex| is loaded, it
allocates itself a \emph{new} file-reading handle to check the figure
for its bounding box, and there just aren't enough of these things
(see \Qref[question]{no room for a new thing}{Q-noroom}).

The solution is simple~--- this is in fact an example of misuse of
macros; one only need read \File|epsf.tex| once, so change
\begin{verbatim}
  ...
  \input epsf
  \epsffile{...}
  ...
  \input epsf
  \epsffile{...}
\end{verbatim}
(and so on) with a single
\begin{verbatim}
  \input epsf
\end{verbatim}
somewhere near the start of your document, and then decorate your
\cs|epsffile| statements with no more than adjustments of
\cs|epsfxsize| and so on.

\Question[Q-badhyph]{Improper \csx{hyphenation} will be flushed}

For example
\begin{verbatim}
! Improper \hyphenation will be flushed.
\'#1->{
       \accent 19 #1}
<*> \hyphenation{Ji-m\'e
                        -nez}
\end{verbatim}
(in Plain \TeX{}) or
\begin{verbatim}
! Improper \hyphenation will be flushed.
\leavevmode ->\unhbox 
                      \voidb@x 
<*> \hyphenation{Ji-m\'e
                        -nez}
\end{verbatim}
in \LaTeX{}.

As mentioned in \Qref[question]{``hyphenation failures''}{Q-nohyph},
words with accents in them may not be hyphenated.  As a result, any
such word is deemed improper in a \cs|hyphenation| command.

The solution is to use a font that contains the character in question,
and to express the \cs|hyphenation| command in terms of that
character; this ``hides'' the accent from the hyphenation mechanisms.
\LaTeX{} users can be achieved this by use of the \Package{fontenc}
package (part of the \LaTeX{} distribution).  If you select an 8-bit
font with the package, as in \cmdinvoke{usepackage}[T1]{fontenc},
accented-letter commands such as the |\'||e| in
|\hyphenation{Ji-m\'||e-nez}| automatically become the single accented
character by the time the hyphenation gets to look at it.

\Question[Q-tmupfl]{``Too many unprocessed floats''}

If \LaTeX{} responds to a \cmdinvoke{begin}{figure} or
\cmdinvoke{begin}{table} command with the error message
\begin{htmlversion}
\begin{verbatim}
! LaTeX Error: Too many unprocessed floats.

See the LaTeX manual or LaTeX Companion for explanation.
\end{verbatim}
\end{htmlversion}
\htmlignore
\ifpdf
\begin{verbatim}
! LaTeX Error: Too many unprocessed floats.

See the LaTeX manual or LaTeX Companion for explanation.
\end{verbatim}
\else
\begin{verbatim}
! LaTeX Error: Too many unprocessed floats.

See the LaTeX manual or LaTeX Companion
...                           for explanation.
\end{verbatim}
\fi
\endhtmlignore
your figures (or tables) are failing to be placed properly.  \LaTeX{}
has a limited amount of storage for `floats' (figures, tables, or
floats you've defined yourself with the \Package{float} package); if
you don't let it ever actually typeset any floats, it will run out of
space.

This failure usually occurs in extreme cases of
% beware line break
\nothtml{floats moving ``wrongly'' (see }%
\Qref[question]{floats moving ``wrongly''}{Q-floats}\latexhtml{);}{;}
\LaTeX{} has found it can't place a float, and floats of the same type
have piled up behind it.  \LaTeX{}'s idea is to ensure that caption
numbers are sequential in the document: the caption number is
allocated when the figure (or whatever) is created, and can't be
changed, so that placement out of order would mean figure numbers
appearing out of order in the document (and in the list of figures, or
whatever).  So a simple failure to place a figure means that no
subsequent figure can be placed; and hence (eventually) the error.

Techniques for solving the problem are discussed in the
\nothtml{floats question (}%
\Qref[\htmlonly]{floats question}{Q-floats}\nothtml{)}
already referenced.

The error also occurs in a of fooling \LaTeX{} that you're inside it
long sequence of \environment{figure} or \environment{table}
environments, with no intervening
text.  Unless the environments will fit ``here'' (and you've allowed
them to go ``here''), there will never be a page break, and so there
will never be an opportunity for \LaTeX{} to reconsider placement.
(Of course, the floats can't all fit ``here'' if the sequence is
sufficiently prolonged: once the page fills, \LaTeX{} won't place any
more floats, leading to the error.

Techniques for resolution may involve redefining the floats using the
\Package{float} package's |[H]| float qualifier, but you are unlikely
to get away without using \cs|clearpage| from time to time.
\begin{ctanrefs}
\item[float.sty]\CTANref{float}
\end{ctanrefs}

\Question[Q-atvert]{\csx{spacefactor} complaints}

The errors
\begin{verbatim}
! You can't use `\spacefactor' in vertical mode.
\@->\spacefactor 
                 \@m 
\end{verbatim}
or
\begin{verbatim}
! Improper \spacefactor.
...
\end{verbatim}
bites the \LaTeX{} programmer who uses an internal command without taking
``precautions''.  The problem is discussed in detail in
% beware line wrap
\htmlonly{``}\Qref[question]{\texttt{@} in macro names}{Q-atsigns}\htmlonly{''},
together with solutions.

\Question[Q-endingroup]{\csx{end} occurred inside a group}

The actual error we observe is:

\nothtml{\noindent}%
|(\end occurred inside a group at level <|\texttt{\emph{n}}|>)|

\nothtml{\noindent}%
and it tells us that something we started in the document never got
finished before we ended the document itself.  The things involved
(`groups') are what \TeX{} uses for restricting the scope of things:
you see them, for example, in the ``traditional'' font selection
commands: |{\it stuff\/}|~--- if the closing brace is left off such a
construct, the effect of \cs|it| will last to the end of the document,
and you'll get the diagnostic.

\TeX{} itself doesn't tell you where your problem is, but you can
often spot it by looking at the typeset output in a previewer.
Otherwise, you can usually find mismatched braces using an intelligent
editor (at least |emacs| and \ProgName{winedt} offer this facility).
However, groups are not \emph{only} created by matching |{| with |}|:
other grouping commands are discussed elsewhere in these \acro{FAQ}s,
and are also a potential source of unclosed group.

\cmdinvoke{begin}{\meta{environment}} encloses the environment's body
in a group, and establishes its own diagnostic mechanism.  If you end
the document before closing some other environment, you get the
`usual' \LaTeX{} diagnostic
\htmlignore
\begin{dviversion}
\begin{verbatim}
! LaTeX Error: \begin{blah} on input line 6
                       ended by \end{document}.
\end{verbatim}
\end{dviversion}
\begin{pdfversion}
\begin{verbatim}
! LaTeX Error: \begin{blah} on input line 6 ended by \end{document}.
\end{verbatim}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
! LaTeX Error: \begin{blah} on input line 6 ended by \end{document}.
\end{verbatim}
\end{htmlversion}
which (though it doesn't tell you which \emph{file} the
\cmdinvoke{begin}{blah} was in) is usually enough to locate the
immediate problem.  If you press on past the \LaTeX{} error, you get
the ``occurred inside a group'' message before \LaTeX{} finally exits.

In the absence of such information from \LaTeX{}, you need to use
``traditional'' binary search to find the offending group.  Separate
the preamble from the body of your file, and process each half on its
own with the preamble; this tells you which half of the file is at
fault.  Divide again and repeat.  The process needs to be conducted
with care (it's obviously possible to split a correctly-written group
by chopping in the wrong place), but it will usually find the problem
fairly quickly.

\eTeX{} (and \ProgName{elatex}~--- \LaTeX{} run on \eTeX{}) gives you
further diagnostics after the traditional infuriating \TeX{} one~--- it
actually keeps the information in a similar way to \LaTeX{}:
\htmlignore
\begin{dviversion}
\begin{verbatim}
(\end occurred inside a group at level 3)

### semi simple group (level 3) entered
                         at line 6 (\begingroup)
### simple group (level 2) entered at line 5 ({)
### simple group (level 1) entered at line 4 ({)
### bottom level
\end{verbatim}
\end{dviversion}
\begin{pdfversion}
\begin{verbatim}
(\end occurred inside a group at level 3)

### semi simple group (level 3) entered at line 6 (\begingroup)
### simple group (level 2) entered at line 5 ({)
### simple group (level 1) entered at line 4 ({)
### bottom level
\end{verbatim}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
(\end occurred inside a group at level 3)

### semi simple group (level 3) entered at line 6 (\begingroup)
### simple group (level 2) entered at line 5 ({)
### simple group (level 1) entered at line 4 ({)
### bottom level
\end{verbatim}
\end{htmlversion}
The diagnostic not only tells us where the group started, but also the
\emph{way} it started: \cs|begingroup| or |{| (which is an alias of
\cs|bgroup|, and the two are not  distinguishable at the \TeX{}-engine
level).

\Question[Q-nonum]{``Missing number, treated as zero''}

In general, this means you've tried to assign something to a count,
dimension or skip register that isn't (in \TeX{}'s view of things) a
number.  Usually the problem will become clear using the
\nothtml{ordinary techniques of examining errors (}%
% beware line break
\Qref{ordinary techniques of examining errors}{Q-erroradvice}\nothtml{)}.

Two \LaTeX{}-specific errors are commonly aired on the newsgroups.

The commonest arises from attempting to use an example from the
\Qref*{\emph{The \LaTeX{} Companion}}{Q-books}, and is
exemplified by the following error text:
\begin{verbatim}
! Missing number, treated as zero.
<to be read again> 
                   \relax 
l.21 \begin{Ventry}{Return values}
\end{verbatim}
The problem arises because the \emph{Companion}'s examples always
assume that the \Package{calc} package is loaded: this fact is
mentioned in the book, but often not noticed.  The remedy is to load
the \Package{calc} package in any document using such examples from
the \emph{Companion}.

The other problem, which is increasingly rare nowadays, arises from
misconfiguration of a system that has been upgraded from \LaTeXo{}:
the document uses the \Package{times} package, and the error appears
at \cmdinvoke{begin}{document}.  The file search paths are wrongly set
up, and your \cmdinvoke{usepackage}{times} has picked up a \LaTeXo{}
version of the package, which in its turn has invoked another which
has no equivalent in \LaTeXe{}.  The obvious solution is to rewrite
the paths so that \LaTeXo{} packages are chosen only as a last resort
so that the startlingly simple \LaTeXe{} \Package{times} package will
be picked up.  Better still is to replace the whole thing with
something more modern still; current \Package{psnfss} doesn't provide
a \Package{times} package~--- the alternative \Package{mathptmx}
incorporates \FontName{Times}-like mathematics, and a sans-serif face
based on \FontName{Helvetica}, but scaled to match \FontName{Times}
text rather better.
\begin{ctanrefs}
\item[calc.sty]Distributed as part of \CTANref{2etools}
\item[The psnfss bundle]\CTANref{psnfss}
\end{ctanrefs}

\Question[Q-typend]{``Please type a command or say \csx{end}''}

Sometimes, when you are running \AllTeX{}, it will abruptly stop and
present you with a prompt (by default, just a |*| character).  Many
people (including this author) will reflexively hit the `return'
key, pretty much immediately, and of course this is no help at all~---
\TeX{} just says:
\begin{verbatim}
(Please type a command or say `\end')
\end{verbatim}
and prompts you again.

What's happened is that your \AllTeX{} file has finished prematurely,
and \TeX{} has fallen back to a supposed including file, from the
terminal.  This could have happened simply because you've omitted
the \cs|bye| (Plain~\TeX{}), \cmdinvoke{end}{document} (\LaTeX{}), or
whatever.  Other common errors are failure to close the braces round a
command's argument, or (in \LaTeX{}) failure to close a verbatim
environment: in such cases you've already read and accepted an
error message about encountering end of file while scanning something.

If the error is indeed because you've forgotten to end your document,
you can insert the missing text: if you're running Plain~\TeX{}, the
advice, to ``say \cs|end|'' is good enough: it will kill the run; if
you're running \LaTeX{}, the argument will be necessary:
\cmdinvoke{end}{document}.  

However, as often as not this isn't the problem, and (short of
debugging the source of the document before ending) brute force is
probably necessary.  Excessive force (killing the job that's
running \TeX{}) is to be avoided: there may well be evidence in the
|.log| file that will be useful in determining what the problem is~---
so the aim is to persuade \TeX{} to shut itself down and hence flush
all log output to file.

If you can persuade \TeX{} to read it, an end-of-file indication
(control-|D| under Unix, control-|Z| under Windows) will provoke
\TeX{} to report an error and exit immediately.  Otherwise you should
attempt to provoke an error dialogue, from which you can exit (using
the |x| `command').  An accessible error could well be inserting an
illegal character: what it is will depend on what macros you are
running.  If you can't make that work, try a silly command name or
two.

\Question[Q-unkgrfextn]{``Unknown graphics extension''}

The \LaTeX{} graphics package deals with several different types of
\acro{DVI} (or other) output drivers; each one of them has a potential
to deal with a different selection of graphics formats.  The package
therefore has to be told what graphics file types its output driver
knows about; this is usually done in the \meta{driver}|.def| file
corresponding to the output driver you're using.

The error message arises, then, if you have a graphics file whose
extension doesn't correspond with one your driver knows about.  Most
often, this is because you're being optimistic: asking
\ProgName{dvips} to deal with a |.png| file, or \PDFTeX{} to deal with
a |.eps| file: the solution in this case is to transform the graphics
file to a format your driver knows about.

If you happen to \emph{know} that your device driver deals with the
format of your file, you are probably falling foul of a limitation of
the file name parsing code that the graphics package uses.  Suppose
you want to include a graphics file \File|home.bedroom.eps| using the
\ProgName{dvips} driver; the package will conclude that your file's
extension is \File|.bedroom.eps|, and will complain.  To get around
this limitation, you have three alternatives:
\begin{itemize}
\item Rename the file~--- for example \File|home.bedroom.eps|\arrowhyph{}%
  \File|home-bedroom.eps|
\item Mask the first dot in the file name:
\begin{verbatim}
\newcommand*{\DOT}{.}
\includegraphics{home\DOT bedroom.eps}
\end{verbatim}
\item Tell the graphics package what the file is, by means of options
  to the \cs|includegraphics| command:
\htmlignore
\begin{pdfversion}
\begin{verbatim}
\includegraphics[type=eps,ext=.eps,read=.eps]{home.bedroom}
\end{verbatim}
\end{pdfversion}
\begin{dviversion}
\begin{verbatim}
\includegraphics
     [type=eps,ext=.eps,read=.eps]%
          {home.bedroom}
\end{verbatim}
\end{dviversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
\includegraphics[type=eps,ext=.eps,read=.eps]{home.bedroom}
\end{verbatim}
\end{htmlversion}
\end{itemize}

\Question[Q-nodollar]{``Missing \${} inserted''}

There are certain things that \emph{only} work in maths mode.  If your
document is not in maths mode and you have an |_| or a |^| character,
\TeX{} (and by inheritance, \LaTeX{} too) will say
\begin{verbatim}
! Missing $ inserted
\end{verbatim}
as if you couldn't possibly have misunderstood the import of what you
were typing, and the only possible interpretation is that you had
commited a typo in failing to enter maths mode.  \TeX{}, therefore,
tries to patch things up by inserting the |$| you `forgot', so that
the maths-only object will work; as often as not this will land you in
further confusion.

It's not just the single-character maths sub- and superscript
operators: anything that's built in or declared as a maths operation,
from the simplest lower-case \cs|alpha| through the inscrutable
\cs|mathchoice| primitive, and beyond, will provoke the error if
misused in text mode.

\LaTeX{} offers a command \cs|ensuremath|, which will put you in maths
mode for the execution of its argument, if necessary: so if you want
an \cs|alpha| in your running text, say
\cmdinvoke{ensuremath}{\cs|alpha|}; if the bit of running text somehow
transmutes into a bit of mathematics, the \cs|ensuremath| will become
a no-op, so it's pretty much always safe.

\Question[Q-fontunavail]{Warning: ``Font shape \dots{}\ not available''}

\LaTeX{}'s font selection scheme maintains tables of the font families
it has been told about.  These tables list the font families that
\LaTeX{} knows about, and the shapes and series in which those font
families are available.  In addition, in some cases, the tables list
the sizes at which \LaTeX{} is willing to load fonts from the family.

When you specify a font, using one of the \LaTeX{} font selection
commands, \LaTeX{} looks for the font (that is, a font that matches
the encoding, family, shape, series and size that you want) in its
tables.  If the font isn't there at the size you want, you will see a
message like:
\htmlignore
\begin{dviversion}
\begin{verbatim}
LaTeX Font Warning: Font shape `OT1/cmr/m/n' in
...                 size <11.5> not available
(Font)              size <12> substituted on
...                 input line ...
\end{verbatim}
(All the message texts in this answer have been wrapped so that they
will fit in the narrow columns of this version of the \acro{FAQ}.  The
continuation marker is |...| at the start of the broken-off portion of
the line.)

\end{dviversion}
\begin{pdfversion}
\begin{verbatim}
LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <11.5> not available
(Font)              size <12> substituted on input line ...
\end{verbatim}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <11.5> not available
(Font)              size <12> substituted on input line ...
\end{verbatim}
\end{htmlversion}
There will also be a warning like:
\htmlignore
\begin{dviversion}
\begin{verbatim}
LaTeX Font Warning: Size substitutions with
...                 differences
(Font)              up to 0.5pt have occurred.
\end{verbatim}
\end{dviversion}
\begin{pdfversion}
\begin{verbatim}
LaTeX Font Warning: Size substitutions with differences
(Font)              up to 0.5pt have occurred.
\end{verbatim}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
LaTeX Font Warning: Size substitutions with differences
(Font)              up to 0.5pt have occurred.
\end{verbatim}
\end{htmlversion}
after \LaTeX{} has encountered \cmdinvoke{end}{document}.

The message tells you that you've chosen a font size that is not in
\LaTeX{}'s list of ``allowed'' sizes for this font; \LaTeX{} has
chosen the nearest font size it knows is allowed.  In fact, you can
tell \LaTeX{} to allow \emph{any} size: the restrictions come from the
days when only bitmap fonts were available, and they have never
applied to fonts that come in scaleable form in the first place.
Nowadays, most of the fonts that were once bitmap-only are also
available in scaleable (Adobe Type~1) form.  If your installation uses
scaleable versions of the Computer Modern or European Computer Modern
(\acro{EC}) fonts, you can tell \LaTeX{} to remove the restrictions;
use the \Package{type1cm} or \Package{type1ec} package as appropriate.

If the combination of font shape and series isn't available, \LaTeX{}
will usually have been told of a fall-back combination that may be
used, and will select that:
\htmlignore
\begin{dviversion}
\begin{verbatim}
LaTeX Font Warning: Font shape `OT1/cmr/bx/sc'
...                 undefined
(Font)              using `OT1/cmr/bx/n'
...                 instead on input line 0.
\end{verbatim}
\end{dviversion}
\begin{pdfversion}
\begin{verbatim}
LaTeX Font Warning: Font shape `OT1/cmr/bx/sc' undefined
(Font)              using `OT1/cmr/bx/n' instead on input line 0.
\end{verbatim}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
LaTeX Font Warning: Font shape `OT1/cmr/bx/sc' undefined
(Font)              using `OT1/cmr/bx/n' instead on input line 0.
\end{verbatim}
\end{htmlversion}

Substitutions may also be ``silent''; in this case, there is no more
than an ``information'' message in the log file.  For example, if you
specify an encoding for which there is no version in the current font
family, the `default family for the encoding' is selected.  This
happens, for example, if you use command \cs|textbullet|, which is
normally taken from the maths symbols font, which is in |OMS|
encoding.  My test log contained:
\htmlignore
\begin{dviversion}
\begin{verbatim}
LaTeX Font Info:    Font shape `OMS/cmr/m/n' in
...                 size <10> not available
(Font)              Font shape `OMS/cmsy/m/n'
...                 tried instead on input
...                 line ...
\end{verbatim}
\end{dviversion}
\begin{pdfversion}
\begin{verbatim}
LaTeX Font Info:    Font shape `OMS/cmr/m/n' in size <10> not available
(Font)              Font shape `OMS/cmsy/m/n' tried instead on input line ...
\end{verbatim}
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
\begin{verbatim}
LaTeX Font Info:    Font shape `OMS/cmr/m/n' in size <10> not available
(Font)              Font shape `OMS/cmsy/m/n' tried instead on input line ...
\end{verbatim}
\end{htmlversion}

In summary, these messages are not so much error messages, as
information messages, that tell you what \LaTeX{} has made of your
text.  You should check what the messages say, but you will ordinarily
not be surprised at their content.
\begin{ctanrefs}
\item[type1cm.sty]\CTANref{type1cm}
\item[type1ec.sty]\CTANref{type1ec}
\end{ctanrefs}

\Question[Q-buffovl]{Unable to read an entire line}

\TeX{} belongs to the generation of applications written for
environments that didn't offer the sophisticated string and i/o
manipulation we nowadays take for granted (\TeX{} was written in
Pascal, and the original Pascal standard made no mention of i/o, so
that anything but the most trivial operations were likely to be
unportable).

When you overwhelm \TeX{}'s input mechanism, you get told:
\begin{verbatim}
! Unable to read an entire line---bufsize=3000.
    Please ask a wizard to enlarge me.
\end{verbatim}
(for some value of `3000'~--- the quote was from a
\Newsgroup|comp.text.tex| posting by a someone who was presumably
using an old \TeX{}).

As the message implies, there's (what \TeX{} thinks of as a) line in
your input that's ``too long'' (to \TeX{}'s way of thinking).  Since
modern distributions tend to have tens of thousands of bytes of input
buffer, it's somewhat rare that these messages occur ``for real''.
Probable culprits are:
\begin{itemize}
\item A file transferred from another system, without translating
  record endings.  With the decline of fixed-format records (on
  mainframe operating systems) and the increased intelligence of
  \TeX{} distributions at recognising other systems' explicit
  record-ending characters, this is nowadays rather a rare cause of
  the problem.
\item A graphics input file, which a package is examining for its
  bounding box, contains a binary preview section.  Again,
  sufficiently clever \TeX{} distributions recognise this situation,
  and ignore the previews (which are only of interest, if at all, to a
  \TeX{} previewer).
\end{itemize}

The usual advice is to ignore what \TeX{} says (i.e., anything about
enlarging), and to put the problem right in the source. 

If the real problem is over-long text lines, most self-respecting text
editors will be pleased to automatically split long lines (while
preserving the ``word'' structure) so that they are nowhere any longer
than a given length; so the solution is just to edit the file.

If the problem is a ridiculous preview section, try using
\ProgName{ghostscript} to reprocess the file, outputting a ``plain
|.eps|'' file.  (\ProgName{Ghostscript} is distributed with a script
\ProgName{ps2epsi} which will regenerate the preview if necessary.)
Users of the shareware program \ProgName{GSview} will find buttons to
perform the required transformation of the file being displayed.
\begin{ctanrefs}
\item[ghostscript]Browse \CTANref{ghostscript}
\item[GSview]Browse \CTANref{gsview}
\end{ctanrefs}

\Question[Q-formatstymy]{``Fatal format file error; I'm stymied''}

\AllTeX{} applications often fail with this error when you've been
playing with the configuration, or have just installed a new version.

The format file contains the macros that define the system you want to
use: anything from the simplest (Plain~\TeX{}) all the way to the most
complicated, such as \LaTeX{} or \CONTeXT{}.  From the command you
issue, \TeX{} knows which format you want.

The error message
\begin{verbatim}
  Fatal format file error; I'm stymied
\end{verbatim}
means that \TeX{} itself can't understand the format you want.
Obviously, this could happen if the format file had got corrupted, but
it usually doesn't.  The commonest cause of the message, is that a new
binary has been installed in the system: no two \TeX{} binaries on the
same machine can
understand each other's formats.  So the new version of \TeX{} you
have just installed, won't understand the format generated by the one
you installed last year.

Resolve the problem by regenerating the format; of course, this
depends on which system you are using.
\begin{itemize}
\item On a te\TeX{}-based system, run
\begin{verbatim}
  fmtutil --all
\end{verbatim}
  or
\begin{verbatim}
  fmtutil --byfmt=<format name>
\end{verbatim}
  to build only the format that you are interested in.
\item On a Mik\TeX{} system, click \texttt{Start}\arrowhyph{}%
\texttt{Programs}\arrowhyph{}%
\texttt{MiKTeX \emph{version}}\arrowhyph{}%
\texttt{MiKTeX Options}, and in the options window, click
  \texttt{Update now}.
\end{itemize}

\Question[Q-nonpdfsp]{Non-\acro{PDF} special ignored!}

This is a \PDFTeX{} error: \PDFTeX{} is running in \acro{PDF} output
%  beware line break at end line
mode, and it has encountered a \nothtml{\csx{special} command (}%
\Qref{\cs|special|}{Q-specials}\latexhtml{)}{ command}.  \PDFTeX{} is
able to generate its own output, and in this mode of operation has no
need of \cs|special| commands (which allow the user to pass
information to the driver being used to generate output).

Why does this happen?  \LaTeX{} users, nowadays, hardly ever use
\cs|special| commands on their own~--- they employ packages to do the
job for them.  Some packages will generate \cs|special| commands
however they are invoked: \Package{pstricks} is an example (it's very
raison d'\^etre is to emit \PS{} code in a sequence of \cs|special|
commands).  \Package{Pstricks} may be dealt with by other means (the
\Package{pdftricks} package offers a usable technique).

More amenable to correction, but more confusing, are packages (such as
\Package{color}, \Package{graphics} and \Package{hyperref}) that
specify a ``driver''.  These packages have plug-in modules that
determine what \cs|special| (or other commands) are needed to generate
any given effect: the |pdftex| driver for such packages knows not to
generate \cs|special| commands.  In most circumstances, you can let
the system itself choose which driver you need; in this case
everything will act properly when you switch to using \PDFLaTeX{}.  If
you've been using \ProgName{dvips} (and specifying the |dvips| driver)
or \ProgName{dvipdfm} (for which you have to specify the driver), and
decide to try \PDFLaTeX{}, you \emph{must} remove the |dvips| or
|dvipdfm| driver specification from the package options, and let the
system recognise which driver is needed.
\begin{ctanrefs}
\item[pdftricks.sty]\CTANref{pdftricks}
\item[pstricks.sty]\CTANref{pstricks}
\end{ctanrefs}

\Question[Q-8000]{Mismatched mode ljfour and resolution 8000}

You're running \ProgName|dvips|, and you encounter a stream of error
messages, starting with ``\texttt{Mismatched mode}''.  The mode is the
default used in your installation~--- it's set in the \ProgName{dvips}
configuration file, and \texttt{ljfour} is commonest (since it's the
default in most distributions), but not invariable.

The problem is that \ProgName|dvips| has encountered a font for which
it must generate a bitmap (since it can't find it in Type~1 format),
and there is no proforma available to provide instructions to give to
\MF{}.

So what to do?  The number 8000 comes from the `\texttt{-Ppdf}' option
to \ProgName{dvips}, which you might have found from the answer
\nothtml{``wrong type of fonts'' (}% beware % beware line breaks
\Qref{``wrong type of fonts''}{Q-fuzzy-type3}\nothtml{)}.  The obvious
solution is to switch to the trivial substitute `\texttt{-Pwww}',
which selects the necessary type~1 fonts for \acro{PDF} generation,
but nothing else: however, this will leave you with undesirable bitmap
fonts in your \acro{PDF} file.  The ``proper'' solution is to find a
way of expressing what you want to do, using type~1 fonts.

\Question[Q-toodeep]{``Too deeply nested''}

This error appears when you start a \LaTeX{} list.

\LaTeX{} keeps track of the nesting of one list inside another.  There
is a set of list formatting parameters built-in for application to
each of the list nesting levels; the parameters determine indentation,
item separation, and so on.  The \environment{list} environment (the
basis for list environments like \environment{itemize} and
\environment{enumerate}) ``knows'' there are only 6 of these sets.

There are also different label definitions for the
\environment{enumerate} and \environment{itemize} environments at
their own private levels of nesting.  Consider this example:
\begin{quote}
\begin{verbatim}
\begin{enumerate}
\item first item of first enumerate
  \begin{itemize}
  \item first item of first itemize
    \begin{enumerate}
    \item first item of second enumerate
    ...
    \end{enumerate}
  ...
  \end{itemize}
...
\end{enumerate}
\end{verbatim}
\end{quote}
In the example,
\begin{itemize}
\item the first \environment{enumerate} has labels as for a
  first-level \environment{enumerate}, and is indented as for a
  first-level list;
\item the first \environment{itemize} has labels as for a first level
  \environment{itemize}, and is indented as for a second-level list;
  and
\item the second \environment{enumerate} has labels as for a
  second-level \environment{enumerate}, and is indented as for a
  third-level list.
\end{itemize}
Now, as well as \LaTeX{} \emph{knowing} that there are 6~sets of
parameters for indentation, it also \emph{knows} that there are only
4~types of labels each, for the environments \environment{enumerate}
and \environment{itemize} (this ``knowledge'' spells out a requirement
for class writers, since the class supplies the sets of parameters).

From the above, we can deduce that there are several ways we can run
out of space: we can have 6~lists (of any sort) nested, and try to
start a new one; we can have 4~\environment{enumerate} environments
somewhere among the set of nested lists, and try to add another one;
and we can have 4~\environment{itemize} environments somewhere among
the set of nested lists, and try to add another one.

What can be done about the problem?  Not much, short of rewriting
\LaTeX{}~--- you really need to rewrite your document in a slightly
less labyrinthine way.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\section{Current \TeX{}-related projects}

\Question[Q-LaTeX3]{The \LaTeX{}3 project}

The \LaTeX{}3 project team (see \URL{http://www.latex-project.org/latex3.html})
is a small group of volunteers whose aim is
to produce a major new document processing system based on the
principles pioneered by Leslie Lamport in the current \LaTeX{}.  It
will remain freely available and it will be fully documented at
all levels.

The \LaTeX{}3 team's first product (\LaTeXe{}) was delivered in 1994
(it's now properly called ``\LaTeX{}'', since no other version is current).

\LaTeXe{} was intended as a consolidation exercise, unifying several
sub-variants of \LaTeX{} while changing nothing whose change wasn't
absolutely necessary.  This has permitted the team to support a single
version of \LaTeX{}, in parallel with development of \LaTeX{}3.

Some of the older discussion papers about directions for \LaTeX{}3 are
to be found on \acro{CTAN}; other (published) articles are to be
found on the project web site (see
\URL{http://www.latex-project.org/articles.html}), as is some of the
project's experimental code
(\URL{http://www.latex-project.org/experimental}).  You can
participate in discussions of the future of \LaTeX{} through the
mailing list \texttt{latex-l}.  Subscribe to the list by sending a
message `\texttt{subscribe latex-l <\emph{your name}>}' to 
\mailto|listserv@urz.Uni-Heidelberg.de|
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\LaTeX{} project publications]\CTANref{ltx3pub}
\end{ctanrefs}

\Question[Q-omega]{The Omega project}

Omega
\htmlignore
(\ensuremath{\Omega})
\endhtmlignore
is a program built by extension of the \TeX{} sources which works
internally with `wide' characters (it is capable of dealing with all
of Unicode version 3); this allows it to work with most scripts in the
world with few difficulties from coding schemes.
\latexhtml{\ensuremath\Omega}{Omega} also has a
powerful concept of input and output filters to allow the user to work
with existing transliteration schemes, \emph{etc}.

An email discussion list is available: subscribe by sending a message
`\texttt{subscribe}' to \mailto|omega-request@omega.cse.unsw.edu.au|

\latexhtml{\ensuremath\Omega}{Omega} was first released in November 1996
by the project originators, John Plaice and Yannis Haralambous; a
recent version is maintained on
\acro{CTAN}.  However, \latexhtml{\ensuremath\Omega}{Omega} is now
an open source project, and details of a \ProgName{cvs} repository, as
well as papers and other information, are available via the
\htmlignore
\begin{dviversion}
  project's web site (\URL{http://omega.cse.unsw.edu.au}).
\end{dviversion}
\begin{pdfversion}
  \href{http://omega.cse.unsw.edu.au}{project's web site}.
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
  \href{http://omega.cse.unsw.edu.au}{project's web site}.
\end{htmlversion}

Implementations of \latexhtml{\ensuremath\Omega}{Omega}
are available as part of the te\TeX{},
mik\TeX{}, fp\TeX{} and \acro{C}Mac\TeX{} distributions
(see \Qref[question]{\TeX{} systems}{Q-TeXsystems});
\latexhtml{\ensuremath\Omega}{Omega} is also
distributed on the \TeX{}~Live \CDROM{}
(see \Qref[question]{\TeX{} \CDROM{}s}{Q-CD}).
\begin{ctanrefs}
\item[CTAN distribution]\CTANref{omega}
\end{ctanrefs}

\nothtml{\begingroup\boldmath}
\Question[Q-NTS]{The \NTS{} project}
\nothtml{\afterquestion}

The \NTS{} project was established in 1992, to produce a typesetting
system that's even better than \TeX{}.  The project is not simply
enhancing \TeX{}, for two reasons: first, that \TeX{} itself has been
frozen by Knuth
(see \Qref[question]{the future of \TeX{}}{Q-TeXfuture}), and second,
even if they \emph{were} allowed to develop the program, some members
of the \NTS{} team feel that \TeX{} in its present form is simply
unsuited to further development.  While all those involved in the
project are committed to \TeX{}, they recognise
that the end product may very well have little in common with \TeX{}
other than its philosophy.

The group's first product was nevertheless a set of
extensions and enhancements to \TeX{}, implemented through the standard
medium of a change-file.  The extended system is known \eTeX{}, and is
100\textpercent\ compatible with \TeX{}; furthermore, \eTeX{} can
construct a format 
that \emph{is} ``\TeX{}'', with no extensions or enhancements present.

The most recent base source of \eTeX{} (i.e., the Web change file) is
available on \acro{CTAN}.  Implementations of \eTeX{} are also
distributed on the \nothtml{\TeX{}~Live \CDROM{} (}%
\Qref{\TeX{}~Live \CDROM{}}{Q-CD}\nothtml{)}, and with most other modern
free \TeX{} distributions.

The project has now produced a \latexhtml{$\beta$}{beta}-version of
\TeX{} written (from scratch) in Java.  Since it \emph{isn't} \TeX{}
(it remains slightly incompatible in microscopic ways), it's known as
\NTS{}.  As might be expected, this first re-implementation runs
rather slowly, but its operation \emph{has} been demonstrated in
public, and the \latexhtml{$\beta$}{beta}-release is available on
\acro{CTAN}.
\begin{ctanrefs}
\item[e-TeX]Browse \CTANref{e-TeX}
\item[NTS]\CTANref{nts}
\end{ctanrefs}

\Question[Q-pdftex]{The \PDFTeX{} project}

\PDFTeX{} (formerly known as \TeX{}2\acro{PDF}) arose from
\latexhtml{H\'an \The{} Th\'anh's}{Han The Thanh's}
post-graduate research at Masaryk University, Brno, Czech
Republic.  The basic idea is very simple: to provide a version of
\TeX{} that can output \acro{PDF} as an alternative format to
\acro{DVI}.  \PDFTeX{} implements a small number of new
primitives, to switch to \acro{PDF} output, and to control various
\acro{PDF} features.
\latexhtml{H\'an \The{} Th\'anh}{Han The Thanh}
worked on \PDFTeX{} throughout his Ph.D.\ research into
typesetting, and the latest release includes facilities he wrote to
support novel typesetting techniques that he was studying.

Since he completed his studies, Han has had little time to work on
\PDFTeX{}, and day-to-day support is provided by a team of experts
(mostly in Europe).
The latest sources are available on \acro{CTAN}, and
implementations are available as part of Web2C, as well as the
te\TeX{}, mik\TeX{}, fp\TeX{}, and \acro{C}Mac\TeX{} distributions (see
\Qref[question]{\TeX{} systems}{Q-TeXsystems}); it is also distributed
on the \TeX{}~Live \CDROM{}
(see \Qref[question]{\TeX{} \CDROM{}s}{Q-CD}).
A version (by the author of \acro{C}Mac\TeX{}) for use with Oz\TeX{} is also
available on \acro{CTAN}.

A mailing list discussing \PDFTeX{} is available;
\htmlignore
\begin{dviversion}
  subscribe via the \acro{TUG} \ProgName{mailman} interface at
  \URL{http://www.tug.org/mailman/listinfo/pdftex}
\end{dviversion}
\begin{pdfversion}
  subscribe via the
  \href{http://www.tug.org/mailman/listinfo/pdftex}{\acro{TUG} \ProgName{mailman} interface}.
\end{pdfversion}
\endhtmlignore
\begin{htmlversion}
  subscribe via the
  \href{http://www.tug.org/mailman/listinfo/pdftex}{\acro{TUG} \ProgName{mailman} interface}.
\end{htmlversion}
\begin{ctanrefs}
\item[pdftex]\CTANref{pdftex}
\item[pdftex for OzTeX]\CTANref{pdftex-oztex}
\end{ctanrefs}

\Question[Q-mathml]{Future \acro{WEB} technologies and \AllTeX{}}

An earlier question
% beware line break
(\Qref[\htmlonly]{``converting to \acro{HTML}''}{Q-LaTeX2HTML}) % (tricksy)
% [the \htmlonly command is just \@gobble, and so consumes the "~"
% separator that \Qref creates]
addresses the issue of converting existing \AllTeX{} documents for
viewing on the Web as \acro{HTML}.  All the present techniques are
somewhat flawed: the answer explains why.

However, things are changing, with
better font availability, cunning \acro{HTML} programming and the
support for new Web standards.
\begin{description}
\item[Font technologies] Direct representation of mathematics in
  browsers has been hampered up to now by the limited range of symbols
  in the fonts one can rely on being available.  In the near future,
  we can expect rather wide availability of Unicode fonts with better
  coverage of symbols.
\item[\acro{XML}] The core of the range of new standards is
  \acro{XML}, which provides a framework for better structured markup;
  limited support for it has already appeared in some browsers.

  Conversion of \AllTeX{} source to \acro{XML} is already available
  (through \TeX{}4ht at least), and work continues in that arena.  The
  alternative, authoring in \acro{XML} (thus producing documents that
  are immediately Web-friendly, if not ready) and using \AllTeX{} to
  typeset is also well advanced.  One useful technique is
  \emph{transforming} the \acro{XML} to \LaTeX{}, using \acro{XSLT},
  and then simply using \LaTeX{}; alternatively, one may
  \nothtml{typeset direct from the \acro{XML} source (}%
  % beware line break
  \Qref{typeset direct from the \acro{XML} source}{Q-readML}\nothtml{)}.

\item[Direct represention of mathematics] 
  Math\acro{ML} is a standard for representing maths on the Web; its
  original version is distinctly limited, but efforts to give it
  greater richness (approaching that of \TeX{}) are under way.
  Browser support for Math\acro{ML} (e.g., in \ProgName{amaya}, a
  version of the Netscape `Open Source' browser \ProgName{mozilla} and
  in specially extended versions of \ProgName{Internet}
  \ProgName{Explorer}) is becoming available.  There's evidence that
  \AllTeX{} users are starting to use such browsers.
  
  Work in both the \TeX{}4ht and \ProgName{TtH} projects, to produce
  Math\acro{ML} is well advanced.

\item[Graphics] 
  \acro{SVG} is a standard for graphics representation on the web.
  While the natural use is for converting existing figures,
  representations of formulas are also possible, in place of the separate
  bitmaps that have been used in the past (and while we wait for the
  wide deployment of Math\acro{ML}).
  
  Browser plug-ins, that deal with \acro{SVG} are already available
  (Adobe offer one, for example).
\end{description}

\Question[Q-textrace]{The \TeX{}trace project}

\TeX{}trace is a bundle of Unix scripts that use a freeware boundary
tracing package to generate Type~1 outline fonts from \MF{} bitmap
font outputs.  The result is unlikely ever to be of the quality of
the commercially-produced Type~1 font, but there remain fonts which
many people find useful and which fail to attract the paid experts.

The project was started by P\'eter Szab\'o, and its current state is
available via the
% beware line break
{project's entry on Sourceforge}
and notable sets of fonts on \acro{CTAN} generated
using \TeX{}trace (apart from P\'eter Szab\'o's own
\acro{EC}/\acro{TC} font set) are Vladimir Volovich's \acro{CM}-Super
set, which covers the \acro{EC}, \acro{TC}, and the Cyrillic \acro{LH}
font sets, and Takanori Uchiyama's set of the Musix\TeX{} fonts.

Another system that says it's ``inspired'' by \TeX{}trace is
\ProgName{mftrace}: this is a small \ProgName{Python} program that
does the same job; both systems are increasingly being used to provide
Type~1 fonts to the public domain.
\begin{ctanrefs}
\item[CM-Super fonts]\CTANref{cm-super}
\item[textrace]\URL{http://www.cs.uu.nl/~hanwen/mftrace/}
\item[\latexhtml{\rmfamily\TeX{}trace}{\TeX{}trace} on SourceForge]%
  \URL{http://sourceforge.net/projects/textrace/}
\item[Type 1 versions of EC and TC fonts]\CTANref{ec-type1}
\item[musixtex fonts]\CTANref{musixtex-type1}
\end{ctanrefs}

\Question[Q-WYGexpts]{The \TeX{} document preparation environment}

\nothtml{``Why \TeX{} is not \WYSIWYG{}'' (}% beware line breaks
\htmlonly{``}\Qref{Why \TeX{} is not \WYSIWYG{}}{Q-notWYSIWYG}\latexhtml{)}{''}
outlines the reasons (or excuses) for the huge disparity of user
interface between ``typical'' \TeX{} environments and commercial word
processors.

Nowadays, at last, there is a range of tools available that try either
to bridge or to close the gap.  One range modestly focuses on
providing the user with a legible source document.  At the other
extreme we have \href{http://www.texmacs.org}{\ProgName{TeXmacs}},
a~document processor using
\TeX{}'s algorithms and fonts for both editor display and printing.
\ProgName{TeXmacs} does not use the \TeX{}
language itself (though among other formats, \LaTeX{} may be exported
and imported).  A bit closer to \LaTeX{} is
\href{http://www.lyx.org/}{LyX}, which has its own
editor display and file formats as well, but does its print output by
exporting to \LaTeX{}.  The editor display merely resembles the
printed output, but you have the possibility of entering arbitrary
\LaTeX{} code.  If you use constructs that LyX does not
understand, it will just display them as source text marked red, but
will properly export them.

Since a lot of work is needed to create an editor from scratch that
actually is good at editing (as well as catering for \TeX{}), it is
perhaps no accident that several approaches have been implemented
using the extensible \ProgName{emacs} editor.  The low end of the
prettifying range is occupied by syntax highlighting: marking \TeX{}
tokens, comments and other stuff with special colours.
Many free editors (including \ProgName{emacs}) can cater for \TeX{} in
this way.  Under Windows, one of the more popular editors with such
support is the
Shareware product \href{http://www.winedt.com/}{\ProgName{winedt}}.
Continuing the range of
tools prettifying your input, we have the \ProgName{emacs} package
\href{http://x-symbol.sourceforge.net}{\Package{x-symbol}}, which does
the \WYSIWYG{} part of its work by replacing single \TeX{} tokens and
accented letter sequences with appropriate-looking characters on the
screen.

A different type of tool focuses on making update and access to
previews of the typeset document more immediate.  A recent addition
in several viewers, editors and \TeX{} executables are so-called
`source specials' for cross-navigation.  When \TeX{} compiles a
document, it will upon request insert special markers for every input
line into the typeset output.  The markers are interpreted by the \acro{DVI}
previewer which can be made to let its display track the page
corresponding to the editor input position, or to let the editor jump
to a source line corresponding to a click in the preview window.

An \ProgName{emacs} package that combines this sort of editor movement
tracking with automatic fast recompilations (through the use of dumped
formats) is
\href{http://pauillac.inria.fr/whizzytex/}{\Package{WhizzyTeX}}
 which is best used with a previewer by the
same author.  A simpler package in a similar spirit is called
\href{http://www.activetex.org/}{\Package{InstantPreview}} and makes
use of a continuously running copy of \TeX{}
(under the moniker of \texttt{TeX daemon}) instead of dumping formats to
achieve its speed.

Another \ProgName{emacs} package called
\href{http://preview-latex.sourceforge.net}{\Package{preview-latex}}
tries to solve
the problem of visual correlation between source and previews in a
more direct way: it uses a \LaTeX{} package to chop the document source
into interesting fragments (like figures, text or display math) which
it runs through \LaTeX{} and replaces the source text of those
fragments with the corresponding rendered output images.  Since it
does not know about the structure of the images, at the actual cursor
position the source text is displayed while editing rather than the
preview.  This approach is more or less a hybrid of the source
prettifying and fast preview approaches since it works in the source
buffer but uses actual previews rendered by \LaTeX{}.

A more ambitious contender is called \TeX{}lite.  This
system is only available on request from its author;
it continuously updates its screen with the help of a special version
of \TeX{} dumping its state in a compressed format at each page and
using hooks into \TeX{}'s line breaking mechanism for reformatting
paragraphs on the fly.  That way, it can render the output from the
edited \TeX{} code with interactive speed on-screen, and it offers the
possibility of editing directly in the preview window.

That many of these systems occupy slightly different niches can be
seen by comparing the range of the
\ProgName{emacs}-based solutions ranging from syntax highlighting to instant
previewing: all of them can be activated at the same time without
actually interfering in their respective tasks.

The different approaches offer various choices differing in the
immediacy of their response, the screen area they work on (source or
separate window), degree of correspondance of the display to the final
output, and the balance they strike between visual aid and visual
distraction.
\begin{ctanrefs}
\item[preview-latex]Browse \CTANref{preview-latex}
\item[texmacs]Browse \CTANref{texmacs}
\end{ctanrefs}

\Question[Q-ant]{The \textsf{ANT} typesetting system}

Achim Blumensath's \textsf{ANT} project, in contrast to \NTS{}, aims
not to replicate \TeX{} with a different implementation technique, but
rather to provide a replacement for \TeX{} which uses \TeX{}-like
typesetting algorithms in a very different programming environment.
\textsf{ANT} remains under development: its implementation still lacks
at least one important part of the \TeX{} document model: insertions
(the basis of \LaTeX{} floats), as well as several minor things.

\textsf{ANT}'s markup language is immediately recognisable to the
\AllTeX{} user, but the scheme of implementing design in
\textsf{ANT}'s own implementation language (presently OCaml) comes as
a pleasant surprise to the jaded \acro{FAQ} writer.  This architecture
holds the promise of a system that avoids a set of serious problems
with \TeX{}'s user interface: those that derive from the design
language being the same as the markup language.
\begin{ctanrefs}
\item[\textsf{ANT} downloads]%
  \URL{http://www-mgi.informatik.rwth-aachen.de/~blume/Download.html}
\end{ctanrefs}

\Question[Q-aleph]{The Aleph project}

The Aleph \nothtml{(\ensuremath\aleph)} project aims to build a
``usable'' version of \nothtml{Omega (\ensuremath\Omega~--- }% beware ln break
\Qref{Omega}{Q-omega}\nothtml{)}, incorporating \eTeX{} extensions
from the \nothtml{\NTS{} project (}% ! line break (dammit)
\Qref{\NTS{}}{Q-NTS}\latexhtml{)}{ project}.

Two sets of concerns have provided impetus to the project: first, that
many users need the \eTeX{} extensions, and they're not on the
\latexhtml{\ensuremath\Omega}{Omega} development path; and second,
that the \latexhtml{\ensuremath\Omega}{Omega} project is currently
immersed in radical restructuring of
\latexhtml{\ensuremath\Omega}{Omega}, and is not able to be
particularly responsive to user requirements in the short term.  In
the longer term, the \latexhtml{\ensuremath\aleph}{Aleph} project hope
that their work will be rendered irrelevant by the development of
\latexhtml{\ensuremath\Omega}{Omega} proper.

The current pre-release snapshot of
\latexhtml{\ensuremath\aleph}{Aleph} resides on \acro{CTAN} with the
rather modest name of e-Omega. Follow development by subscribing
to the project mailing list via \URL{http://www.ntg.nl/mailman/listinfo/aleph}
\begin{ctanrefs}
\item[e-omega]Browse \CTANref{aleph}
\end{ctanrefs}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%
% This is the last section, and is to remain the last section...
\section{You're still stuck?}

\Question[Q-noans]{You don't understand the answer}

While the \acro{FAQ} maintainers don't offer a `help' service, they're
very keen that you understand the answers they've already written.
They're (almost) written ``in a vacuum'', to provide something to
cover a set of questions that have arisen; it's always possible that
they're written in a way that a novice won't understand them.

Which is where you can help the community.  Mail the 
\href{mailto:faq@tex.ac.uk}{maintainers} to report the answer
that you find unclear.  Time permitting (the team is small and all its
members are busy), we'll try and clarify the answer.  This way, with a
bit of luck, we can together improve the value of this resource to the
whole community.

(We need hardly say that we look forward to hearing from none of you:
but we're not so arrogant as to be confident that we won't!)

\Question[Q-newans]{Submitting new material for the \acro{FAQ}}

The \acro{FAQ} will never be complete, and we always expect that
there will be people out there who know better than we do about
something or other.  We always need to be put right about whatever
we've got wrong, and suggestions for improvements, particularly
covering areas we've missed, are always needed: mail anything you have
to the \href{mailto:faq@tex.ac.uk}{maintainers}.

If you have actual material to submit, your contribution is more than
ever welcome.  Submission in plain text is entirely acceptable, but
if you're really willing, you may feel free to mark up your submission
in the form needed for the \acro{FAQ} itself.  The markup is a
strongly-constrained version of \LaTeX{}~--- the constraints come from
the need to translate the marked-up text to \acro{HTML} on the fly
(and hence pretty efficiently).  There is a file \File|markup-syntax|
in the \acro{FAQ} distribution that describes the structure of the
markup, but there's no real substitute for reading at least some of
the source (\File|faqbody.tex|) of the \acro{FAQ} itself.  If you
understand \ProgName{perl}, you may also care to look at the
translation code in \File|texfaq2file| and \File|sanitize.pl| in the
distribution: this isn't the code actually used on the Web site, but
it's a close relation and is kept
up to date for development purposes.
\begin{ctanrefs}
\item[\nothtml{\rmfamily}\acro{FAQ} distribution]\CTANref{faq}
\end{ctanrefs}

\Question[Q-latexbug]{Reporting a \LaTeX{} bug}

The \LaTeX{} team supports \LaTeX{}, and will deal with
% beware line wrap
\emph{bona fide} bug reports.  However, you need to be slightly
careful to produce a bug report that is usable by the team.  The steps
are:

\nothtml{\noindent}\textbf{1.} Are you still using current \LaTeX{}?  Maintenance is only
available for sufficiently up-to-date versions of \LaTeX{}~--- if your
\LaTeX{} is more than two versions out of date, the bug reporting
mechanisms will reject your report.

\nothtml{\noindent}\textbf{2.} Has your bug already been reported?  Browse the
% beware line break
\href{http://www.latex-project.org/cgi-bin/ltxbugs2html?introduction=yes}{\LaTeX{} bugs database},
to find any earlier instance of your bug.  In many cases, the database
will list a work-around.

\nothtml{\noindent}\textbf{3.} Prepare a ``minimum'' file that exhibits the problem.
Ideally, such a file should contain no contributed packages~--- the
\LaTeX{} team as a whole takes no responsibility for such packages (if
they're supported at all, they're supported by their authors).  The
``minimum'' file should be self-sufficient: if a member of the team
should run it in a clean directory, on a system with no contributed
packages, it should replicate your problem.

\nothtml{\noindent}\textbf{4.} Run your file through \LaTeX{}: the bug
system needs the |.log| file that this process creates.

You now have two possible ways to proceed: either create a mail report
to send to the bug processing mechanism (5, below), or submit your bug
report via the web (7, below).

\nothtml{\noindent}\textbf{5.} Process the bug-report creation file, using \LaTeX{} itself:
\begin{verbatim}
  latex latexbug
\end{verbatim}
\File|latexbug| asks you some questions, and then lets you describe
the bug you've found.  It produces an output file \File|latexbug.msg|,
which includes the details you've supplied, your ``minimum'' example
file, and the log file you got after running the example.  (I always
need to edit the result before submitting it: typing text into
\File|latexbug| isn't much fun.)

\nothtml{\noindent}\textbf{6.} Mail the resulting file to
\Email{latex-bugs@latex-project.org}; the subject line of your email
should be the same as the bug title you gave to \File|latexbug|.  The
file \File|latexbug.msg| should be included into your message in-line:
attachments are likely to be rejected by the bug processor.

\nothtml{\noindent}\textbf{7.} Connect to the
% beware line break
\href{http://www.latex-project.org/bugs-upload.html}{latex bugs processing web page}
and enter details of your bug~--- category, summary and full
description, and the two important files (source and log file); note
that members of the \LaTeX{} team \emph{need} your name and email address, as
they may need to discuss the bug with you, or to advise you of a
work-around.

\htmlignore
\par
\endhtmlignore
\Question[Q-bug]{What to do if you find a bug}
\htmlignore
\par
\endhtmlignore
%
% This here isn't a reference to a question...
\label{lastquestion}

For a start, make entirely sure you \emph{have} found a bug.
Double-check with books about \TeX{}, \LaTeX{}, or whatever you're using;
compare what you're seeing against the other answers above; ask every
possible person you know who has any \TeX{}-related expertise.
The reasons for all this caution are various.

If you've found a bug in \TeX{} itself, you're a rare animal indeed.
Don Knuth is so sure of the quality of his code that he offers real
money prizes to finders of bugs; the cheques he writes are
such rare items that they are seldom cashed. If \emph{you}
think you have found a genuine fault in \TeX{} itself (or \MF{}, or the
\acro{CM} fonts, or the \TeX{}book), don't immediately write to Knuth,
however. He only looks at bugs once or twice a year, and even then
only after they are agreed as bugs by a small vetting team. In the
first instance, contact Barbara Beeton at the \acro{AMS}
(\Email{bnb@math.ams.org}), or contact
\nothtml{\acro{TUG} (}\Qref{\acro{TUG}}{Q-TUG*}\nothtml{)}.

If you've found a bug in \LaTeXe{}, you may \nothtml{report it (}%
\Qref{report it}{Q-latexbug}\nothtml{)} using mechanisms supplied in
the \LaTeX{} distribution.

If you've found a bug in \LaTeXo{}, or some other such unsupported
software, there's not a lot you can do about it.  You may find help or
\emph{de facto} support on a newsgroup such as
\Newsgroup|comp.tex.tex| or on a mailing list such as
\mailto|texhax@tex.ac.uk|, but posting non-bugs to any of these forums
can lay you open to ridicule!  Otherwise you need to go out and find
yourself a willing \TeX{}-consultant~--- \acro{TUG} maintains a
register of \TeX{} consultants (see
\URL{http://www.tug.org/consultants.html}).
