L A TEX Introduction Melissa Desjarlais (amended by Dr. Dena Morton) Abstract We showcase some L A TEX typesetting. Additionally, we give resources for further exploration of typesetting mathematics and other things with L A TEX. 1 Basic Resources: Some things you will need or may want to download MikTeX from www.miktex.org WinEdt (a student license for $30) from www.winedt.com TeXnic Center from www.toolscenter.org/front content.php Ghostview (for using Postscript files) from www.cs.wisc.edu/ ghost/ Additional packages from ctan.tug.org Some additional websites that may be helpful 1. The Official WinEdt Community Site www.winedt.org 2. Information about L A TEX www.latex-project.org 3. Getting Started with LATEX www.maths.tcd.ie/ dwilkins/latexprimer/ 4. Text Processing using L A TEX www-h.eng.cam.ac.uk/help/tpl/textprocessing/ 5. AMS-L A TEX www.ams.org/tex/amslatex.html 6. The TEX Catalogue Online www.ctan.org/tex-archive/help/catalogue/bytopic.html 7. The Comprehensive LaTeX List www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf Some LATEX books that may be helpful. Math into L A TEX George Grätzer The TEXBook Donald Erwin Knuth 1
L A TEX A Document Preparation System Leslie Lamport The L A TEXCompanion Michel Goossens and Frank Mittelbach and Alexander Samarin The L A TEXGraphic Companion Michel Goossens and Sebastian Rahtz and Frank Mittelbach The LATEXWeb Companion Michel Goossens and Sabastian Rahtz and et al. A Guide to L A TEX Document Preparation for Beginners and Advanced Users Helmut Kopka and Patrick W. Daly TEXUnbound LATEXand TEXStrategies for fonts, graphics, and more Alan Hoenig 2
2 Typing Text There are some symbols that are reserved for LATEXcommands: Also, straight double quotes. # $ % & ˆ {} \ You can add comments to a L A TEX document by placing % in front of anything that you do not want to appear in the L A TEX ed document. If you want to have comments with multiple lines, the % symbol must appear on each line. 2.1 Spacing If you have two or more spaces in text, only one space will be displayed. A blank line indicates the end of a paragraph (and L A TEXwill automatically indent the next line). Spaces at the beginning of a line are ignored. Within lines: You can force a line to indent, prevent a line from indenting or make a horizontal skip with the following commands. \indent, \noindent, \hskip0.1in Between lines: You can force text to begin on a new line or make a vertical skip with the following commands. \newline, \vskip0.1in You can begin a new page by using the following command: \newpage 2.2 Commanding L A TEX There are commands and environments in L A TEX. Examples of commands are \emph{text} {\it text} which would both italicize the word text: text or text. An environment has a begin and an end command: \begin{center} This text would be centered horizontally on the page. \end{center} Everything typed between the two commands is in that environment. So this actually looks like This text would be centered horizontally on the page. 3
3 Text Environments You can create a numbered list using the enumerate environment: \begin{enumerate} \item Talk about posters \item Talk about \LaTeX \end{enumerate} which would be displayed as 1. Talk about posters 2. Talk about L A TEX You can create a bulleted list by using the itemize environment: \begin{itemize} \item Work on research \item Play volleyball % \item Watch a movie \end{itemize} which would be displayed as Work on research Play volleyball To have L A TEX commands displayed without being evaluated, you can use the verbatim environment. 3.1 Proclamations In L A TEX, theorems, lemmas, definitions, etc. are displayed in text environments called proclamations (or theorem-like structures). To use a proclamation, you need to define the proclamation with a newtheorem command in the preamble of the document, and then you invoke the proclamation in the body of the document. The first line below would appear in the preamble while the next three lines would appear in the body of the document. \theoremstyle{plain} \newtheorem*{theorem}{theorem} \begin{theorem} My first theorem. \end{theorem} which would be displayed as Theorem. My first theorem. 4
Notice that the theorem is not numbered and it is italicized. These are two things that can be changed. By removing the asterisk, the theorems would then be numbered. The first line below would appear in the preamble while the next three lines would appear in the body of the document. \theoremstyle{plain} \newtheorem{proposition}{proposition}[section] \begin{proposition} My first numbered proposition. Note this is numbered by the section number (this can also be user defined...) \end{proposition} which would be displayed as Proposition 1. My first numbered proposition. Note this is numbered by the section number (this can also be user defined...) 3.2 Proof Environments The AMS document classes and the amsthm package define a proof environment. \begin{proof} This is a proof, delimited by the q.e.d. \ symbol. \end{proof} would be displayed as: Proof. This is a proof, delimited by the q.e.d. symbol. Tabular environments You can use the tabular environment to create a table. \vskip0.1in \begin{tabular}{ l r c }\hline Name & Course & Grade \\ \hline Rebecca & Counting 101 & A+ \\ Elisheva & Cuteness and Burping 305 & A++ \\ Jack & How to be a good Husband 809 & A+++\\ Dena & How to Sleep after Baby 1001 & F-- \\ \hline \end{tabular} \vskip0.1in which would be displayed as Name Course Grade Rebecca Counting 101 A+ Elisheva Cuteness and Burping 305 A++ Jack How to be a Good Husband 809 A+++ Dena How to Sleep after Baby F 5
The information after the first tabular indicates where there are vertical lines and how the text is justified: left, right or center. Each line (other than the last line) is ended with two backslashes. Items on each line are separated by ampersands. A horizontal line can be added with the \hline command. If you want a horizontal line at the end, you need to end the last line with two backslashes. If you do not skip a little space before and after the table, it will appear within a line. There are many options that can be used with the tabular environment. 6
4 Typing Mathematics A math formula can be typeset inline, as part of the current line, or displayed, on a separate line with space above and below the formula. Dollar signs are used as delimiters for a math environment. A single pair of dollar signs is used for inline math. A double pair of dollar signs can be used to display the math on a separate line. Other math environments are \equation, \aligned, \split, \matrix Greek letter are displayed by typing a backslash and then the letter, such as \delta or \Delta. If delta is not capitalized, the lowercase delta will be displayed; if Delta is capitalized, the uppercase delta will be displayed. Use underscores and carets to make subscripts and superscripts, respectively. If you want more than one character to be in an exponent, you need to put the characters inside braces { }. Some math commands you may want to use include \frac{a}{b}, (a \choose b}, \lim_{x \to a} f(x), \sum_{i=1}^{n} i^2, A \cup B, A \cap B which would be displayed as inline as a b,( a) b,limx a f(x), n i=1 i2,a B,A B or as ( ) a a n b,, lim f(x), i 2,A B,A B b x a i=1 if not inline. Other math formulas: would result from n k=0 ( ) n = k lim x ( ) n + + 0 2x 2 + 3x 4x 2 7 = 1 2 e x2 dx = π ( n ) c A i = i=1 n i=1 ( ) n = 2 n k A c i $$\sum_{k=0}^{n} {n \choose k}= {n \choose 0} + \cdots + {n \choose k} =2^n $$ $$ \lim_{x \to \infty} \frac{2x^2+3x}{4x^2-7}=\frac{1}{2} $$ $$\int_{-\infty}^{\infty} e^{-x^2} \, dx= \sqrt{\pi}$$ $$\left(\bigcup_{i=1}^{n} A_i \right)^c=\bigcap_{i=1}^{n} A_i^c$$ There are also many mathematical symbols that can be used. Some are included below, but the comprehensive list of symbols (an 82 page document) can be found at ctan.tug.org. 7
There are a number of options for matrices: a + b + c uv ( a + b + c ) uv [ a + b + c ] uv a + b c + d a + b c + d a + b c + d a + b + c uv a + b c + d a + b + c uv { } a + b + c uv a + b c + d a + b c + d The first matrix is typed as: \begin{matrix} a+b+c & uv \\ a+b & c+d \end{matrix} while the others, instead of matrix, use pmatrix, bmatrix, vmatrix, Vmatrix, and Bmatrix, respectively. Another matrix example: results from a 11 a 1n a 21 a 2n..... a n1 a nn \begin{equation*} \begin{bmatrix} a_{11} & \cdots & a_{1 n} \\ a_{21} && a_{2 n} \\ & \ddots & \\ \vdots && \vdots \\ a_{n 1} & \cdots & a_{n n} \end{bmatrix} \end{equation*} Note that the asterisk after the word equation means that the equation is not numbered. Here s what the equation looks like with \begin{equation} and \end{equation}: a 11 a 1n a 21 a 2n... (1).. a n1 a nn Let s reference it: 1. You can use the \aligned command to display a series of equations where, for example, the equal signs are all lined up. The following 8
\begin{equation*} \begin{aligned} 3x+5 &= 7x-11 \\ %5 &= 4x-11 \\ 16 &= 4x \\ x &= 4 \end{aligned} \end{equation*} would be displayed as: 3x + 5 = 7x 11 16 = 4x x = 4 The \split command can be used to display a series of computations where, for example, the equal signs are all lined up. The following \begin{equation*} \begin{split} (a+b)(a-b) &= a^2-ab+ba-b^2 \\ &= a^2-ab+ab-b^2 \\ &= a^2-b^2 \end{split} \end{equation*} would be displayed as: (a + b)(a b) = a 2 ab + ba b 2 = a 2 ab + ab b 2 = a 2 b 2 The \cases command can be used to define a piecewise function. The following \begin{equation*} f(x)= \begin{cases} -x^2 & \text{if } x < 0; \\ \alpha+x & \text{if } 0 \leq x \leq 1; \\ x^2 & \text{otherwise.} \end{cases} \end{equation*} would be displayed as x 2 if x < 0; f(x) = α + x if 0 x 1; x 2 otherwise. 9
4.1 Some Math Symbols Type Typeset Type Typeset Type Typeset \leq \geq \sim \approx \equiv \cong = \subset \supset \subseteq \supseteq \smile \frown \therefore \because \nless \ngtr \neq \notin / \nsubseteq \nsupseteq \subsetneq \supsetneq \pm ± \mp \times \div \circ \bullet n\oplus \otimes \ast \dagger \triangleleft \setminus \ \leftarrow \to \longleftarrow \longrightarrow \Leftarrow \Rightarrow \leftrightarrow \Leftrightarrow \uparrow \downarrow \Uparrow \Downarrow \mapsto \hookrightarrow \leftharpoonup \rightharpoondown \forall \exists \clubsuit \diamondsuit \heartsuit \spadesuit \langle \rangle \lceil \rceil \lfloor \rfloor \sin sin \log log \gcd gcd \max max \det det \liminf lim inf \bar{a} ā \hat{a} â \tilde{a} ã \vec{a} a \mathcal{a} A \mathbb{a} A \int \cdot \in \infty \star \vee \wedge \aleph ℵ \ldots... \cdots \ddots... \vdots. \mathbb{z} \cup \cap \bigcap Z \{ { \} } \backslash \ \hat{a} â \acute{a} á \sqrt{a} a Most of this information came from Math into L A TEX by George Grätzer at the internet. 10
5 Sample Document This is a sample document. You can tell it is a sample document because it is a document with a bunch of text. We also have a bunch of equations, coming right up. For example, since we love calculus, let s do a derivative and an integral. The derivative is going to be inside of this sentence: d dy (y2 3) = 2y. Here s a partial derivative x (sec ye y + arctan y + 42) = 0. The integral is beautiful so gets displayed and centered nicely on its own line: π e ( ) 2 cos(x) sin(x) dx. We can italicize important statements. Generally in mathematics we do not bold our statements. We can leave a very nice, comfortable vertical space of 1/2 an inch right here: We can look at sets. Surely, you all love discrete mathematics. Let Z represent the integers, as always. Then we know that 3 Z, {3,4,5} Z, 2 Z, {3,4,π} Z. To and beyond!!! If A B then ( B) ( A). If A B C, then mathematics is cool. Hey, so are sub scripts. We can make a bulleted list, which in this case contains your homework: Assignment 1: Typeset something technical (i.e. with formulas) from your paper. Assignment 2: Continue to do your research. 11