
Your Latex

Editing Cycle
 A text editor is used to create a source file
 “Typesets” the source file and views the result on the monitor
 Making changes and observing the results of these changes
 Print the file and mostly creates a PDF file of the typeset version

Three productivity tools

Synchronization
 move quickly between the source file and the typeset file

Block comment
 comment or uncomment a block of text at one time

Jump to a line
 jump to a line specified in the source file by the line number

Typing text

A source file
 text
 math (formulas)

instructions (commands) to LaTeX
 command with an argument
 command without an argument

environment.
 content:
the text that is typed between
two environment commands
 start with a backslash ( \ )

The keyboard

used to type text
 az AZ 09
+ = * / ( ) [ ]

punctuation marks can be used
 , ; . ? ! : ` ' 
 the space bar, the Tab key, and the Return (or Enter) key

special keys used in LaTeX commands

# $ % & ~ _ ^ \ { } @ " 
 Only @ requires no special command
 Others need to insert a backslash ( \ ) before

Your first note

comments
 everything on the line after % is ignored

document class
 control how the document is formatted

environment
 \begin{document} and \end{document}

text
 typed within the document environment

Lines too wide
 LaTeX uses points (pt) to measure distances
 hyphenate a hyphenated word only at the hyphen
 LaTeX’s standard hyphenation routine cannot handle German hyphenation and so on

More text features

display the date on which the document is typeset
 \today

environments to justify text
 \begin{flushright} ... \end{flushright}
 \begin{center} ... \end{center}
 \begin{flushleft} ... \end{flushleft}

text style

\emph
 emphasize text

\textbf
 bold text

\texttt
 typewriter style text

form of the LaTeX commands
 backslash( \ )

command name
 terminated by the first nonalphabetic character
 case sensitive

arguments (if have)
 takes the next character as argument if braces nonexist

multiple role of hyphens

Double hyphens are used for number ranges
 8964 as 8964

triple hyphens for the em dash punctuation mark
  as —

new line command
 \\ (or \newline):

create additional space between lines
 \\[distance]
 square brackets means optional
 distance may be given in points (pt), centimeters (cm), or inches (in)

new page command
 \newpage

Special rules for special characters

accented characters and some European characters
 e.g. \"{a}

Typing math

math environments

inline
 open and close with $

displayed
 open with \[ and close with \]

spacing rules
 ignore space with two exceptions
 spaces terminate commands

Spaces in the arguments of certain commands
 e.g. /text

formula

Arithmetic

\cdot or \times
 . or x in ab as a.b or a x b

\frac
 for fractions and seldom used inline

(underscore)_ and (caret)^
 subscript and superscript
 should be enclosed in braces or take the first one as argument

(prime)'
 automatically superscripted in math

Binomial coefficients
 \binom{}{}

Congruences

a \equiv v \pmod{\theta}
 Topic

a \equiv v \pod{\theta}
 Topic

Delimiters

\left and \right
 resize the parentheses according to the symbols inside

\quad
 a spacing command

Ellipses

\dots
 ellipsis ( . . . ) in text

Integrals

\int
 an integral
 The lower limit is specified as a subscript
 the upper limit is specified as a superscript

\,
 a spacing command

Math accents
 \bar{a}
 \hat{a}
 \tilde{a}
 \vec{a}

Matrices

\begin{matrix} ... \end{matrix}
 matrix environment
 has to appear within a math environment
 As a rule, it's in a displayed math environment
 does not provide delimiters

&
 separate matrix elements within a row

\\
 separate rows
 Do not end the last row with a new line command

\begin{pmatrix} ... \end{pmatrix}
\begin{vmatrix} ... \end{vmatrix}
 provide delimiters as
\left( ... \right)
\left ... \right

Operators
 \sin
 \lim_{x \to 0} f(x) = 0

Large operators
 \sum
 for sum
 \sum_{i=1}^{n} x_{i}^{2}
 \prod
 for product
 \prod_{i=1}^{n} x_{i}^{2}

Roots

\sqrt
 \sqrt{a + 2b}
 \sqrt[n]{5}

Text
 \text

Displayed formulas

Equations
 \begin{equation} ... \end{equation}
 the equation number is automatically generated

use symbolic label to refer to the equation
 the argument of the \label command
 used the convention that the label of an equation starts with E:
 referenced
 \ref
 the number of the formula
 \eqref
 provide the reference number in parentheses
 \pageref
 the page of the formula
 ~
 nonbreakable space
 ensure the equation number on the same line

symbolic referencing
 symbol
 the argument of the \label command
 can be referenced with \ref, \eqref, or \pageref commands
 same mechanism for all of the generated numbering systems
 sections, subsections, subsubsections, equations,
theorems, lemmas, and bibliographic references
 except that for bibliographic references
 \bibitem
 define a bibliographic item and
 \cite
 cite a bibliographic item

tagged
 \tag
 The tag replaces the equation number
 Tags are absolute while numbers relative
 \notag
 prevent the numbering
 useful in a fromula more than one line

Aligned formulas

\begin{align} ... \end{align}
 Simple alignments
 \\
 line separator
 should not have one to terminate the last line
 &
 alignment point
 place it before where you want to be aligned
 Annotated alignment
 &&
 a mark for the start of the annotation
 align* environment
 no line be numbered

cases
 within a math environment such as equation or align environment
 \begin{cases} ... \end{cases}
 you can put inline math inside the argument of a \text command
 \\
 Separate the lines
 &
 indicate the annotation

first article

The anatomy of an article

preamble
 everything from the first line to the line \begin{document}
 specify additional commands that are used throughout the document
 specifies the document class and enhancements or packages

\documentclass
 The only required command
 \usepackage{}
 \newtheorem{}{}

body.
 the content of the document environment
 between the lines \begin{document} and \end{document}

top matter
 title page information and the abstract
 follows the line \begin{document} and concludes with the line \maketitle

main matter
 \section{}
 \begin{theorem} ... \end{theorem}
 \begin{figure}[hbt]
\centering\includegraphics{}
\caption{}
\end{figure}
 \begin{proof} ... \end{proof}

back matter
 \begin{thebibliography}{n}
\bibitem{maker}
content
bibitem{}...
\end{thebibliography}
 n tell LaTeX to make room for number
9 for references fewer than 10
99 for references between 10 and 99
and so on
 reference with the \cite{marker} command

An article template

Top matter

\thanks
 places an unmarked footnote at the bottom of the first page

\author
 multiple authors get separate \author and \address commands

\address
 Separate the lines with \\
 Do not put a \\ at the end of the last line

\date
 \date{\today} typesets today’s date
 \date{March 14, 2009}

\title
 the only required command
 break the title into separate lines with \\
Do not put a \\ at the end of the last line

\maketitle
 if you do not give the \maketitle command, even the \title command is optional
On the other hands, if there exists \maketitle and no \title, there comes an error

Sectioning
 \section{Content}\label{mark}
...
\ref{mark}
 section number is automatically assigned
 \section* produces an unnumbered section
 \subsection \subsubsection
\subsection* \subsubsection*

proclamations
 defined in the preamble with \newtheorem
 theorem number is automatically assigned
 \begin{theorem}\label{mark}
Content
\end{theorem}
...ref{mark}

references

Examples
 an article
in a journal
 \bibitem{sF90}
SooKey Foo,
\emph{Lattice Constructions},
Ph.D. thesis,
University of Winnebago, Winnebago, MN,
December, 1990.
 a book
 \bibitem{gM68}
George~A. Menuhin,
\emph{Universal algebra}.
D.~Van Nostrand, Princeton, 1968.
\bibitem{
 a Ph.D. thesis
 \bibitem{eM57}
Ernest~T. Moynahan,
\emph{On a problem of M. Stone},
Acta Math. Acad. Sci. Hungar. \textbf{8} (1957),
455460.
 a technical report
 \bibitem{eM57a}
Ernest~T. Moynahan,
\emph{Ideals and congruence relations in
lattices.} II,
Magyar Tud. Akad. Mat. Fiz. Oszt. K\"{o}zl.
\textbf{9} (1957), 417434.
 You have to arrange the references in thebibliography environment to see them
LATEX only takes care of the numbering and the citations in the text

On using LaTeX

error messages
 Typographical errors
 errors in mathematical formulas or in the formatting of the text
 errors in your instructions to LaTeX
 Tip
Typeset often

Logical and visual design
 you should concentrate on what you say
let LaTeX take care of the visual design