\documentclass{article} \begin{document} \begin{center}\begin{large} Sample Latex File\\ \end{large} Math Mode, Text Mode, and Using Labels\\ Matchett, \today \end{center} The environments \emph{displaymath} and \emph{equation} are used for displayiong one-line mathematical expressions. In these environments, LaTeX is in math mode. This means that all kinds of symbols that are common in mathematics can be displayed. But you may only display one line of material, and in the latex file there must not be any blank lines between the ``begin'' command and ``end'' command. Here's the famous quadratic formula: \begin{displaymath} x = \frac{-b \pm \sqrt{b^{2} - 4ac}}{2a} \end{displaymath} If you want to display two lines of formulas, use two separate ``begin - end'' blocks. The only difference between \emph{displaymath} and \emph{equation} is that in the latter environment, whatever is displayed is given a number. For example, I might want to display a trigonometric identity and have it be numbered: % Comment to reader: The \label command is explained further down. \begin{equation} \label{baddy} sin(\alpha + \beta) = sin \alpha cos\beta + sin \beta cos \alpha \end{equation} It improves readability if ``sin'' and ``cos'' are typset in ordinary text mode. To that end, there are commands which are just ``sin'' and ``cos'' preceeded by a backslash. \begin{equation} \sin(\alpha + \beta) = \sin\alpha \cos\beta + \sin\beta \cos\alpha \end{equation} A further improvement comes from adding some spaces. \begin{equation} \sin(\alpha + \beta)\; = \; \sin\alpha \, \cos\beta \, + \, \sin\beta \, \cos\alpha \label{goody} \end{equation} The space commands for math mode are as follows: \begin{verbatim} \, thin space \: medium space \; thick space \ very thick space \end{verbatim} That fourth space is a backslash followed by a blank produced from the keyboard by pressing the space bar. To refer back to a numbered expresion, use the \emph{label} and \emph{ref} commands. You do this by sticking a ``label'' command like $\backslash$label$\{$baddy$\}$ inside the desired equation environment. Then for ever after, you may refer to that expression with the ``ref'' command, as $\backslash \mbox{ref}\{\mbox{baddy}\}$. Using this feature of LaTeX, I can say ``Equation \ref{goody} is much nicer than Equation \ref{baddy}.'' without checking what number the equation has. Latex figures out the number of the equation for me. To embed short mathematical expressions in a paragraph, just surround the expression by dollar signs. For example I might say that the equation $x = 12 - 2x$ has solution $ x = 4$. If I write that last equation without dollar signs it gets typset as x = 4, which is bad because the x is in the wrong font. Also you cannot even access many math symbols if you stay in text mode. So enclose math expressions in dollar signs whenever you embed them in a text paragraph. \end{document}