\documentclass{amsart}[11pt] \usepackage{AMSfonts} \newtheorem{theorem}{Theorem}[section] \newtheorem{lemma}[theorem]{Lemma} \newtheorem{proposition}[theorem]{Proposition} \newtheorem{corollary}[theorem]{Corollary} \DeclareMathSymbol{\Z}{\mathbin}{AMSb}{"5A} \DeclareMathSymbol{\C}{\mathbin}{AMSb}{"43} \DeclareMathSymbol{\N}{\mathbin}{AMSb}{"4E} \DeclareMathSymbol{\Q}{\mathbin}{AMSb}{"51} \DeclareMathSymbol{\R}{\mathbin}{AMSb}{"52} \begin{document} \thispagestyle{empty} \pagestyle{empty} \hfill \textsc{2007 Summer REU} \hfill \textsc{Groups, Graphs, and Geometry} \bigskip \centerline{\large The Fine Art of Writing in \LaTeX, Part II} \bigskip \noindent Unlike non-technical typesetting environments like MS Word, \LaTeX\ is enormously powerful when it comes to writing in ``math,'' enabling us to render nice-lookin' mathematical material, ranging from the fairly elementary: \[ f(x)=x^2 \Rightarrow F(x) = \int x^2 dx = \frac{x^3}{3}+C, \] \noindent to the relatively deep: \[ \displaystyle\lim_{p \rightarrow \infty, p \ {\rm prime}} \kappa_a \Bigl( \Z_p,\bigl\{ [x,x \pm 1 \ {\rm mod} \ p],[x,x^{-1} \ {\rm mod} \ p] \ | \ x=0,1,...,p-1 \bigr\} \Bigr) = 3. \] I'd like to ease you into using \LaTeX, but with so much math out there, where do we start? In this handout I've included a number of the sorts of things you'll need to know how to do to begin writing; for some of you, these pages might nearly suffice. I'm giving you two files, one consisting of the output .pdf document, all nice `n' purty, and the other consisting of the raw \LaTeX\ commands, so you can see the code that made the file look the way it does. By reading them in parallel, you should be able to get a sense as to how \LaTeX\ works much of its mathematical magic. Let's get things rolling with some... \medskip \begin{enumerate}\addtolength{\itemsep}{0.5\baselineskip} \item \textbf{Special letters.} First note that there is a difference between letters in ``text mode'' and the same letters in ``math mode,'' the environment lying between ``\$'' pairs or ``$\backslash [,\backslash ]$'' in your \LaTeX\ code: it's a matter of a,b,c,..., versus $a,b,c,...$. If you're writing a math formula, you're definitely going to want all of your formula to appear in math mode: ``$f(x)=x^2$ is a function'' is correct, whereas ``f(x)$=x^2$ is a function'' is not. (Side note: you might take a look at how quotation marks are rendered! What happens if you just type quotes as you'd ordinarily do it?) Of course, there are Greek letters, too, constructed as you would probably expect them to be: $\alpha, \beta, \gamma$,..., and corresponding capitals: $\Gamma,\Delta,\Theta...$. (Some capital letters are identical to their Roman counterparts, and therefore have no special symbol.) There are also ``calligraphic'' characters: ${\mathcal A,B,C,...}$. Certain flavors of \LaTeX\ even have built-in Gothic fonts, and other crazy stuff you probably won't need right now. In normal text mode, you may want to use \textit{italic} font (useful for \textit{definitions}) and \textbf{boldface} font, so should note how these fonts are obtained. \item \textbf{Special characters.} You've got some pretty standard stuff: \[ \infty, +,-,\pm,\times,\div,=,\neq,\leq,\geq,<,>,\sim,\equiv,\cong, \] \noindent and so forth. If you want to ``negate'' one of the relations listed above, the command $\backslash$\texttt{not} comes in handy: \[ \not\leq, \not\geq, \not<, \not>, \not\sim, \not\equiv, \not\cong. \] There are also more heavy-duty operators: \[ \circ, \cdot, \star, \bullet, \oplus, \ominus, \otimes, \odot, \heartsuit, \diamondsuit, \clubsuit, \spadesuit. \] You've got all kinds of arrows, useful for indicating where functions go, and for illustrating implication and equivalence: \[ \rightarrow, \longrightarrow, \leftarrow, \longrightarrow, \Rightarrow, \Leftarrow, \Leftrightarrow, \uparrow, \downarrow, \nearrow, \searrow, \nwarrow, \swarrow. \] Oh yeah, here are some special sets we all know and love: \[ \N, \Z, \Q, \R, \ {\rm and} \ \C.\] \noindent Please note that in some flavors of \LaTeX\ you have to load these special ``blackboard bold'' characters in, much as I've done in the \textit{preamble} of this document. You've also got your other set theory basics: \[ \cup, \cap, \bigcup, \bigcap, \vee, \wedge, \subset, \subseteq, \supset, \supseteq, \in, \emptyset, \setminus, \] \noindent where this last is set difference: \[ A \setminus B = \{x \in A \ | \ x \not\in B \}. \] There are hundreds of other interesting characters, but this last example leads us naturally to the next topic... \item \textbf{Grouping symbols.} With \LaTeX\ you've got a veritable plethora (is there ever any other kind of plethora?) of grouping characters at your fingertips: \[ \Biggl( \Bigl( \bigl( ( \ ) \bigr) \Bigr) \Biggr), \Biggl[ \Bigl[ \bigl[ [ \ ] \bigr] \Bigr] \Biggr], \Biggl\{ \Bigl\{ \bigl\{ \{ \ \} \bigr\} \Bigr\} \Biggr\}. \] Note that you can control the size of the brackets and parentheses you want, but oftentimes \LaTeX\ is smart enough to do that for you, with commands like ``$\backslash$\texttt{left}('' and ``$\backslash$\texttt{right})'': \[ f(x) = \left(\displaystyle\sum_{i=0}^{\infty} \frac{x^i}{i!} \right)^2. \] Grouping characters (generally called \textit{delimiters}) also appear in constructing matrices: \[ \left[ \begin{array}{ccc} 1 & x & \alpha \\ -1 & \frac{1}{\beta} & 0 \\ \gamma & \alpha^2 & 2 \\ \end{array} \right] \left[ \begin{array}{c} a \\ b \\ c \\ \end{array} \right] = \cdots . \] The ``$\backslash$\texttt{begin\{array\}}'' and ``$\backslash$\texttt{end\{array\}}'' commands are ways of defining an \textit{environment} in \LaTeX; here we see the ``array'' environment at work. There are also ``figure'' environments, and ``equation'' environments. (``Math mode'' is really just an environment, too.) I'll have more to say about environments at the end of this handout. By the way, you could use the array environment to construct a nice-looking table of values without the delimiters, too: \[ \begin{array}{ccc} 1 & x & \alpha \\ -1 & \frac{1}{\beta} & 0 \\ \gamma & \alpha^2 & 2 \\ \end{array}. \] \item \textbf{Subscripts and superscripts.} As you've probably noticed above, superscripts (like those in expressing powers) are implemented using ``\texttt{\^}'': \[ x^2, x^3, x^4, ..., 15^3, 3^{15}, \heartsuit^{\spadesuit}. \] \noindent Notice the reason we need to include curly braces around the ``15'' in the penultimate example above: if we just type in ``\$3\texttt{\^}15\$'', what do we get? If you need to use double superscripts (sometimes it happens, no?), you'll need to group things the way you want them: $2^{3^4}$ is all right, but typing ``\$2\texttt{\^}3\texttt{\^}4\$'' will probably give you an error. The same is true for subscripts; here you use the character ``\texttt{\_}'' instead of ``\texttt{\^}'': \[ x_1, x_2, x_3, ..., f_x, \clubsuit_{\diamondsuit}, y_{x^7}, {y_x}^7. \] \noindent Note the difference between the last two; what do you get if you don't group anything in this last example? \item \textbf{Fractions.} One more mathematical point, and then I'll mention a thing or two about some useful environments. It won't be long before you need to be able to type in quotients of mathematical quantities. One of the most useful \LaTeX\ commands is $\backslash$\texttt{frac}: \[ \frac{1}{2}, \frac{2}{3}, \frac{2}{(4-x)^2}, \frac{2}{\sum_{n=0}^{\infty} \frac{1}{n^2}}. \] \noindent Note in this last example which command lives inside of which. It's easy to get carried away in nesting fractions: \[ \pi = \frac{4}{1+\frac{1}{3+\frac{4}{5+\frac{9}{7+\frac{16}{9+\cdots }}}}}. \] Ouch! That gets hard to read! Fortunately there's the command ``$\backslash$\texttt{cfrac}'', designed especially for use in such \textit{continued fractions}: \[ \pi = \cfrac{4}{1+\cfrac{1}{3+\cfrac{4}{5+\cfrac{9}{7+\cfrac{16}{9+\cdots }}}}}. \] \textit{Much} nicer! \item \textbf{Autonumbering.} All right, let's wrap up with one advanced topic. As you know, math papers and texts are \textit{full} of all kinds of lemmas, theorems, propositions, corollaries, \textit{etc.}, all of which are generally nicely numbered and cross-referenced. Obtaining this orderly state can be a nightmare, potentially: what happens if you've written the bulk of a long, long paper and suddenly your colleague points out that you really need to include a short lemma to prove a minor fact that you use in the proof of your main theorem? Gadzooks! The new lemma's \textit{got} to go smack dab in the \textit{middle} of your paper's text...this means you've got to renumber \textit{everything} that comes after it! Alas! Alack! Here, \LaTeX's automatic numbering feature comes in handy. If you're using a standard \LaTeX\ document class, like ``article'' or ``amsart'' (short for ``AMS article''), you've got predefined environments for all of the above objects. As I've done for this document, though, you might have to do a little tweaking in the preamble should you want the numbering to work out okay. (If you don't want to bother with all of this, you can simply cut `n' paste the preamble I've written for this document and use it for your own.) \begin{lemma} \label{theLemma} All humans are mortal. \end{lemma} \begin{proof} Duh, this is obvious. \end{proof} \begin{proposition} \label{theProposition} Socrates is a human. \end{proposition} Our proof will begin in a moment. \begin{proof}[Proof of Proposition~\ref{theProposition}.] Just kidding: this is obvious, too. \end{proof} \begin{theorem} \label{theTheorem} Socrates is mortal. \end{theorem} \begin{proof} Combine Lemma~\ref{theLemma} and Proposition~\ref{theProposition}. \end{proof} \begin{corollary} \label{theCorollary} Socrates will die at 5:14 p.m. \end{corollary} \begin{proof} This follows immediately from Theorem~\ref{theTheorem}, after applying a result of Karp. \end{proof} Notice that with astute use of the commands ``$\backslash$\texttt{label}'' and ``$\backslash$\texttt{ref}'' we are able to refer to our numbered results by keywords that have inherent meaning for us, rather than the numbers that will later appear in the finished text. Thus, if we've got to update things by including a new lemma, the numbers are automatically updated! The numbering is typically done by ``section'' inside of an article. Since I haven't formally declared any sections yet, \LaTeX\ is assuming we're in Section~0. Let's change that and see what happens: \section{This is a new section} We begin the new section with a big, important theorem: \begin{theorem} \label{bigImportantTheorem} The moon is mostly made of moth-eaten Madras cotton. \end{theorem} And here's an immediate corollary: \begin{corollary} \label{stupidCorollary} It is impossible to eat walk on the moon with ease. \end{corollary} See how easy? You should definitely get in the habit of labelling and cross-referencing your results as you type them up. Good writing style, that's what that is. \end{enumerate} Well, that's about all I'd like to say for now, although I'll soon put together a page or two on writing up bibliographies (another feature \LaTeX\ makes simpler by including means to implement efficient cross-referencing). There's much more to learn about \LaTeX, but you'll pick up much of it as you need it while writing up your results. Do play with it a bit, though, and as practice see if you can \LaTeX\ up a page from one of my class note sets, available online, or some other suitable mathematical material. \medskip \centerline{\large Have fun!} \end{document}