| Use Latex Math Mode | Prof. Bartenstein |
Often, it is difficult to create easy to read mathematical formulas using strictly typewritten text, especially when that text is formatted by a document creation tools such as Microsoft Word, or when composing text to be displayed in a web browser. Most textbooks and technical papers are written using a very powerful markup driven formatting tool called Latex. The Latex Math Mode is a subset of latex devoted to making it easier to define and format mathematical formulas. If you learn a little about Latex Math Mode, it will make it much easier to create professional mathematical formula displays. Many tools, such as Brightspace and Gradescope, provide the capability of entering formulas using a Latex Math Mode syntax, and displaying the result.
Latex Math Mode is a markup language, like HTML. You type both text and markup information that is then translated and displayed without the markup, but with a better formated result.
Different tools use Latex Math Mode in different ways. The following list shows some of the more important tools, and how those tools use Latex Math Mode
| Tool | User Text | Formatted Result | Comments |
|---|---|---|---|
| Latex | The result of $x \times 2^{10}$ is big. | The result of x × 210 is big. | Math mode text is contained in pairs of single dollar signs ($) |
| Gradescope | The result of $$x \times 2^{10}$$ is big. | The result of x × 210 is big. | Math mode text is contained in pairs of double dollar signs ($$) |
| Brightspace | x \times 2^{10} | x × 210 | In a formatted text box, click on the "+v" icon, select "Equation", and then "LaTeX Equation" to get a pop-up to fill in the equation markup as described below. |
You can use Latex Math Mode Markup to do many things.
Not all text in a Latex Math Mode string is markup. You can also enter raw text. In math mode, this raw text is formatted as follows:
Warning: Some characters are reserved to indicate markup. The list of these characters is in Markup Syntax below.
Markup in Latex Math Mode uses Latex markup conventions. Most text is unmarked text. However, there are some special characters that signal to Latex that markup follows. Clearly, these characters cannot be used as raw text. These special characters are as follows:
The following table shows the most common mathematical operators, and how to format those operators in Latex Math Mode.
| Op | Markup | Comments |
|---|---|---|
| +, -, / | +, -, / | Operators that appear on the keyboard need no special markup. |
| ×, ·, ÷ | \times, \cdot, \div | Multiplication and division operators not on the keyboard. |
x+1 y+2 | \frac{x+1}{y+2} | A fraction in which the numerator is the first group of text enclosed in curly braces after \frac, and the denominator is the second group. Groups may contain any valid math mode text, including more markup. Fractions are formatted with a horizontal line with the numerator on top and the denominator on the bottom. |
| ∑, ∏, lim, ∫ | \sum, \prod, \lim, \int | Operators that traditionally have limits. Limits can be added using subscript and/or superscript notation (see the subscript/superscript section below). For example \sum_{n=0}^\infty for the sum from n=0 to infinity. |
| ≠, ≤, ≥ | \ne, \leq, \geq | Relational operators not on the keyboard. |
| ∩, ∪, ⊂, ⊃ | \cap, \cup, \subset, \supset | Set operators for intersection, union, superset, and subset. |
| sin, cos, tan, ... | \sin, \cos, \tan, ... | Trig functions. The backslash causes the function names to appear in a non-italic font instead of the italic font used for variables. |
The following table shows greek letters, and how to format those letters in Latex Math Mode.
| Letter | Markup | Comments |
|---|---|---|
| α,β,γ... | \alpha,\beta,\gamma, ... | Lowercase greek letters. |
| Α,Β,Γ... | \Alpha, \Beta, \Gamma, ... | Uppercase greek letters. |
Mathematical formulas often use subscripts or superscripts to do things like differentiate variables, or use superscripts as a "to the power" operator.
In Latex Math mode, an underscore (_) indicates that the following character or group of characters enclosed in curly braces should be formatted using a subscript. For example, the text X_{min} would get formatted as: Xmin.
Similarly, a circumflex (^) indicates that the following character or group of characters enclosed in curly braces should be formatted using a superscript. For example, the text 2^{32} would get formatted as: 232
Both superscript and subscript can be used at the same time, such as X_y^3 would get formated as: Xy3
In math mode, white space is ignored. This can be frustrating if you want to add blanks. The question is, how wide do you want the blank space to be? Math mode markup provides detailed control over the width of a blank. The following table summarizes the white space markup.
| Markup | Description |
|---|---|
| \ | (that's a backslash followed by a space.) Inserts the equivalent of a space in normal text. |
| \quad | Inserts space equal to the current font size width (often wider than a normal text space). |
| \; | Inserts 5/18 of a \quad |
| \: | Inserts 4/18 of a \quad |
| \, | Inserts 3/18 of a \quad |
| \! | Removes 3/18 of a \quad - actually moves the following text to the left |
| \qquad | Inserts twice the space of a \quad |
This web page covers the basics, but there's a lot more about Latex Math Mode out there. For more detail, here are some recommended web sites to look up: