# CeC LaTeX cheat sheet
# **Basics of Math-mode**
There are several ways to use the math-mode or math environment in LaTeX, the main ones are:
### **Inline:**
```
\(...\)
```
For example:
`\(F= m \cdot a\)`
Results in: $F= m \cdot a$
### **Block (Line-break):**
```
$$...$$
```
For example:
`$$F = m \cdot a$$`
Results in: $$F=m \cdot a$$
# **Subscripts and Superscripts in Math-mode**
### **Subscript/Subindex**
Its a character (or word) that is set slightly below the normal line of type.
For example: $F_{1}$, where the 1 in the notation is a subscript or subindex.
This is achieved with the tag:
```
_{}
```
For the upper example:
```
$F_{1}$
```
**Note:**
-Everything that is between the { } behaves as a subscript/subindex.
-Everything that is preceded by the symbol _ will act as the container for the subscript/subindex.
### **Superscript/Exponent**
Its a character (or word) that is set above the normal line of type.
For example: $(n+1)^{2-1}$, where the 2-1 in the equation is a superscript or exponent.
This is achieved with the tag:
```
^{}
```
For the upper example:
```
$(n+1)^{2-1}$
```
**Note:**
-Everything that is between the { } behaves like a superscript/exponent.
-Everything that is preceded by the symbol ^ will act as the container of the superscript/exponent. In most cases, you have one number elevated to another (i. e. $2^{2}$) but there can be several cases where you have a part of the equation that is suposed to be elevated to something, in these cases, the use of the ( ) is vital.
# **Text-mode in Math-mode**
For using text-mode (a plain font) in math-mode there are two existing tags as options:
### **Tag for words or phrases**
There are cases when a formula or equation is given but instead of using the notation, it uses the actual names of the magnitudes in it, for these cases, we use the tag:
```
\text{ ... }
```
For example:
```
$$\text{ Force } = \text{ Mass } \cdot \text{ Acceleration }$$
```
Results in:
$$\text{ Force } = \text{ Mass } \cdot \text{ Acceleration }$$
**Note:**
-The tag is created for words or phrases, it can be as extensive as it needs to be but if what follows is math-related, the tag needs to be closed.
-There are spaces between the left key ( { ) and right key ( } ) and the actual word or phrase inside it, this is to make sure that everything that is inside of the keys has one space separating it from what is outside of the keys.
### **Tag for units of measurement or subindex/subscripts**
For cases in which we have units of measurement or subscripts/subindex of letters/words we use the tag:
```
\mathrm{...}
```
For example, in the case of a subindex:
```
$$V_{\mathrm{ab}}$$
```
Results in: $V_{\mathrm{ab}}$
For example, in the case of units of measurement:
```
\(700 \mathrm{~Nm}\)
```
Results in: $700 \mathrm{~Nm}$
**Note:**
-The symbol ~is used within the tag before the unit of measurement, this is to give one space of separation between the number/magnitude and the unit, as shown in the upper example.
# **Symbols**
### **Operational Symbols**
**\+** In LaTeX is `+`
**\-** In LaTeX is `-`
**=** In LaTeX is `=`
**$\div$** In laTeX is `\div`
**$\cdot$** In LaTeX is `\cdot`
**$\approx$** In LaTeX is `\approx`
**$\frac{x}{y}$** In LaTeX is`\frac{x}{y}`
**$\sqrt[n]{x}$** and **$\sqrt{x}$** In LaTeX is `\sqrt[n]{x}` and `\sqrt{x}`
**<** and **>** In LaTeX is `<`and`>`
**$\leq$** In LaTeX is `\leq`
**$\geq$** In LaTeX is `\geq`
**$\pm$** In LaTeX is `\pm`
**$\%$** In LaTeX is `\%`
### **Other Math Symbols**
**$n^{\circ}$** In LaTeX is `n^{\circ}`
**$n^{\prime}$** In LaTeX is `n^{\prime}`
**$\dot{n}$** In LaTeX is `\dot{n}`
**$\ddot{n}$** In LaTeX is `\ddot{n}`
**$\pi$** In LaTeX is `\pi`
### **Greek Letters**
**$\alpha$** In LaTeX is `\alpha`
$\beta$ In LaTeX is `\beta`
$\gamma$ In LaTeX is `\gamma`
$\delta$ In LaTeX is `\delta`
$\epsilon$ In LaTeX is `\epsilon`
$\eta$ In LaTeX is `\eta`
$\theta$ In LaTeX is `\theta`
$\lambda$ In LaTeX is `\lambda`
$\mu$ In LaTeX is `\mu`
$\rho$ In LaTeX is `\rho`
$\sigma$ In LaTeX is `\sigma`
$\tau$ In LaTeX is `\tau`
$\phi$ In LaTeX is `\phi`
$\omega$ In LaTeX is `\omega`
### **Arrows**
**$\rightarrow$** In LaTeX is `\rightarrow` or `\to`
**$\longrightarrow$** In LaTeX is `\longrightarrow`
**$\Longrightarrow$** In LaTeX is `\Longrightarrow`
**$\leftarrow$** In LaTeX is `\leftarrow` or `\gets`
**$\longleftarrow$** In LaTeX is `\lonleftarrow`
**$\Longleftarrow$** In LaTeX is `\Longleftarrow`
# **Spacing**
When it comes to spacing in LaTeX, there is a scale of different sizes of horizontal separation between characters.
From the standard separation to the biggest, the scale goes:
### **Standard separation:**
This separation does not make use of any symbol and it is the default space given in math-mode.
For example:
`f(x)= x^{2}+3x+2` which results in: $f(x)= x^{2}+3x+2$
**Note:**
-Notice that even though there are no spaces added between the characters of the code itself, LaTeX still renderizes it with a space between, this is the default spacing in math-mode. No matter how yo space the equation/formula in the code, LaTeX will still automatically renderize it accordingly.
### **Small separation:**
The use of the following symbol adds a little extra space to the standard separation.
```
\,
```
For example:
`f(x)= x^{2}\, +3x\, +2` results in $f(x)= x^{2}\, +3x\, +2$
### **Medium separation:**
The use of the following symbol adds the total of one space to the standard separation.
```
\
```
For example:
`f(x)= x^{2}\ +3x\ +2` results in $f(x)= x^{2}\ +3x\ +2$
### **Big separation**
The use of the following tag adds 1 em (approximately 12 pt) of space to the standard separation.
```
\quad
```
For example:
`f(x)= x^{2}\quad +3x\quad +2` results in $f(x)= x^{2}\quad +3x\quad +2$
### **Bigger separation**
The use of the following tag adds 2 em (approximately 24 pt) to the standard separation.
```
\qquad
```
For example:
`f(x)= x^{2}\qquad +3x\qquad +2` results in $f(x)= x^{2}\qquad +3x\qquad +2$
### **Separation for units of measurement**
For cases where there is a magnitude followed by its unit, there has to be one space in between.
While it is possible to use the `\` symbol, one more practical way to add one space of separation is by using the symbol:
```
~
```
For example:
`400 \mathrm{~m}` results in $400 \mathrm{~m}$
**Note:**
-The symbol must be used within the keys of the `\mathrm` tag and before the actual unit is typed out.
# **Common Mistakes and Things to Look Out For**
### **Text within math-mode**
All text that is not common notation within math-mode must be in plain font by using the `\text{...}` or `\mathrm{...}` tags.
For example, having a word or letter in math-mode without any tags like:
`The` which results in $The$
or
`V_{ab}` which results in $V_{ab}$
In these examples, the words and letters are not in a plain font, so they will be interpreted by LaTeX as *T times h times e* and *a times b* respectively, so LaTeX will space the characters accordingly, which ends up looking odd and not to the convention standards.
These examples up to the convention standards should be:
`\text{ The }` which results in $\text{ The }$
and
`V_{\mathrm{ab}}` which results in $V_{\mathrm{ab}}$
When using a tool like Mathpix, it is very important to examine the formula/equation to make sure that if there is any text, it is within one of the previously mentioned tags.
Extra attention must be paid in cases where there is a subindex/subscript that are letters or words, given that Mathpix doesn’t always automatically add the appropriate tag to make it a plain font.
### **Space between a magnitude/number and its unit**
When a magnitude is presented in a equation/formula usually it is followed by its unit of measurement, it is very important to make use of the spacing tools available to separate the two, and make it more comprehensible for the student.
When using Mathpix, it is important to ensure that any unit of measurement contains the symbol ~ in the `\mathrm{}` tag or in other cases, at least one space of separation using the `\` symbol.
For example:
```
40 \mathrm{J} - 40 \ \mathrm{J} - 40 \mathrm{~J}
```
Results in:
$$40 \mathrm{J} - 40 \ \mathrm{J} - 40 \mathrm{~J}$$
### **Spacing of big numbers**
With magnitudes that exceed the 4 units mark, the convention is to use one space (`\`) to separate them.
Mathpix does not do this automatically, so it is important when encountered with operations that make use of big magnitudes to apply the necessary spacing.
For example:
```
10 000 - 10 \ 000
190000 - 190 \ 000
```
Results in:
$$10000 - 10 \ 000$$
$$190000 - 190 \ 000$$
### **The conventions or norms for formulas in Germany**
There are several conventions that need to be followed when writting a formula/equation, this link will provide a basic guide for the conventions used in Germany:
* https://de.wikipedia.org/wiki/Formelsatz#Geradestehende,_geneigte_und_kursive_Schrift
# **Resources**
### **Basics of LaTeX guides**
The following guides contain everything you need to know about LaTeX in its entirety:
* https://users.dickinson.edu/~richesod/latex/latexcheatsheet.pdf
* http://tug.ctan.org/info/latex-refsheet/LaTeX_RefSheet.pdf
* https://wch.github.io/latexsheet/
* https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference
### **Extensive math-mode symbols guides**
These guides contain most of the math symbols available in LaTeX:
* https://kapeli.com/cheat_sheets/LaTeX_Math_Symbols.docset/Contents/Resources/Documents/index
* https://oeis.org/wiki/List_of_LaTeX_mathematical_symbols
### **Online editors to try LaTeX**
#### **No registration required**
* https://www.latex4technics.com/
* https://latex.codecogs.com/eqneditor/editor.php
#### **Registration required**
* **Overleaf:** A very user friendly LaTeX editor tool for beginners, it also containes several guides for getting the LaTeX basics. (https://overleaf.com and the documentation overleaf.com/learn)
* **Papeeria:** A light and extensive LaTeX editor tool, for people more familiar with programming interfaces. (https://papeeria.com)