...
Math Mode ($ vs. $$)
Putting text between dollar signs will activate "math mode" where you can format equations and code in TeX.
A single pair of dollar signs (e.g. $y = mx + b$) produces in-line math mode (ie able to use symbol for i.e. insert symbol $\lambda$). This is used to distinguish math from text.
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
By the Lemma from Section 2.3, the difference of any two solutions of the nonhomogeneous equation $L[y]=g(t)$ is a solution of the homogeneous equation $L[y]=0$. |
Displays as:
A pair of dollar signs (e.g. $$y = mx + b$$) will bump it to the next a new line and center it on the assignment page in a more prominent display, centered on the &.
ex:
Example:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
$$ \eqalign {
2x &= 3y \cr
2x^2 &= 3y + 2z \cr
x^3 &= 3x^{@e}
} $$ |
Displays as:
Notice that:
- \
...
Use those curly brackets! { } are your friend!
fractions= ${#\over #}$, and \overline {} will work for larger equations.
subscript: _
superscript: ^
Bold
$\bf{XXX}$
where XXX is what you want bolded
...
- eqalign is used for equation alignment for aligning multi-line displays at a single place
Each line is aligned by centering on the ampersand ("&")
A carriage return is inserted after every "\cr"
- Only the code between "$$ { . . . } $$" is shown
Commonly Used TeX Markup Tools
All of the following, plus more, can be accessed on the TeX Reference Card!
Tool Category | Item | TeX Code |
---|---|---|
Elementary Math Control Sequences | Fraction (overline is for larger equations) | {<numerator>\over <denominator>} \overline{ . . . } |
Square root | \sqrt{<expression>} | |
Integral | \int_{lower bound}^{upper bound} {<expression>} | |
Formatting Alignment and Spacing | Indentation | \indent{ . . . } |
No Indentation | \noindent{ . . . } | |
Alignment | \eqalign{ . . . } | |
Horizontal Spacing (spacing within text) | \; \enspace |
alignment: \eqaline
...
Vertical Spacing of various sizes | \smallskip \medskip \bigskip |
...
indentation:
\indent
for no indentions
\noindent
To display $ is a bit tricky, since it's used to indicate math type.
$\$ monetary unit
note that to call variables (@ans1) math type (ie hugging it in $ $ ) is not needed.
...
Text Formatting | Bold font | \bf{ . . . } |
Superscript | <variable>^{<subscript expression>} | |
Subscript | <variable>_{<subscript expression>} | |
Displaying Dollar Sign | $\$ |
Tips for Using TeX
- Incorrect use of curly braces can cause errors, so make sure that for each opening bracket there is a corresponding closing one (and vice versa)
- To call variables define in the code field, prepend it with '@'
Example: "@ans1" calls variable ans1 - Feel free to Google what you're looking for with TeX as well
...
ex: square root TeX
\sqrt{expression}
...