A (fake) introduction to $\LaTeX$

Background

Though Word processors, e.g. MS office and Libreoffice, are quite convenient for documentation, $\LaTeX$ is a more professional tool that produces beautiful technical documents. The drawbacks are that the learning curve of $\LaTeX$ is quite steep, and multiple language support is really frustrating.

However... We are not writing full assembled $\LaTeX$ documents here. Thanks to the wonderful plugin from MathJax, we are able to make advantage of equation system in $\LaTeX$ to enrich our notes and reports.

Learning the original $\LaTeX$ documentation system is highly recommended. Here are some useful Getting-started documents:

$\LaTeX$ (MathJax's implementation) Equation System

In $\LaTeX$, there are two types of equation, inline and displayed equation. The default math delimiters are

% displayed (this is commented information)
$$...$$ 
\[...\]

% inline 
\(...\)
$...$

Also, there is a more complicated equation code block in $\LaTeX$. We will not discuss it since MathJax doesn't include this method.

Please check out this useful link from wikibook. If you can follow the guidance there, feel free to stop reading the content below.

Basic Components in Equations

operators

You can use basic operators (in ASCII encoding) like in any other text editors.

% ascii encoding operators
+ - * / ! = > < ( ) [ ] 

% some symbols need escape from the processor
\% \{ \} % ... \{ and \} are not working with mathjax

% hand writing operators
\cdot \times \div 
\pm \geq \leq

% function like operators
\cos(\theta) \sin(\theta) \tan(\theta) \exp(x)
\sqrt[n]{x^2 + x}
\sum_{i=1}^{10}
\int_0^\infty

They will be processed to

$$ + - * / ! = > < ( ) [ ] $$

$$ \% { } $$

$$ \cdot \times \div $$ $$ \pm \geq \leq $$

$$ \cos(\theta) \sin(\theta) \tan(\theta) \exp(x) $$ $$ \sqrt[n]{x^2 + x} \sum{i=1}^{10} \int0^\infty $$

sub/super-scripts and fractions

Subscripts and superscripts can be insert into your equations almost anywhere. Just use _ and ^ to lead a equation block (enclosed by {} if multiple elements exist). Here are some examples:

% for power and indice
k_{n+1} = n^2 + k_n^2 - k_n-1

% for isotopes
^{238}_{92} \text{U} ^{232} \text{Th}

$$ k{n+1} = n^2 + kn^2 - k_n-1 $$

$$ ^{238}_{92} \text{U} \;\;\;\; ^{232} \text{Th}$$

Writing fractional numbers / expressions in $\LaTeX$ is not so straightforward but will render beautiful results. Use \frac to start a fraction, followed by your nominator and denominator enclosed with curly braces separately. For example:

% syntax
\frac{numerator}{denominator}

% examples
\frac{n!}{k!(n-k)!}
\frac{\frac{1}{x}+\frac{1}{y}}{y-z}
\sqrt{\frac{a}{b}}

$$ \frac{n!}{k!(n-k)!} $$ $$ \frac{\frac{1}{x}+\frac{1}{y}}{y-z} $$ $$ \sqrt{\frac{a}{b}} $$

Greek letters

Write a \ before their English names to render Greek letters.

\alpha \beta \gamma \phi \lambda \epsilon \varepsilon \pi

% Capitalize first letter
\Gamma \Delta \Phi \Lambda \Theta 

$$\alpha \beta \gamma \phi \lambda \epsilon \varepsilon \pi $$ $$\Gamma \Delta \Phi \Lambda \Theta $$