- Why LaTeX
- Writing a Document
- Tools to increase productivity
- Useful Packages
- Displaying Math
- Code Blocks
- This is why you need to learn Machine Learning
LaTeX is a markup language (or, as said in the official website (opens new window), "a document preparation system for high-quality typesetting") used to create wonderful papers and presentations. Almost all papers you will read during your career are written using LaTeX. So, let's see how it works!
# Why LaTeX
For years now LaTeX has been the go-to tool whenever someone needs to create a document that will contain mathematical formulas. LaTeX is used a lot to write scientific papers and it is also used by bloggers and scientific content creators in the internet. You can even use LaTeX syntax on facebook messenger! (which only renders if you are on your computer)
There are several LaTeX distributios, you can see a complete list here (opens new window).
Under Unix systems, you can install TeXLive (opens new window). In particular, under Ubuntu you can type in the terminal
sudo apt-get install texlive-full.
Under Windows systems, you can install MiKTeX (opens new window) or also TexLive (opens new window).
Under MacOs, MacTex (opens new window).
After the installation, you need an editor to write your LaTeX document. You can use whatever editor you want (notepad, vim, nano, gedit and so on) but I recommend you to choose Texmaker (opens new window) which is free and cross platform. It is also worth saying that Visual Studio Code with some dedicated extensions (such as LaTeX Workshop (opens new window)) is pretty good to use.
# Writing a document
There are tons of on-line guides about LaTeX to get you started. Among them:
- A comprehensive guide can be found here (opens new window).
- Another cool guide here (opens new window).
- This one (opens new window) is perfect for beginners.
- Also here (opens new window) another guide.
It's also possible to write your LaTeX document on-line and share it with your collaborators using OverLeaf (opens new window).
There are already lots of templates made. You can find some of them here (opens new window).
To draw awesome graphs and charts, you can use the package TikZ (opens new window).
Also a good site to keep in mind when facing a problem with LaTeX is StackOverflow (opens new window) with the LaTeX dedicated section.
# Tools to increase productivity
The LaTeX syntax can seem daunting at first, with plenty of new commands for all the mathematical symbols you know and need to use.
- This website (opens new window) allows one to write a formula online, and it also has plenty of symbols in which you can just click, generating the code you need. You can also preview your formula, so that it is easier for you to make sure everything is being properly written.
- Whenever you need a symbol but you don't know the command, use this site (opens new window). All you have to do is draw the symbol and then suggestions will appear on the right.
- Creating tables in LaTeX can be particularly annoying. I usually do it here (opens new window) and then ask the site to generate the appropriate code.
- MathJax (opens new window) is one of the ways in which you can get LaTeX to render, say, in your blog! (example here (opens new window), where the formulas are rendered with MathJax)
- Mathpix Snipping Tool (opens new window) helps you to convert images to LaTeX by just taking a screenshort of desired math formula. It can also recognize arrays and various math fonts.
# Useful Packages
Now that you know how to produce a (simple) LaTeX document, you may feel the need to write or draw particular content. To do so, you can use specific packages. All you need to do is to include them at the beginning of your document with the command
# Displaying Math
amsmath package (opens new window) provides miscellaneous enhancements for improving the information structure and printed output of documents that contain mathematical formulas, as stated in this useful guide (opens new window).
# Code Blocks
listings package (opens new window) allows to insert programming code in your LaTeX document. You can highlight code, or specify your language of choice and let the package automatically colour special words, comments, etc for you. Here (opens new window) a guide with examples.
If you find tedious manually writing truth tables, here (opens new window) you'll find an incredibly useful Pyhton script. It automatically generates the LaTeX code of a compiled truth table given one or more propositional logic formulas. (Note: remember that in Python you can write p → q as
not p or q as they are logically equivalent).
To draw finite state machines with LaTeX you can use the
tikz-automata package, here (opens new window) a quick tutorial. You can also automatically generate the code using this website (opens new window).
# This is why you need to learn Machine Learning
Oh damn, take a look at this (opens new window).