Learn \LaTeX
Table of Content
“Who Is LaTeX” Stage
Typing
It is a requirement for any programming activity. Open any trainer for blind printing with ten fingers — and go ahead!
How To Learn
For a quick start in LaTeX take a free course from the HSE. The basics could be learned in 4-5 hours, and two days off are enough for the entire course. Video lessons are better than thick books in the beginning.
Where To TeX
There are two ways.
- Online compiler like overleaf.
- Very simple.
- Real-time online teamwork.
- Set up your environment.
- So much faster compiling!
- Takes time.
- Easier to integrate Git.
GUI / Text Editor for LaTeX
The best option, in my opinion, is LaTeX
in Vim
. There are gold
articles in which Gilles Castel shows his Vim
+ LaTeX
setup and how it works.
Otherwise — you can try TexStudio
, but it looks like an ancient artifact.
Also, there is the texpad
app for macOS, but I had some issues with buggy behavior (in 2020).
PS: The Vim
+ LaTeX
setup can easily take 20+ hours to make it work if you are new.
Life Hacks
- Use
\newcommand{command_name}{script_of_command}
for commands you use very often. Comparef: \mathbb{R} \to \mathbb{R}
andf: \R\to\R
. - Learn how to tex in
Vim
=)
Typical Mistakes
- Please, God, don’t do 500+ lines main.tex …
- It will be an unmaintainable mess.
- You don’t have a universal preamble.
Instead — use
input{anotherFile.tex}
orinclude{anotherFile.tex}
to structure code. - Not using or defining
LaTeX
environments. For every theorem, proof, note, etc. you can set special environment (\begin{theorem}
,\begin{proof}
).- Now you can change the style of your theorems by changing one line.
- Not using
multiline
oralign
environments for long formulas.\begin{align*} a &= b + c + d - d \\ &= b + c \end{align*}
- Not using
\cfrac
or\displaystyle
when necessary.- Otherwise, the formula may get hard to read.
(\frac{2 + \frac{8}{4}}{6}
)
(\cfrac{2 + \frac{8}{4}}{6}
)
- Otherwise, the formula may get hard to read.
- Not using
\text
inside formulas.
$$\begin{align*} a &= a + b + c + d , when\; sun\; is\; red \\ a &= b + c, \text{when sun is white} \end{align*}$$
- All variables inside text should be math mode.
-a or - Avoid making new lines in text with
\\
.- Using empty lines instead makes code much more readable.
-
Not using
\ldots
for … - Ignoring warnings and errors.
- You must not ignore errrs.
- Warnings help you deepen your knowledge and improve code.
- Not using
Git
for big projects.- Best of luck…
- Using tutorials from ancient times.
- You can meet outdated and deprecated practices.
Useful Links
- Get LaTeX code from formula screenshot — super ultra-useful
- Draw symbol and get latex command — ultra-useful
- Latex table constructor
- LaTeX Cheatsheet