% Slight modification of a document written by Colin Starr \documentclass[12pt,letterpaper]{article} \textheight 9in \begin{document} \begin{center} {\bf \large Introduction to \LaTeX} \end{center} \section*{Introduction} \LaTeX ~is a powerful typesetting system for creating mathematical documents. (\TeX ~is the original; \LaTeX ~is actually \TeX ~along with a giant set of macros to make things easier.) This is a brief introduction to \LaTeX ~to get you started; there are also many resources available on the web. The easiest way to learn \LaTeX ~is to modify existing \LaTeX ~files. You will add capabilities to your repertoire as you need them. For example, although \LaTeX ~can make very nice matrices, you probably won't need to figure out how in this class. Instead, focus on the things you do need to know. \section*{Steps to \LaTeX ing a Document} There are three main steps to creating a \LaTeX ~document: you first write code in the \LaTeX ~language, then you compile it, and then you can view it. The work is in the first step: this is where you actually write the document, including whatever special commands you need for the mathematical part of your document. This is done in a text editor such as WinEdt. While you can use any text editor, you are well advised to use one made to work with \LaTeX. The reason is that these have buttons you can click to perform the second step (compiling your document) and the third step (viewing it). (Otherwise, you will have to find a command line and learn the appropriate commands.) The \LaTeX ~file should have the extension .tex or .ltx. When you click the button (or enter the command) to pdf\LaTeX ~(i.e., compile) your document, a window will appear giving the progress of the compilation. This will report any errors in your \LaTeX ~code. Some of these errors you can ignore, some you will have to find and fix, which isn't always easy! When the window closes successfully, a pdf file of your document will have been created in the same file as your .tex or .ltx file. \section*{The Structure of a Document} Every \LaTeX ~document begins with a ``preamble'' in which you tell \LaTeX ~what parameters you want to apply to the whole document. This is not something you will need to mess with for the most part if you just use someone else's \LaTeX ~file. When you need to format documents differently than the default, you can learn how to modify the preamble. (Or you can just play with it!) The body of the document begins with a ``$\backslash$begin\{document\}'' command and ends with a ``$\backslash$end\{document\}'' command. In between lies your work. Note the backslash ($\backslash$) in front of the word ``end.'' \LaTeX ~commands are distinguished from ordinary text by the presence of a backslash in front of the command. For example, ``alpha'' appears as ``alpha'' in the final document, while ``$\backslash$alpha'' will appear as $\alpha$ (subject to being in math mode; see below). \section*{Math Mode versus Text Mode} To enter mathematical text, you must enter math mode. This is done with a dollar sign (\$) for in-line mathematics like $\alpha, \beta, \gamma,$ and with two dollar signs \$\$ for centered, offset mathematics like $$\left[\begin{array}{cc}1&2\\3&4\end{array}\right].$$ To get back to text mode, you must end math mode with the same symbol with which you began. For example, here is what I entered to get the matrix above: \begin{verbatim}$$\left[\begin{array}{cc}1&2\\3&4\end{array}\right].$$ \end{verbatim} For the Greek letters, I entered \begin{verbatim}$\alpha, \beta, \gamma,$ \end{verbatim} One of the most common errors you will encounter when you start compiling documents is forgetting to begin or end math mode. The error message you will see is ``missing \$ inserted,'' and it will give a line number and the portion of the line in which \LaTeX ~thinks the error occurred. (Sometimes the problem is actually on the previous line or two; you may need to hunt.) You can also switch between text and math mode using the commands ``$\backslash$begin\{equation\}'' and ``$\backslash$begin\{eqnarray\}''. To get back to text mode, you must end the math mode with ``$\backslash$end\{equation\}'' or ``$\backslash$end\{eqnarray\}''. ``$\backslash$begin\{eqnarray\}'' is primarily used to generate a list of equations aligned at the $=$ sign. \section*{Go Forth and \LaTeX!} This is just the most basic of outlines about \LaTeX. There are many, many online resources with documentation, FAQs, etc. If you want a helpful manual, there are several available in Math 306. I am providing you with a few examples of \LaTeX ~documents to work from. I will continue to post the \LaTeX ~code for the posted homework and exam solutions. \LaTeX ~is extremely versatile; you can readily create your own commands to do what you need. The best advice I ever received about \LaTeX ~was, ``if you aren't satisfied with how it looks, keep trying -- there is a way to get what you want.'' Finally, let me remind you of what I said at the beginning: the best way to learn \LaTeX ~is to modify what someone else has created. Just pull up a file when you are ready to do something specific, and try to do it. Good luck! \end{document}