Contents
- Introduction
- Overview of features
- Displaying multiline equations
- Fractions
- Matrices
- Calculus
Introduction
This document gives an overview of the LaTeX code that works within ICC. The LaTeX shorthand that declares inline expressions and equations is
\(...\)
Example:
This equation \(x^2-3x+4=0\) is inline.
The LaTeX shorthand that declares displayed equations (i.e. equations that are on separate lines outside of normal text) is
\[...\]
Example:
The equation \[x^2-3x+4=0\] has a break and is centered.
The equation
has a break and is centered.
Overview of features
- The following environments are supported by the zyBooks content creator:
- align - vertically aligns several equations
- cases - renders multiline equations with an extensible left curly brace, which can be used to display piece-wise defined functions.
- gather - displays consecutive equations with no alignment
- The following environments are NOT supported by the zyBooks content creator:
- multline
- flalign
- center
- tabular
- Special characters such as >, <, and & should be entered as \gt, \lt, and \& respectively.
- The TeX shorthand $...$ that declares inline code does not work.
- Automatic equation numbering is suppressed by default and cannot be enabled.
Displaying multiline equations
Multiline equations are displayed using the align, gather, and cases environments.
Align
The align environment has a tabular structure with the symbol & used as a column separator. The default alignment is right, left, right, .... Using && overrides the default alignment. Lines are separated using \\.
Example:
\[\begin{align} x^2 -3x+4 &=0 \\ (x-1)(x-3)&=0 \\ x=1, x&=3 \end{align}\]
Example:
\[\begin{align}2(x+1) &= 8 &\text{}\\2x+2 &= 8 &&\text{Distribute 2 on the
left} \\2x&=6 && \text{Subtract 2 from both sides} \\ x&=3 && \text{Divide
both sides by 2}\end{align}\]
Example:
\[ \begin{align} \text{(1)} && \sin^2 \alpha + \cos^2 \alpha &= 1\\
\text{(2)} && 1 + \cot^2 \alpha &= \csc \alpha\\ \text{(3)} && \tan^2
\alpha + 1 &= \sec \alpha\\ \end{align} \]
Gather
The gather environment displays and centers each equation.
Example:
\[\begin{gather} y=mx+b \\ y-y_1=m(x-x_1) \\ Ax+By=C \end{gather}\]
Cases
The cases environment renders multiline equations with an extensible left curly brace. Columns are separated by the symbol & and lines are separated by \\.
Example:
\[f(x) = \begin{cases} x & \text{if } x \geq 0 \\ x &\text{if }x \lt 0\end{cases}\]
Fractions
The default style of mathematical operators and elements change depending on whether inline or displayed equation is used. Using the \displaystyle command before each element renders that element with the same style as a displayed equation.
Example
\(\frac{3x^2}{\sin^2 x - 1}\)
Example:
\[\frac{3x^2}{\sin^2 x - 1}\]
Example:
\(\dfrac{3x^2}{\sin^2 x - 1}\)
Example:
\(\displaystyle\frac{3x^2}{\sin^2 x - 1}\)
If a smaller fraction is needed, \tfrac can be used.
Example:
\[\tfrac{x+2}{x-5}\]
This fraction
is centered but still in the smaller type set.
Matrices
The matrix environment renders an array. Columns are separated by the symbol & and lines are separated by \\.
Example:
\[\begin{matrix} -2i &6 \\ 0 & 2x-3 \end{matrix}\]
Other matrix environments are given in the table below.
Environment | Description | Example |
---|---|---|
matrix | plain | |
bmatrix | brackets | |
vmatrix | pipes | |
pmartix | parenthesis | |
Bmatrix | curly braces | |
Vmatrix | double pipes |
Calculus
Common symbols in calculus like integrals, limits, and sums are displayed using the code below.
Example:
\[\sum_{n=1}^{\infty} 2n \\ \lim_{x \rightarrow 0} x^2\\ \int_{2}^{5} (x^2 + 2x + 1)dx\]
Example
\(\sum_{n=1}^{\infty} 2n \\ \lim_{x \rightarrow 0} x^2\\ \int_{2}^{5} (x^2 + 2x + 1)dx\)
Using the \limits command before each operator renders that operator with the same style as a displayed equation.
Example
\(\sum\limits_{n=1}^{\infty}2n\\ \lim\limits_{x \rightarrow 0} x^2\\ \int\limits_{2}^{5} (x^2 + 2x + 1)dx \)
The \displaystyle command can also be used.
Example:
\(\displaystyle\sum_{n=1}^{\infty} 2n\\ \displaystyle \lim_{x \rightarrow 0} x^2\\ \displaystyle \int_{2}^{5} (x^2 + 2x + 1)dx\)
Other common symbols used in calculus are given in the table below.
LaTeX code | Output |
---|---|
\iint | |
\iint\limits_R | |
\iiiint | |
\int\dots\int | |
\oint |