SIAM L A TEX Workshop: First Steps Paul Gartside March 2, 2013 1 Introduction Today you are going to take the first steps in learning how to create beautiful mathematical documents using L A TEX (or review what you already know). I will demonstrate how to accomplish certain tasks with L A TEX on my computer (which is shown on the screen). You will then do the corresponding exercises below. 2 Hello World Task 1 Create a latex file called basic.tex whose output is just: Hello World. Task 2 Add more text to your latex file. Play with spaces and creating new paragraphs. 2.1 Structuring Your Document Task 3 Add sections, subsections and paragraphs to your latex file. Experiment. Try with and without numbering. Task 4 Add a title to your document. The title should be First Steps, the author you! and date your favorite date. Change the date to today s date. 1
3 Typesetting Math Create a new section at the end of your file. We will now work on putting math into your document. 3.1 Basic Expressions, Analysis Create a new subsection called Basic Expressions, Analysis. Typeset the following mathematics either in inline or displayed style, as requested. Task 5: Basic Equalities Inline: Take y = 3x + 2. Add spaces between the variables and other symbols. What happens? (Or does not happen!) Task 6: Greek α, ɛ, Ψ, Ω. Task 7: Powers and {...} to Group Inline: x 2 + 1 = 0. e πi + 1 = 0. Task 8: Subscripts Inline: The sequence (x n ) n, where x n = 1/n, is convergent. Task 9: Standard Functions Inline: sin 2 (x) + cos 2 (x) = 1. Display (use \pm for ±): ( b ± b 2 4ac)/(2a). Task 10: Fractions Inline: 1/2 = 1. 2 b ± b 2 4ac. 2a Task 11: Limits and Integrals Inline: e x dx = e x + C. x lim e t2 dt = π. x x 2
Task 12: Sums and Dots e x x n = n! = 1 + x + x2 2 +. n=0 Check the difference between \cdots and \ldots. 3.2 Logic and Set Theory Create a new subsection called Logic and Set Theory. Typeset the following mathematics either in inline or displayed style, as requested. Task 13: Logical Quantifiers Display (using \forall and \exists): x y : x + y = 0. Task 14: Set Operations \subseteq and \subset): Display (using \in, \cup, \cap, \setminus, x A (B C) \ D E F. Task 15: Caligraphic and Blackboard Bold Letters, and Set Builders Inline (using \mathcal{t}, \mathbb{r}, \{, \} and \emptyset): Define the cofinite topology by T = {U R : R \ U is finite} { }. You will probably get an error Undefined control sequence. or your reals, \mathbb{r} wont look as you expect: R. In the preamble of your latex file, on a line just after \documentclass{article} insert \usepackage{amssymb} now it should work. Task 16: Large Unions and Intersections Using \bigcup and \bigcap display: U λ = C {T x : x X}. 3.3 Matrices λ Λ Create a new subsection called Matrices. Typeset the following mathematics either in inline or displayed style, as requested. Typesetting matrices takes a little work. We do some simple cases. 3
Task 17: A Matrix To get: The characteristic polynomial χ(λ) of the 3 3 matrix a b c d e f g h i you would write: The characteristic polynomial $\chi(\lambda)$ of the $3 \times 3$ matrix \[ \left( \begin{array}{ccc} a & b & c \\ d & e & f \\ g & h & i \end{array} \right) \] Note the \begin{array}{ccc} this says you want a matrix with 3 columns whose contents should be centered. This matrix needs to be ended with \end{array}. Each row is entered with the contents of the columns separated by a &. Each row except the last is ended with a \\. Also note the \left(... \right) this gives the large left and right brackets around the matrix. Now typeset, using \left and \right for the sides of the determinant: is given by the formula χ(λ) = λ a b c d λ e f g h λ i. 4
3.4 Adding Extra Functionality: Packages To add capabilities to L A TEX that are not built in, we can load up packages. There is a huge range of packages available (see http://www.ctan.org/). There are packages for writing in Burmese, creating barcodes, decorating text with background s, a dozen packages helping with creating bibliographies, packages dealing with boxes and packages for people working in biology, biomedical and bus-study (business studies). And this is just some of the packages starting with b! We now want to add a package called amsthm that will help us nicely typeset theorems and proofs. As with all packages proceed as follows... In the preamble of your latex file, on a line just after \documentclass{article}, but before \begin{document}, insert \usepackage{amsthm} \verb 3.5 Theorems and Proofs Create a new subsection called Theorems and Proofs. We will learn how to typeset theorems (and lemmas etc) and proofs. First we need to initialize the amssymb package that we just added. In the preamble, after \usepackage{amsthm} (but before \begin{document}), add a line for theorem environments: \newtheorem{theorem}{theorem} And a line for corollaries: \newtheorem{corollary}[theorem]{corollary} Following the pattern for corollary you could also add lemmas, definitions, examples etc. Go back to the new subsection Theorems and Proofs. To typeset: Theorem 1. For every n 3, there are no integers x, y, z such that x n +y n = z n. Proof. Exercise for the reader. enter: \begin{theorem} For every $n \ge 3$, there are no integers $x,y,z$ such that $x^n+y^n=z^n$. \end{theorem} \begin{proof} Exercise for the reader. \end{proof} 5
This should be pretty self explanatory. To check you understand typeset: Theorem 2. The only zeros of the Euler zeta function, ζ(z), are the trivial ones. Proof. Patent pending. Corollary 3. Everything about prime numbers. 4 Conclusion (of Part 1) You now know enough to typeset most mathematics you will need. See the Not So Short Introduction to L A TEX for much more information: http://www.math.washington.edu/tex-archive/info/lshort/english/ lshort-letter.pdf All you need to do now is to prove some new theorems :-) 6