TUTORIAL 8: TYPESETTING MATHEMATICAL EXPRESSIONS CHRISTOPHER RARIDAN Abstract. Upon completion of this tutorial, the author should be able to add some mathematical content to his or her paper. In particular, the author will learn how to incorporate mathematical expressions within a sentence, how to set mathematical expressions apart from the text in either numbered or unnumbered environments, and how to add internal labels and provide references to numbered mathematical expressions. 1. Welcome Hello. My name is Dr. Christopher Raridan (Dr. R). I want to welcome you to the L A TEX Tutorial Series. In this tutorial, we will introduce a few of the more common commands and mathematical constructs. For a complete listing of L A TEX symbols, please refer to the Additional Resources provided on Dr. Raridan s L A TEX Tutorials page: http://www.clayton.edu/faculty/craridan/tutorials By the end of this tutorial, the author should be able to add some mathematical content to his or her paper. Part of Math 3006, Communication in Mathematics, Clayton State University. 1
2 C. RARIDAN The author will learn how to incorporate mathematical expressions within a sentence and how to set mathematical expressions apart from the text in either numbered or unnumbered environments. In addition, the author will learn how to add internal labels and provide references to numbered mathematical expressions. This is the eighth in a series of tutorials meant introduce you to L A TEX. We assume that you have successfully completed Tutorial 7 and we will use the results of this tutorial in subsequent tutorials. Hopefully, Windows and Mac users will have a similar experience. 2. Getting Started (1) Navigate to the LaTeX Tutorials folder on your computer. (2) Inside this folder, create a new folder entitled Typesetting Mathematical Expressions. (3) Open the Article Template II folder. (4) Double-click on the Article-Template-II.tex file. (5) In the TeXworks editor, if the Tags menu is not open, click [Window] > Show > Tags. (6) Change the title of this article to Typesetting Mathematical Expressions with an appropriate short title, say, Typing Math.
TUTORIAL 8: TYPESETTING MATHEMATICAL EXPRESSIONS 3 (7) Now, change all of the author information to your information if you do not have this currently. (8) Delete everything between the % BEGIN ARTICLE BODY and % END ARTICLE BODY comments, making sure to leave one blank line between the two comments. (9) Click [File] > Save As... (10) Navigate to your Typesetting Mathematical Expressions folder. (11) Inside that folder, name your file Typesetting-Mathematical-Expressions.tex. (12) Click [Save] to save your file. 3. In-Line Mathematics We refer to mathematical expression fall within a sentence as in-line mathematics. These expressions are enclosed in dollar signs. (1) Place your cursor at the end of the % BEGIN ARTICLE BODY comment and hit [Enter] twice. (2) Type \section{in-line Mathematics} and hit [Enter]. (3) Type \label{sec:in-line} and hit [Enter] twice. (4) Type In-line mathematical expressions are those that appear within a sentence. In-line mathematical expressions are created using dollar signs. and hit [Enter] twice. (5) [Ctrl]+[T] to typeset. (6) Type \subsection{exponentiation} and hit [Enter].
4 C. RARIDAN (7) Type \label{subsec:exponents} and hit [Enter] twice. (8) Type If $x = 2$, then $2x + 4 = 8$ and $x^5 = 32$. (9) [Ctrl]+[T] to typeset. (10) You should notice that the mathematical expressions have been typeset appropriately. (11) The carat symbol ^ is obtained by typing [Shift]+[6]; the carat symbol and is used for exponentiation in L A TEX. (12) In most cases, punctuation is not included within the dollar signs. (13) To aid in the readability of your L A TEX code, it is usually a good idea to place a space before and after certain mathematical symbols, such as the plus, minus, equals, etc. (14) Continue typing: If $f(x) = e^x$ and $g(x) = 4x - 2$, then the composite function $f(g(x)) = e^{4x - 2}$.. (15) When typing this sentence, it is probably a good idea to place a space before and after each equals sign to improve readability of your L A TEX code. (16) [Ctrl]+[T] to typeset. (17) L A TEX uses braces around 4x - 2 as grouping symbols to indicate that the objects that fall between them are considered a single unit.
TUTORIAL 8: TYPESETTING MATHEMATICAL EXPRESSIONS 5 (18) Please note that if one wishes to place more than a single character in the exponent, then braces must be used as grouping symbols. (19) Braces may be placed around a single character in the exponent if this improves readability for the author. (20) Again, the punctuation used in this sentence is not a part of the mathematical expressions, so it appears outside the dollar signs. (21) Hit [Enter] twice to start a new paragraph. (22) Type \subsection{subscripts} and hit [Enter]. (23) Type \label{subsec:subscripts} and hit [Enter] twice. (24) Type If $n_1$ and $n_2$ are even integers, then $n_1 + n_2$ is even as well.. (25) [Ctrl]+[T] to typeset. (26) Subscripts are created using the underscore character, or [Shift]+[-]. (27) Please note that if one wishes to place more than a single character in the subscript, then braces must be used as grouping symbols. (28) Braces may be placed around a single character in the subscript if this improves readability for the author. (29) Continue typing: Similarly, if $x_1, x_2, \dots, x_n$ are even integers, then so is $x_1 + x_2 + \cdots + x_n$.
6 C. RARIDAN (30) [Ctrl]+[T] to typeset. (31) In this case, notice that the commas that appear as part of the list are enclosed within the dollar signs. (32) This was not necessary, but it frees the author from having to type a lot of extra dollar signs. (33) There are several L A TEX commands for creating various kinds of dots, which indicate continuation. (34) The command \dots creates ellipses and \cdots creates centered dots. (35) What do you think \vdots does? (36) Hit [Enter] twice to start a new paragraph. (37) Type \subsection{fractions} and hit [Enter]. (38) Type \label{subsec:fractions} and hit [Enter] twice. (39) Type The function $r(x) = \frac{1}{x}$ is defined for all $x \not= 0$.. (40) [Ctrl]+[T] to typeset. (41) The command \frac{num}{denom} is used to create fractions, where num is the numerator and denom is the denominator; note that each is enclosed in braces. (42) The command \not can be placed in front of most mathematical symbols to indicate not; in this case, not equal to. (43) Hit [Enter] twice to start a new paragraph.
TUTORIAL 8: TYPESETTING MATHEMATICAL EXPRESSIONS 7 (44) Type \subsection{set-builder Notation} and hit [Enter]. (45) Type \label{subsec:sets} and hit [Enter] twice. (46) Type The equation $x^2 = 4$ has solution set $\{ \pm 2 \}$.. (47) [Ctrl]+[T] to typeset. (48) Because L A TEX has reserved braces for grouping symbols, we must but a backslash in front of the open and closed brace when we want to indicate set-builder notation. (49) The \pm command is an abbreviation for plus or minus. (50) Continue typing: The set of even integers can be expressed as $\{ 2k : k \in \mathbb{z} \}$.. (51) Note specifically the judicious use of spaces before and after certain symbols in the mathematical expression enclosed in dollar signs. (52) [Ctrl]+[T] to typeset. (53) The command \in is used to indicate set inclusion. (54) The command \mathbb{z} creates a blackboard Z, which usually stands for the set of integers. (55) We can create N, C, and others similarly. (56) Hit [Enter] twice to start a new paragraph. (57) Type \subsection{common Functions} and hit [Enter]. (58) Type \label{subsec:functions} and hit [Enter] twice.
8 C. RARIDAN (59) Type Most common mathematical functions, like natural logarithm and sine, are created by placing a backslash in front of the function name; for example, $\ln x$ and $\sin( \frac{2}{3}x - \frac{\pi}{4} )$. (60) Be careful to match the open and the closed parentheses or L A TEX will give an error! (61) [Ctrl]+[T] to typeset. (62) Notice that the function names are not typeset in italics, but instead look just like we would write them on paper. (63) The command \pi typesets the pi symbol. (64) The parentheses around the argument of sine are not the same height as the fractions 2 and π but we can fix this. 3 4 (65) Hit [Enter] twice to start a new paragraph. (66) Type \subsection{ Big Grouping Symbols} and hit [Enter]. (67) Type \label{subsec:big-symbols} and hit [Enter] twice. (68) Type We can make grouping symbols such as parentheses larger using the backslash left-right operators; for example, $\sin \left( \frac{2}{3}x - \frac{\pi}{4} \right)$.. (69) The mathematical expression between dollar signs has many spaces so that the L A TEX code is easier to read. (70) However, you cannot put a space between the \left and the ( or the \right and the ); think of each of these as one object.
TUTORIAL 8: TYPESETTING MATHEMATICAL EXPRESSIONS 9 (71) [Ctrl]+[T] to typeset. (72) Notice that the parentheses are now the same size as the fractions. (73) Suppose that you would also like the fractions 2 and π to 3 4 be larger. (74) You can accomplish this using the \displaystyle command within an in-line mathematical expression. (75) Between the first dollar sign and \sin, type \displaystyle and hit space. (76) [Ctrl]+[T] to typeset. (77) Which formatting do you prefer? 4. Displayed Mathematics Displayed mathematics refers to mathematical expressions that are set apart from the text, always centered on the page and often numbered. This method of typesetting mathematical expressions is used primarily when the expression is quite long, rather complicated, or important for some reason. (1) At the end of $\sin \left( \frac{2}{3}x - \frac{\pi}{4} \right)$., hit [Enter] twice. (2) Type \section{displayed Mathematics} and hit [Enter]. (3) Type \label{sec:displayed} and hit [Enter] twice.
10 C. RARIDAN (4) Type Displayed mathematical expressions are set apart from the text and centered on the page. They may be numbered or unnumbered. and hit [Enter] twice. (5) [Ctrl]+[T] to typeset. 4.1. The Numbered Environment. (1) Type \subsection{the Numbered Environment} and hit [Enter]. (2) Type \label{subsec:numbered} and hit [Enter] twice. (3) Type The Fundamental Theorem of Calculus says that if a function $f$ is continuous on a closed interval $[a,b]$ and $F$ is any antiderivative of $f$, then and hit [Enter] to go to a new line. (4) Type \begin{align} and hit [Enter] twice. (5) Type \end{align}. (6) Return your cursor to the blank line between the two commands and hit [Tab]. (7) The general rule-of-thumb is to type \begin{} and \end{} constructs in pairs, and tab over for readability. (8) Type \int_{a}^{b} f(x) dx = F(b) - F(a).. (9) Because the align environment is specifically for mathematical expressions, there is no need for the dollar signs or the \displaystyle command here. (10) [Ctrl]+[T] to typeset.
TUTORIAL 8: TYPESETTING MATHEMATICAL EXPRESSIONS 11 (11) You should see a familiar mathematical expression set apart from the text, displayed centered on the page, and numbered. (12) The command \int creates the integral sign, the underscore puts the a at the bottom of the integral sign, and the carat symbol puts the b at the top. (13) Even though there was only a single character used as the bounds on the integral, open and closed braces were included to help improve readability of the L A TEX code. (14) Notice that the f(x) and the dx are a little too close together it would look better if there was just a little space between these two symbols. (15) Place your cursor directly after f(x) and type \,, a backslash followed by a comma. (16) [Ctrl]+[T] to typeset. (17) The command \, puts a small amount of extra space between the f(x) and the dx. (18) Typically, we allow L A TEX to figure out spacing in mathematical symbols, but this is one instance where a little extra space improves readability in the PDF output. (19) As we learned in Tutorial 7, if we wish to refer to this equation by number, we need to add a label. (20) Place your cursor after \int_{a}^{b} f(x) dx = F(b) - F(a). and hit [Enter].
12 C. RARIDAN (21) Type \label{eq:ftcii}. (22) The eq reminds us that this label refers to an equation and FTCII reminds us that the equation is the Fundamental Theorem of Calculus, part II. (23) Place your cursor after \end{align} and hit [Enter] to go to a new line (24) Type We use~\eqref{eq:ftcii} to evaluate definite integrals.. (25) Note the tilde to tether. (26) [Ctrl]+[T] to typeset. (27) The \eqref{} command is used only when referencing equations and the equation number appears in parentheses automatically. 4.2. Unnumbered Environments. (1) Now, let s examine how to create a displayed mathematical expression that is not numbered. (2) We have two options: the align* environment and the backslashbrackets method. (3) Place your cursor at the end of We use~\eqref{eq:ftcii} to evaluate definite integrals. and hit [Enter] twice. (4) Type \subsection{unnumbered Environments} and hit [Enter]. (5) Type \label{subsec:unnumbered} and hit [Enter] twice.
TUTORIAL 8: TYPESETTING MATHEMATICAL EXPRESSIONS 13 (6) Type First, we show the \texttt{align*} environment. and hit [Enter] twice to start a new paragraph. (7) Type When we have several similar objects to add together, we can use \textbf{summation notation} to abbreviate: and hit [Enter] once to start a new line. (8) Type \begin{align*} and hit [Enter] twice. (9) Type \end{align*}. (10) Don t forget the asterisk in both places! (11) This tells L A TEX to suppress the automatic numbering of equations in an align environment. (12) Place your cursor on the blank line between these two commands and hit [Tab]. (13) Type \sum_{i=1}^{n} a_i = a_1 + a_2 + \cdots + a_n. (14) [Ctrl]+[T] to typeset. (15) Place your cursor at the end of the \end{align*} command and hit [Enter] twice. (16) Type Now, let s examine the backslash-brackets method. and hit [Enter] twice to start a new paragraph. (17) Type We can abbreviate the phrase As $x$ approaches $a$, $f(x)$ approaches $f(a)$ as and hit [Enter] once. (18) Type \[, a space, and \]. (19) Place your cursor after the open bracket and hit the [Spacebar].
14 C. RARIDAN (20) Type \lim_{x \rightarrow a} f(x) = f(a).. (21) [Ctrl]+[T] to typeset. (22) Notice that x \rightarrow a is enclosed in braces; it is a single expression that we want to be in the subscript. (23) The align* environment might be considered better than the backslash-brackets method because if you were to decide later that the displayed expression needs a number for referencing, then you can update the L A TEX code easily by simply removing the asterisk and providing a label. 5. Updating the Abstract (1) Locate \begin{abstract} and \end{abstract}. (2) Delete the placeholder abstract and write your own abstract for this article. (3) This abstract should reflect the main ideas of what you learned in this tutorial. (4) Try to summarize what you accomplished in this article in less than five sentences (about 100 words). (5) The pronoun we is considered acceptable for mathematical writing but one should avoid the use of the pronoun I. (6) Try to write the abstract in a way that uses no pronouns! Department of Mathematics, Clayton State University, Morrow, Georgia 30260 E-mail address: ChristopherRaridan@clayton.edu