cmd:kpsewhich 

$ kpsewhich relsize.sty
/usr/share/texmf/tex/latex/misc/relsize.sty

Getting Help 

Local help & files 

info latex 

tkinfo latex &
$ ls -F /usr/share/texmf
context/  etex/      ls-R        metapost/  pdfetex/  texconfig/   xdvi/
aliases    doc/      fontname/  makeindex/  mft/       pdftex/   updates.dat
bibtex/    dvips/    fonts/     metafont/   omega/     tex/      web2c/

texdoc 

Usage: texdoc [OPTION]... [NAME]...
 Search for NAME in the TeX documentation and start a viewer.
--help        show this help
-v            verbose mode: show viewer command
-l            just list all matching files. Do not start a viewer.

Latex Tutorial Books 

A Simplified Introduction to Latex, refered as [ASI] afterwards http://www.ctan.org/tex-archive/info/simplified-latex/

The Not So Short Introduction to Latex2e, refered as [NSS] afterwards http://wso.williams.edu/help/lshort2e http://www.ctan.org/tex-archive/info/lshort/english/

This listing contains short descriptions of the control sequences that are likely to be handy for users of Latex v2.09 layered on TEX v2.0.

ctan 

http://www.ctan.org/find.html

faq 

http://www.tex.ac.uk/cgi-bin/texfaq2html

full latex reference manual 

http://www.giss.nasa.gov/latex/

news group 

comp.text.tex

ctan mirrors 

As of 2006.08.07:

ctan mirror hosts 
cam.ctan.org
carroll.aset.psu.edu
cis.uniRoma2.it
ctan.cdpa.nsysu.edu.tw
ctan.cms.math.ca
ctan.dcc.uchile.cl
ctan.localhost.net.ar
ctan.math.ca
ctan.math.utah.edu
ctan.osmirror.nl
ctan.teleglobe.net
ctan.unik.no
ctan.unsw.edu.au
dante.ctan.org
elena.aut.ac.nz
ftp.belnet.be
ftp.ccu.edu.tw
ftp.chg.ru
ftp.cise.ufl.edu
ftp.comp.hkbu.edu.hk
ftp.cstug.cz
ftp.ctex.org
ftp.das.ufsc.br
ftp.di.uminho.pt
ftp.duke.edu
ftp.eq.uc.pt
ftp.fu-berlin.de
ftp.funet.fi
ftp.gui.uva.es
ftp.gust.org.pl
ftp.gwdg.de
ftp.iasi.roedu.net
ftp.ist.utl.pt
ftp.jaist.ac.jp
ftp.join.uni-muenster.de
ftp.kddilabs.jp
ftp.kreonet.re.kr
ftp.ktug.or.kr
ftp.ktug.org.kr
ftp.linorg.usp.br
ftp.linux.ee
ftp.loria.fr
ftp.math.purdue.edu
ftp.mpi-sb.mpg.de
ftp.nara.wide.ad.jp
ftp.nctu.edu.tw
ftp.ntg.nl
ftp.ntua.gr
ftp.nus.edu.sg
ftp.oleane.net
ftp.osmirror.nl
ftp.rediris.es
ftp.rge.com
ftp.riken.go.jp
ftp.rrze.uni-erlangen.de
ftp.sun.ac.za
ftp.sunsite.kth.se
ftp.sunsite.utk.edu
ftp.sztaki.hu
ftp.tu-chemnitz.de
ftp.u-aizu.ac.jp
ftp.uni-stuttgart.de
ftp.univie.ac.at
ftp.uvsq.fr
ftp.yz.yamagata-u.ac.jp
gd.tuwien.ac.at
ibiblio.org
indian.cse.msu.edu
itchy.emate.ucr.ac.cr
komo.padinet.com
mirror.aarnet.edu.au
mirror.gnowledge.org
mirror.icis.pcz.pl
mirror.pacific.net.au
mirror.sg.depaul.edu
mirrors.dotsrc.org
mirrors.localhost.net.ar
neacm.fe.up.pt
sunsite.bilkent.edu.tr
sunsite.cnlab-switch.ch
sunsite.icm.edu.pl
sunsite.sut.ac.jp
sunsite.uakom.sk
sunsite.utk.edu
tex.ihep.su
tezcatl.fciencias.unam.mx
tug.ctan.org
tug.org
www.cam.ctan.org
www.cs.ruu.nl
www.cstug.cz
www.emate.ucr.ac.cr
www.linorg.usp.br
www.math.utah.edu
ctan mirror urls 
http://tug.ctan.org/ http://tug.ctan.org/lion.html ftp://ftp.sun.ac.za/CTAN ftp://ftp.ctex.org/CTAN ftp://ftp.comp.hkbu.edu.hk/pub/TeX/CTAN http://mirror.gnowledge.org/ctan ftp://komo.padinet.com/CTAN http://komo.padinet.com/CTAN/ ftp://ftp.kddilabs.jp/CTAN ftp://ftp.yz.yamagata-u.ac.jp/pub/CTAN http://ftp.yz.yamagata-u.ac.jp/pub/CTAN ftp://ftp.jaist.ac.jp/pub/TeX/tex-archive ftp://ftp.nara.wide.ad.jp/pub/TeX/CTAN ftp://ftp.riken.go.jp/pub/tex-archive ftp://ftp.u-aizu.ac.jp/pub/tex/CTAN ftp://sunsite.sut.ac.jp/pub/archives/ctan http://ftp.nara.wide.ad.jp/pub/TeX/CTAN/ http://sunsite.sut.ac.jp/pub/archives/ctan/ ftp://ftp.kreonet.re.kr/pub/CTAN ftp://ftp.ktug.or.kr/tex-archive http://ftp.ktug.org.kr/ ftp://tex.ihep.su/pub/TeX/CTAN http://tex.ihep.su/ ftp://ftp.chg.ru/pub/TeX/CTAN http://ftp.chg.ru/ ftp://ftp.nus.edu.sg/pub/docs/TeX ftp://ctan.cdpa.nsysu.edu.tw/Unix/TeX/CTAN ftp://ftp.ccu.edu.tw/pub/tex ftp://ftp.nctu.edu.tw/pub/tex http://ctan.cdpa.nsysu.edu.tw/ http://ftp.nctu.edu.tw/ ftp://sunsite.bilkent.edu.tr/pub/tex/ctan http://sunsite.bilkent.edu.tr/pub/tex/ctan/ ftp://ctan.unsw.edu.au/tex-archive http://ctan.unsw.edu.au/ ftp://mirror.aarnet.edu.au/pub/tex-archive http://mirror.aarnet.edu.au/CTAN/ ftp://mirror.pacific.net.au/CTAN http://mirror.pacific.net.au/CTAN/ ftp://elena.aut.ac.nz/pub/ctan http://elena.aut.ac.nz/ctan/ ftp://ftp.univie.ac.at/packages/tex ftp://gd.tuwien.ac.at/publishing/tex/CTAN http://gd.tuwien.ac.at/publishing/tex/CTAN/ ftp://ftp.belnet.be/packages/ctan ftp://ftp.cstug.cz/pub/tex/CTAN http://www.cstug.cz/ctan/index.html ftp://mirrors.dotsrc.org/ctan ftp://tug.org/tex-archive http://mirrors.dotsrc.org/ctan/ http://tug.org/tex-archive ftp://ftp.linux.ee/pub/tex-archive ftp://ftp.funet.fi/pub/TeX/CTAN ftp://ftp.loria.fr/pub/ctan ftp://ftp.oleane.net/pub/CTAN/ ftp://ftp.uvsq.fr/pub/TeX/CTAN http://ftp.oleane.net/pub/CTAN/ ftp://ftp.uni-stuttgart.de/tex-archive ftp://ftp.fu-berlin.de/tex/CTAN ftp://dante.ctan.org/tex-archive http://dante.ctan.org/tex-archive ftp://ftp.gwdg.de/pub/dante ftp://ftp.mpi-sb.mpg.de/pub/tex/mirror/ftp.dante.de/pub/tex ftp://ftp.tu-chemnitz.de/pub/tex ftp://ftp.join.uni-muenster.de/pub/software/CTAN ftp://ftp.rrze.uni-erlangen.de/pub/tex/ctan http://ftp.join.uni-muenster.de/pub/software/CTAN/ http://ftp.rrze.uni-erlangen.de/pub/tex/ctan/ ftp://ftp.ntua.gr/mirror/ctan ftp://ftp.sztaki.hu/pub/tex ftp://cis.uniRoma2.it/TeX ftp://ftp.ntg.nl/mirror/tex-archive ftp://ftp.osmirror.nl/pub/ctan/ http://ctan.osmirror.nl/ http://www.cs.ruu.nl/pub/tex-archive/ ftp://ctan.unik.no/tex-archive ftp://ftp.gust.org.pl/TeX ftp://mirror.icis.pcz.pl/tex-archive ftp://sunsite.icm.edu.pl/pub/CTAN http://mirror.icis.pcz.pl/tex-archive ftp://neacm.fe.up.pt/pub/CTAN http://neacm.fe.up.pt/pub/CTAN ftp://ftp.di.uminho.pt/pub/ctan ftp://ftp.eq.uc.pt/pub/software/TeX ftp://ftp.ist.utl.pt/pub/ctan http://ftp.eq.uc.pt/software/TeX/ ftp://ftp.iasi.roedu.net/pub/mirrors/ftp.ctan.org http://ftp.iasi.roedu.net/mirrors/ftp.ctan.org/ ftp://sunsite.uakom.sk/pub/mirrors/CTAN ftp://ftp.gui.uva.es/sites/ctan.org/ http://ftp.gui.uva.es/sites/ctan.org/ ftp://ftp.rediris.es/mirror/tex-archive ftp://ftp.sunsite.kth.se/pub/tex/ctan-mirror ftp://sunsite.cnlab-switch.ch/ftp/mirror/tex ftp://cam.ctan.org/tex-archive http://www.cam.ctan.org/tex-archive ftp://ctan.cms.math.ca/tex-archive http://ctan.math.ca/ ftp://itchy.emate.ucr.ac.cr/pub/ctan http://www.emate.ucr.ac.cr/ctan/ ftp://tezcatl.fciencias.unam.mx/tex-archive/ http://tezcatl.fciencias.unam.mx/tex-archive/ ftp://ftp.cise.ufl.edu/pub/mirrors/tex-archive ftp://mirror.sg.depaul.edu/pub/TeX/CTAN ftp://ftp.math.purdue.edu/mirrors/ctan.org/ http://ftp.math.purdue.edu/mirrors/ctan.org/ ftp://indian.cse.msu.edu/pub/mirrors/CTAN ftp://ctan.teleglobe.net/CTAN ftp://ftp.rge.com/pub/tex ftp://ftp.duke.edu/pub/tex-archive ftp://ibiblio.org/pub/packages/TeX ftp://carroll.aset.psu.edu/pub/CTAN ftp://ftp.sunsite.utk.edu/pub/CTAN http://sunsite.utk.edu/CTAN/ ftp://ctan.math.utah.edu/tex-archive http://www.math.utah.edu/pub/ctan/ ftp://tug.ctan.org/tex-archive http://tug.ctan.org/tex-archive ftp://mirrors.localhost.net.ar/pub/mirrors/ctan http://ctan.localhost.net.ar/ ftp://ftp.das.ufsc.br/pub/ctan ftp://ftp.linorg.usp.br/CTAN http://www.linorg.usp.br/CTAN/ ftp://ctan.dcc.uchile.cl/pub/lang/ctan/tex-archive http://tug.ctan.org/

Quick Reference 

latex 

Run 

For file txfl.tex

latex to dvi
  latex txfl
view dvi
  xdvi txfl
dvi to postscript
  dvips txfl           to printer
  dvips txfl -o        to file: txfl.ps
view postscript
  gv txfl.ps
  imagetool txfl.ps

Barebone Latex file 

Example: Barebone Latex file
\documentclass[11pt]{article}

% Preamble

\begin{document}

%body

\end{document}

font 

*References*: [ASI] $2.1, p10.

Emphasising & Decorating 

In printed books, words are emphasized by typesetting them in an italic font,

around the edges by using \fbox instead. (More on framing in $6, p. 81.) The

vary the font style 

This is \textbf{boldface}.
This is \textit{italic}.
This is \textrm{roman}.
This is \textsc{small caps}.
This is \textsf{sans serif}.
This is \textsl{slanted}.
This is \texttt{typewriter}.

Some combinations of font styles can be produced. For example,

\textbf{\textit{bolditalic}}

\bf, \textbf and \bfseries 

> All the books I read (quite limited though :->) use \textbf for
> bolding, but I also see people use \bf.

\bf was borrowed from plain TeX and is now obsolete in LaTeX2e and should not be used.

> The recommended syntax is \textbf{stuff} unless the stuff
> is very long, in which case {\bfseries stuff} is better
> because TeX won't fill up your memory looking for the }
> of the argument.

More or less. {bfseries …} also works a bit more quickly and therefore has two reasons to be preferred by class and package writers

Vary the font size 

tex:sizes 

\tiny, \scriptsize, \footnotesize, or \small. \normalsize, \large, \Large, \LARGE, \huge or \Huge.

Molly Alene Edmonds

Help 

You can make the text {large large} or {Large larger} or even {LARGE larger still}. You can also make it {huge huge}. You might want to make something {small small} or {footnotesize smaller} or even {scriptsize smaller still}. You can make it really {tiny tiny}.

Dealing with large block of texts 

The use of braces to enclose a font size specification is like an environment. Optionally, we can explicitly use the environment syntax: environment syntax is useful when you want to keep the size for a large block of text, and the braces format is useful for short phrases.

There is no intrinsic environment for font styles.

Justifications 

flushleft and flushright 

The flushleft environment allows you to create a paragraph consisting of lines that are flushed left to the left-hand margin. Each line must be terminated with a \\.

\begin{flushleft}
Text on line 1 \\
Text on line 2 \\
....
....
\end{flushleft}

Same for flushright.

\raggedright 

This declaration corresponds to the flushleft environment. This declaration can be used inside an environment such as quote or in a parbox.

Unlike the flushleft environment, the \raggedright command does not start a new paragraph; it simply changes how LaTeX formats paragraph units. To affect a paragraph unit's format, the scope of the declaration must contain the blank line or \end command (of an environment like quote) that ends the paragraph unit.

Same for \raggedleft.

Centering 

To center the text/graphics, put them inside a center environment

\begin{center}
text
\includegraphics[width=2in]{graphic.eps}
\end{center}

If the \includegraphics command is inside an environment (such as minipage or figure), the \centering declaration centers the remaining output of the environment. For example

\begin{figure}
\centering
\includegraphics[width=2in]{graphic.eps}
\end{figure}

is similar to

\begin{figure}
\begin{center}
\includegraphics[width=2in]{graphic.eps}
\end{center}
\end{figure}

double vertical space above and below the figure due to the space produced by the figure environment and by the center environment. If extra vertical space is desired, the commands in Section 18.1 should be used.

horizontal spacing 

\hspace 

\hspace[*]{len}

The \hspace command adds horizontal space. The length of the space len can be expressed in any terms that LaTeX understands, i.e., points, inches, etc. You can add negative as well as positive space with an \hspace command. Adding negative space is like backspacing.

LaTeX removes horizontal space that comes at the end of a line. If you don't want LaTeX to remove this space, include the optional * argument. Then the space is never removed.

\hfill 

The \hfill fill command produces a rubber length which can stretch or shrink horizontally. It will be filled with spaces. It is equivalent to \hspace\fill.

vertical spacing 

line spacing 

\usepackage{setspace}
\singlespacing
\onehalfspacing
\doublespacing
more specific 
\begin{spacing}{1.2}
\end{spacing}
help 

The easiest way to control line spacing throughout your document is to specify

\singlespacing \onehalfspacing \doublespacing Right after you specify one of these, that spacing will commence.

extra spacing 

\linebreak
\smallskip
\medskip
\bigskip
\vspace{length}
\vspace{\stretch{1}} % to last line of the page

*References*: [ASI] $2.1, p12. $2.6, p26.

Line and Page Breaks 

Page break 

cmd:\newpage

or better:

\vfill\eject

if \footnote is a concern.

Help 

You can cause a new line by entering \linebreak. When text is justified (the default), this could result in an undesirable appearance, like the following:

\textsf{This example is \linebreak extreme.}

The \newline command forces a new line without justifying it.

\textsf{Here is the extreme \newline example.}

The \nolinebreak command works analogously, preventing a line break, even if it means extending into the right margin.

There are two commands to force a page break: \pagebreak and \newpage. The \newpage command follows the analogy with \newline in forcing a page break precisely at the point it is specified, rather than completing the line as \pagebreak does. The \nopagebreak command disallows a page break immediately following the next blank line. The \samepage command prevents a page break within its scope. Here is an example that keeps line 1 on the same page as line 2.

Lists 

There are three intrinsic list environments, distinguished by what appears at the beginning of each item: number, bullet, or your description (perhaps nothing).

itemize 

\begin{itemize}
\item This is item 1 and our task has just begun. Blank lines
      before an item have no effect.
\item This is item 2 and we shall limit to just this few.
A blank line within an item does create a new paragraph, using the
indentation of the itemize environment.
\begin{itemize}
\item A second (nested) itemized list changes the bullet
  and indents another level.
\end{itemize}
\end{itemize}

enumerate 

\begin{enumerate}
 \item This is item 1, and we are having fun.
 \item This is item 2, and it's time to number anew.
 \begin{enumerate}
   \item Back to item 1, but we are not yet done.
   \item Two is new.
       \begin{enumerate}
       \item One again!
       \item Two (b) or knot 2b?
       \end{enumerate}
 \end{enumerate}
\end{enumerate}

description 

\begin{description}
\item [Basic Document Preparation.] Knowing how to setup ...
\item [Making Tables.] \LaTeX~ provides a means ...
\item [Bibliography.] Knowing how to create a bibliography ...
\item [Mathematics.] This is the power of \LaTeX~ and one ...
\item [Graphics.] This has progressed a great deal in the ...
\item [Other.] There are a great many things to learn ...
\end{description}

macro commands 

\newcommand{\lib}{\begin{itemize}}     % item list begin
\newcommand{\lie}{\end{itemize}}       % item list end
\newcommand{\leb}{\begin{enumerate}}   % enumerate list begin
\newcommand{\lee}{\end{enumerate}}     % enumerate list end
\newcommand{\ldb}{\begin{description}} % description list begin
\newcommand{\lde}{\end{description}}   % description list end

Quotation 

Commands 

\begin{quote}
short quotes, generally one short paragraph (as above), or a sequence of one
line quotes, separated by blank lines
\end{quote}
\begin{quotation}
``The indentation is the same as the quote, except the first line of each new
paragraph is indented.
\bigskip
``Next paragraph.''
\hfill --- Author
\end{quotation}

Help 

Now consider ways to indent a block of text. Here is an example using the

The quote environment is intended for short quotes, generally one short paragraph (as above), or a sequence of one line quotes, separated by blank lines. The quotation environment is used for long quotations, having more than one paragraph (separated by blank lines). The indentation is the same as the quote, except the first line of each new paragraph is indented. (Just as in the regular text, this can be overridden by the \noindent command.) Here is an

The quotes are by two pioneers of algorithms, Alan M. Turing and Donald E. Knuth. Their names appear on the right, after their quote, by skipping a line and entering \hfill (which means horizontal fill), to make the line flush right. Here are some other things to notice about this example:

Math mode 

*Tags*: expressions

Inline 
$ ... $
math display mode 
\[
...
\]
Note NO empty line between \[ and \] allowed!
\[
(L_i < R_j < R_i) \iif  \mbox{$i$ is the ancestor of $j$}
\]
Numbered expressions 

Use 'equation' environment.

s|\\\[|\\begin{equation}|
s|\\]|\\end{equation}|

Help 

One can write mathematical expressions by entering math mode, signified by delimiters $ … $ or \[ … \]. The $ delimiter keeps the mathematical expression in the text, like this:

A consequence of Einstein's postulates is that $E = mc^2$.

The other form is math display mode, like this:

A consequence of Einstein's postulates is that \[E = mc^2.\])

Reference & Crossreference 

*References*: [ASI] s4, p43.

Basic Concepts 

A counter is a numerical value that refers to something that is being numbered, such as pages, sections, figures, and equations. A label is the identification of a particular value, and a reference is a citation to a the counter's value is set, where label is unique in the document. The LATEX defined:

\section{Bibliography with \Bibtex} \label{sec:Bibliography}

arbitrary, except do not use LATEX special characters or blanks, just as the labels in the bib file entries.

There are times when you just want to produce the counter value, without a label. This is done by \thecounter. For example, \thepage produces the page number. On the other hand, if you want to use the counter's numerical value as

Current Reference 

\thepage, \thesubsection \thesection
help 

You are looking at page 44, which I was able to print by writing \thepage. Similarly, you are reading subsection 4.2 of section 4, whose numbers I could write by \thesubsection and \thesection, respectively.

Crossreference 

define 
\subsection{The bib File} \label{subsec:bibfile}
\subsubsection{Web citations} \label{subsubsec:webcite}

To illustrate how I can reference other parts of this document, the above labels were defined (when the subsection and subsubsection were first written):

ref 

Then, I can refer to these as follows:

\S\ref{subsec:bibfile} => $3.2
\S\ref{subsubsec:webcite} => $3.2.2

I can also refer to their page numbers:

p.~\pageref{subsubsec:webcite} => p. 36
p.~\pageref{subsec:bibfile} => p. 31
help 

used to have a space without a linebreak, which is an element of good style.)

No leading space for short line: 

\begin{flushleft}
Dear Sir or Madam,
\end{flushleft}

No leading space for short line: 

You can also suppress indentation of the first line of a paragraph with the \noindent command. Here is an example:

\noindent This paragraph is not indented.

No leading space for short line: 

*Tags*: latex left margin

To suppress indentation of the first lines of all the paragraphs, use

\setlength{\parindent}{0pt}

Related command:

\setlength{\parskip}{9pt}

documented on: 2001.02.25

Understanding Tex errors 

http://makingtexwork.sourceforge.net/mtw/ch03.html

When you write TeX documents, you will occasionally make mistakes and as a result, TeX won't be able to process your document. There are six broad classes of mistakes you're likely to make:

  1. Naming documents or files that TeX cannot find.

  2. Misspelling the name of a TeX control sequence.

  3. Failing to close an environment or forgetting to insert a closing brace after an opening brace.

  4. Using math operators outside of math mode or forgetting to close an opened math environment.

  5. Requesting a font that TeX cannot find.

  6. Everything else.

TeX is legitimately criticized for having error messages that are very difficult to understand. TeX frequently provides far more information than you really need or want, and the excess information often obscures the actual cause of the error.

Nevertheless, understanding what TeX does when it encounters an error will help make error messages easier to understand. Let's begin with an example. Example Example 3.1 shows a simple LaTeX document using the New Font Selection Scheme (NFSS), which contains an error.[33] The error is that the control sequence \Large, which has been redefined to request a 17pt

Example: Example 3.1. The Document BADFONT.TEX
00001: \documentstyle{article}
00002: % The following definition changes the font that LaTeX
00003: % uses for the 'Large' font.  I have introduced a typo
00004: % into the definition, "\fontsiz" should be "\fontsize".
00005: % The  first time a \Large font is requested, an error will occur.
00006: \renewcommand{\Large}{\fontsiz{17}{20pt}\selectfont}
00007: \begin{document}
00008:
00009: This text precedes the first section header.
00010:
00011: % Note: LaTeX uses the \Large font in section
00012: % headers...this will fail in a confusing way
00013: % because the error is deep within the definition
00014: % of \section where \Large is used...
00015: \section{First Section}
00016:
00017: This is the first and only sentence of the first section.
00018:
00019: \end{document}

When TeX processes this file, using LaTeX with the New Font Selection Scheme, it produces these error messages:

This is TeX, Version 3.1415 (C version 6.1)
LaTeX Version 2.09 <25 March 1992> with NFSS2
(badfont.tex (/work/nutshell/texguide/styles/latex/article.sty
Standard Document Style `article' <14 Jan 92>.
(/work/nutshell/texguide/styles/latex/art10.sty)) (badfont.aux)
(/usr/local/lib/tex/inputs/nfss2/T1cmr.fd)
! Undefined control sequence.
\Large ->\fontsiz
                  {17}{20pt}\selectfont
l.15 \section{First Section}

?

These messages exemplify the kind of confusing error messages that TeX produces. Remember the following rule: Always look at the first and last line of the TeX error message when trying to figure out what went wrong and where it went wrong. In this case, the first line is:

! Undefined control sequence.

and the last line is:

l.15 \section{First Section}

The error is that the control sequence \fontsiz is not defined and TeX was processing line 15 of the file when it occurred. The control sequence that is actually undefined is right after the point symbol '->', till the end of line. I.e., '->' points to the actual undefined control sequence.

Interpreting TeX Error Messages 

Note The text about the interpreting the TeX error messages is not strictly copied from the original article, but have been corrected by truly yours for consistency, and amended for clearness.

The first line of a TeX error message begins with an exclamation point followed by the text of the message. The lines that follow it show the context in which the error occurred. In the previous example, the error message indicates an Undefined control sequence. This means that TeX encountered a control sequence which was not previously defined.

The final line, which says

l.15 \section{First Section}

occurs right above the question mark prompt. It identifies the line in your document that TeX was processing when it encountered the error. The error occurred when TeX was at line 15 of the file, and that line began with

Between the first and last lines, TeX prints a detailed description of how the error occurred. This is necessary because the error may have occurred inside the replacement text of a macro that you used. When TeX encounters a control sequence, like \section, it has to look up the definition to figure out how to typeset your document. The definition of a control sequence may contain other control sequences which also have to be interpreted. It is possible for TeX to be several levels deep, as it was in this case, when an error occurs. To give the person who wrote the definition of the control sequence an opportunity to figure out what went wrong, TeX prints out a trace back of what happened before the error. As you gain experience with a particular macro package, you'll find the intervening lines more meaningful.

Correcting an error depends entirely on the nature of the error. In this case, all you need to do is correct the typo.

As stated above, there are six general classes of errors you might encounter when you run TeX. The following sections briefly describe each class.

Log Files 

You don't have to remember or write down the error messages that TeX produces. When TeX processes a document, it produces a transcript of everything that occurs; you can refer to this transcript later if you need to recall what errors occurred when you processed your document. TeX stores this transcript in a file which has the same name as the document and the extension .log. For example, if you process main.tex, TeX produces a transcript in main.log.

Note Log files go in the current directory. TeX always places the log file in the current directory, even if you specify a path when you format your document. For example, if you process lectures/main.tex, TeX produces a transcript in main.log, not in lectures/main.log as you might expect.

Naming a File TeX Cannot Find 

Missing documents are discussed in the section called "the section called "User Files"," earlier in this chapter.

If you request a format file that cannot be found, TeX issues the following warning message:

Sorry, I can't find that format; will try the default

TeX then attempts to typeset your document with Plain TeX.[36] To correct this problem, run TeX with the correct format file name. If the format file isn't available, you will have to build it. Chapter Chapter 4, Chapter 4, describes how to build format files for several common macro packages.

Misspelling a Control Sequence Name 

Misspelling a control sequence name is one of the most common errors. For identify. In many cases, you can simply proceed after encountering this error. Although TeX may not typeset your document correctly, you can continue to look for other errors. The section called "the section called "Interpreting TeX Error Messages"," later in this chapter, describes how to continue after an error.

In some cases, TeX may become badly confused by a misspelled control sequence name, in which case you should give up and fix the spelling error before trying to process your document further. This may happen if you of the control sequences which follow.

Sometimes TeX will complain that a control sequence is undefined when you know that the control sequence is spelled correctly. When this occurs, make sure that you are using the correct format file (see the section "the section called "The Command Line"" earlier in this chapter), loading the correct macro files, and using the correct style options.

Failure to Close an Environment 

Failure to close an environment is another very common error. There are several distinct errors in this category:

Math Outside of Math Mode 

TeX has a lot of operators for special treatment of mathematical formulas. These operators must occur inside mathematics mode, which is usually delimited by dollar signs in your document.

If you attempt to use math operators, superscripts, subscripts, or other math-mode control sequences outside of mathematics mode, the following error will occur:

! Missing $ inserted

This is your clue that a mathematics environment has not been closed properly or that you failed to open one before using a math-mode operator.

For example, the underscore character is usually defined to be a math-mode operator which starts a subscript, in other words H${}_2$O produces "H${}_2$O" in your document.[38] If you use the underscore outside of mathematics mode, such as in regular text:

The file "test_one" contains the …

TeX will respond:

! Missing $ inserted
<inserted text>
                $
<to be read again>
                  _
The file "test_
                one" contains the ...
?

In LaTeX, the easiest way around this problem is to enclose the offending text in a "verbatim" macro, like this:

The file "test_one" contains the ...

Note that the argument to the macrois delimited by any two identical characters (in this case, two "+" signs).

In Plain TeX or another format, the problem can be circumvented in similar ways; consult the reference for the format you are using. Also consult Table Table 1.2 in Chapter Chapter 1, Chapter 1, for a list of special characters and how to type them in your documents.

Missing Fonts 

The first time that you use each font, TeX loads font metric information about the font. The font metric information, stored in a TFM file, includes information about the sizes of each character as well as kerning and ligature information. These topics are discussed fully in Chapter Chapter 5, Chapter 5.

If you request a font that does not exist, for example crm10 (a misspelling of cmr10), TeX cannot find a TFM file for the font and therefore displays:

Font \myfont=crm10 not loadable: Metric (TFM) file not found

This means that TeX attempted to associate the font described by the TFM file crm10.tfm with the control sequence \myfont, but the TFM file didn't exist. You must have a TFM file for every font that you use.

A second kind of error---actually, a warning---occurs when you are using the New Font Selection Scheme (NFSS). The NFSS performs font substitution, if possible, when an unknown font is requested. The NFSS is described in Chapter Chapter 4, Chapter 4, in the "the section called "LaTeX"" section.

Everything Else 

There are, unfortunately, lots of other errors that can occur. Some of the errors are directly related to TeX while others are warning and error messages associated with particular macro packages. There is no way to catalog every one of them or suggest what can be done in every case.

The best advice I can offer is to isolate the problem in as small a document as possible, consult the references you have available very carefully, and, if all else fails, forward your problem to one of the electronic forums that deal with TeX (the Info-TeX mailing list and the comp.text.tex newsgroup, for example).

The Question Mark Prompt 

When TeX encounters an error, it displays an error message and a summary of the error, as described in the section called "the section called "What About Errors?"" earlier in this chapter. Following the error, TeX normally stops and displays the question mark prompt.

If you type a question mark of your own at the prompt, TeX displays the actions available to you:

? ? Type <return> to proceed, S to scroll future error messages, R to run without stopping, Q to run quietly, I to insert something, E to edit your file, 1 or … or 9 to ignore the next 1 to 9 tokens of input, H for help, X to quit. ?

You can type any of the following responses at the question mark prompt:

Type Return to proceed

Simply typing Return will cause TeX to ignore the error and proceed. Depending on the nature of the error, this may cause more errors immediately or later on.

Type S to scroll future error messages

Typing S tells TeX to continue and not to stop for most future errors. TeX will continue to print the error messages, both to the terminal and to the log file, but it will not display the question mark prompt again.

TeX will still stop and ask about missing files.

Type R to run without stopping

The R option is just like S except that it tells TeX to ignore missing files as well. TeX will proceed blindly forward as best as it can. You will still see all of the error messages scroll by as TeX proceeds.

Type Q to run quietly

This option is just like R except that error messages are not displayed on the screen. The messages are saved in the log file, however, even though they are not displayed.

Type I to insert something

If you notice a simple typo, you can correct it with the I command. For example, suppose that TeX complains of an undefined control sequence: can insert the correct control sequence by responding i\cite to the question mark prompt. TeX will ignore the misspelled control sequence and insert the (correct) sequence \cite in its place.

Inserting words or commands at the question mark prompt does not change your input file. It simply instructs TeX to pretend that your file contained a different sequence of words and commands. You must change the input file with an editor, or the same error will occur the next time you format the document.

Type E to edit your file

This option terminates TeX. If your system is configured appropriately, an editor will be loaded automatically, and the cursor will be placed at the offending line in your input file. This is not possible in all environments.

Type n, where n is a number between 1 and 9

This option tells TeX to ignore some of the input. After skipping over the number of tokens you request, TeX returns to the question mark prompt so that you can delete more tokens.

What's a token? When TeX reads an input file, it breaks each line down into the smallest, indivisible chunks that have meaning. These are called tokens. For the most part, tokens are individual characters. The exceptions are control sequences, which are single tokens, and white spaces which are also single tokens. There are other exceptions (and more technical definitions of "token"), but that's the gist of it.

Type H for help

Typing H displays a slightly more verbose description of the error that occurred and, usually, suggests the nature of the corrective action that you might take.

Type X to quit

Typing X tells TeX to stop immediately and ends the TeX program. If there are any completed pages (pages processed before the error, in other words), they are written to the DVI file before TeX ends.

How to reference the name of another section 

Newsgroups: comp.text.tex
> I read from the book that I can use \S\ref{subsubsec:webcite} and
> p.~\pageref{subsubsec:webcite} to reference the numbers.
>
> But how can I refer to the name of another section? Thanks

Get the titleref package from CTAN.

Scott

Install 

get from http://www.ctan.org/tex-archive/macros/latex/contrib/other/misc/titleref.sty

cp titleref.sty $TEXMF/tex/latex/misc/
chmod 644 $TEXMF/tex/latex/misc/titleref.sty
# texhash
texhash: Updating /usr/share/texmf/ls-R...
texhash: Updating /var/lib/texmf/ls-R...
texhash: Done.

help 

Use "\titleref" just like "\ref" and "\pageref".

% Titles for numbered sectioning units and for floats with captions are % the same as the respective TOC, LOF, or LOT entry (even when no TOC is % it will be used for the "\titleref".

% The title of the current section is also available without "\label": % Use the command "\currenttitle" to generate a "\titleref" to the current % section.

References in LaTeX 

>In the finished document the references turn out like this:
>
>[1,2,3,4,5,7]
>
>I'd much rather have it look something like this: [1-5,7]
>
>How do I do that?
>
\usepackage{cite}

You might not have the cite package installed; if not, get it from CTAN.

George.

cmd:\includeonly 

Modify the \includeonly{one,two,three} to your needs. For example, you probably don't want to LaTeX chapter one and two while you are modifying chapter three only. When you xdvi the document, all chapters will appear in the dvi file, but without going to the (painful) process of waiting hours for the whole thing to be LaTeXed.

cmd:\input or cmd:\include 

Synopsis 

If you want to "include" a file, use \input, not \include :-)

Explain 

The \include command is used in conjunction with the \includeonly command for selective inclusion of files. The file argument is the first name of a file, denoting file.tex. If the file is also in the file list of the \includeonly command or if there is no \includeonly command, the \include command is equivalent to

\clearpage \input{file} \clearpage

except that if the file file.tex does not exist, then a warning message rather than an error is produced.

Include Graphs 

Synopsis 
Explain 

Encapsulated PostScript (eps) is the easiest graphics format to import into LATEX. For example, eps files are inserted by specifying

\includegraphics{file.eps}

Optionally, the graphic can be scaled to a specified height or width

\includegraphics[height=4cm]{file.eps}
\includegraphics[width=3in]{file.eps}

Additionally, the angle option rotates the included graphic…

Horizontal Centering 

The placement of the graphic is controlled by the current text justification. To center the graphic, put it inside a center environment

\begin{center}
\includegraphics[width=2in]{graphic.eps}
\end{center}

If the \includegraphics command is inside an environment (such as minipage or figure), the \centering declaration centers the remaining output of the environment. For example

\begin{figure}
\centering
\includegraphics[width=2in]{graphic.eps}
\end{figure}

is similar to

\begin{figure}
\begin{center}
\includegraphics[width=2in]{graphic.eps}
\end{center}
\end{figure}

double vertical space above and below the figure due to the space produced by the figure environment and by the center environment. If extra vertical space is desired, the commands in Section 18.1 should be used.

Using Subdirectories 

When importing a large number of graphics files, it may be desirable to store the graphics files in a subdirectory. For example, when the subdirectory is named sub, one may be tempted to then include the file file.eps with the following command \includegraphics{sub/file.eps} While this syntax works for most Unix and dos T E X distributions, there are problems with such usage Inefficiency.

The best method is to modify the T E X search path. Another method is to specify sub/ in a \graphicspath command. However, this is much less efficient than modifying the T E X search path. Both of these options causing \includegraphics to automatically search the graphics subdirectory, allowing

\includegraphics{sub/file.eps}

to be replaced with

\includegraphics{file.eps}

TEX Search Path 

For web2c/teTeX Unix distributions, the T E X search path can be modified by setting the TEXINPUTS environment variable.

When using csh shells, setenv TEXINPUTS /dir1:/dir2:

Putting // after a directory causes all of its subdirectories to be searched. For example, setenv TEXINPUTS /dir1//:/dir2: causes all the subdirectories (and sub-subdirectories) of /dir1 to be searched. Be careful in using // as it may slow down the searching if the directory contains many files.

These examples also work for sh shells, although the syntax should be changed to TEXINPUTS=''/dir1:/dir2:''; export TEXINPUTS

Printing nice looking reports from linux?? 

Newsgroups: comp.os.linux.misc
Date: Tue, 01 Apr 2003 14:12:30 -0500

Bob Tennent wrote:

>  > I'm trying to print nice looking reports from a script running on a
>  > linux server.
>  >
>  > Is there any app or utility that can make "nice" prints that support
>  > lines for columns/rows and different font sizes, headers and so on or
>  > do i have to code postscript by hand?
>  >
>  > I guess i'm looking for some sort of tagged data to postscript
>  > converter (sort of like a html to postscript converter).
>
> Have you considered LaTeX?  Professional-quality typesetting from
> marked-up text.

I used LaTeX for my books. It's absolutely the best, most precise way to handle text. But it's a markup language and takes some learning. For more information see:

http://tex.loria.fr/english/general.html

To start learning see "The Not So Short Introduction to LaTeX2e," by Tobias Oetiker and a few others. Another excellent one is "A Simplified Introduction to LaTeX," by Harvey Greenberg.

"Not So Short" is a little more current than Greenberg, but I recommend both. Each goes a little more in depth than the other on certain topics.

If you want to know a little more about graphics (too much, actually) there's "Using Imported Graphics in LaTeX2e," by Keith Reckdahl. Another handy one is "The Comprehensive Symbol List," by Scott Pakin. Has all those wingdings, math and other symbols you might find handy.

LaTeX can also be used to make PDF files with hyperlinks within the document.

I like it so much I'm actually trying to figure out ways to use it in places where a traditional word processor is much more handy. The quality is such it can get that kind of hold on you.

Rod

Author of "Linux for Non-Geeks—Clear-eyed Answers for Practical Consumers" and "Boring Stories from Uncle Rod." Both are available at http://www.rodwriterpublishing.com/index.html

The Comprehensive LaTeX Symbol List 

Newsgroups: comp.text.tex

Name of contribution: The Comprehensive LaTeX Symbol List Name: Scott Pakin Location on CTAN: tex-archive/info/symbols/comprehensive Summary description: Samples of thousands of symbols that are accessible from LaTeX License type: lppl

Please note that PDF files are available as info/symbols/comprehensive/symbols-letter.pdf (for US letter paper dimensions)