# Index
- LaTeX
- Why LaTeX
- Installation
- Writing a Document
- Tools to increase productivity
- Useful Packages
- Displaying Math
- Code Blocks
- Logic
- Automata
- This is why you need to learn Machine Learning
# LaTeX
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)
# Installation
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 \usepackage{name_of_the_package}
.
# Displaying Math
The 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).
Extra mathematical fonts and symbols can be used by including the amssymb
package (opens new window). A recap can be found here (opens new window).
# Code Blocks
The 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.
Based on the previous package, pythonhighlight
(opens new window) is a simple Python highlighting style to be used with LaTeX. You can find the very simple instructions here (opens new window).
To write pseudocode, you can use algorithms (opens new window), which consists in two packages: algorithm
and algorithmic
. Here (opens new window) you can find examples and useful commands.
# Logic
For natural deductions there's the bussproofs
package (opens new window). You can find the user guide with examples here (opens new window).
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).
# Automata
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).
Created by Damiano Azzolini. Contacts: mail github (opens new window)
Expanded upon by the editor of the Mathspp Blog (opens new window), RojerGS (opens new window), and by Lara Vignotto (mail, github (opens new window))