\LaTeX is a typesetting system commonly used for scientific and technical documentation, particularly for writing mathematical equations, formulae and scientific papers. There's a large community of \LaTeX users who share knowledge, templates and solutions to common problems. This support network can be invaluable to beginners and experienced users alike. Due to its syntax and structure, \LaTeX has a steeper learning curve than some other document creation tools, but there are good reasons why you should learn it.
-
Quality typesetting - \LaTeX produces high-quality, professional-looking documents. It's particularly renowned for its excellent handling of mathematical equations and symbols, ensuring that they are correctly formatted and readable.
-
Equation formatting - Writing complex mathematical expressions and equations in \LaTeX is easy because of its specialised syntax. This system provides a wide range of symbols and formatting options that allow precise representation of mathematical concepts.
-
Consistency - \LaTeX maintains consistency throughout the document, ensuring uniform formatting, style and structure, which is essential for technical papers with numerous equations and references.
-
Compatibility and portability - \LaTeX documents are plain text files, making them highly portable and compatible across platforms and devices. They're also version control friendly.
Different applications have different levels of support for \LaTeX. For example, many word processors have add-ons designed to provide \LaTeX support (e.g. TexMaths for LibreOffice). Modern presentation software such as Keynote (Apple) allows you to add mathematical expressions and equations as floating objects on a slide. RStudio goes one step further and allows you to create documents that mix R code and \LaTeX using R Markdown. It allows you to create dynamic documents where you can embed \LaTeX for equations and formatting, while integrating R code for analysis and visualisation. It is great!
Mathematical Notations
There are different ways of writing a mathematical equation. Here are two example:
Single dollar sign $
Used to denote inline mathematical expressions or equations within a line of text. For example $f(A_{12})=2pq$
:
f(A_{12})=2pq
or inside some text We use $f(A_{12})=2pq$ to calculate the haplotype frequency.
:
We use f(A_{12})=2pq to calculate the haplotype frequency.
Anything enclosed in $
signs is treated as a mathematical expression and typeset within the text flow, allowing equations to flow seamlessly into the surrounding text.
Double dollar signs $$
They are used to display independent, centred mathematical equations on their own lines. For example $$f(A_{11})=p^2$$
:
The $$
symbols initiate and terminate a display math environment, rendering the enclosed content in the centre of its own line and often with greater prominence compared to inline equations.
It's important to note, that the use of $$
to display mathematics in \LaTeX is considered obsolete. The preferred and more flexible way to display equations is to use the begin{equation} and end{equation} or begin{align} and end{align} environments, which give better control over equation numbering, alignment and referencing.
\begin{equation}
f(A_{11})=p^2
\end{equation}
Arithmetic Operations
- a+b (
$a+b$
) - a-b (
$a-b$
) - a \cdot b (
$a \cdot b$
) or a \times b ($a \times b$
) -
a \div b (
$a \times b$
) or \frac{a}{b} ($\frac{a}{b}$
) -
subscripts (
_
): A_1 ($A_1$
) or A_{12} ($A_{12}$
) - superscripts (
^
): \chi^2 ($\chi^2$
) - square root (
sqrt
): \rho = \frac{D}{\sqrt{p_1q_1p_2q_2}} ($\rho = \frac{D}{\sqrt{p_1q_1p_2q_2}}$
)