LaTeX is a markup language (or, as said in the official website, "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!
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.
Under Unix systems, you can install TeXLive. In particular, under Ubuntu you can type in the terminal sudo apt-get install texlive-full
.
Under Windows systems, you can install MiKTeX or also TexLive.
Under MacOs, MacTex.
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 which is free and cross platform. It is also worth saying that Visual Studio Code with some dedicated extensions (such as LaTeX Workshop) is pretty good to use.
There are tons of on-line guides about LaTeX to get you started. Among them:
- A comprehensive guide can be found here.
- Another cool guide here.
- This one is perfect for beginners.
- Also here another guide.
It's also possible to write your LaTeX document on-line and share it with your collaborators using OverLeaf.
There are already lots of templates made. You can find some of them here.
To draw awesome graphs and charts, you can use the package TikZ.
Also a good site to keep in mind when facing a problem with LaTeX is StackOverflow with the LaTeX dedicated section.
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 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. 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 and then ask the site to generate the appropriate code.
- MathJax is one of the ways in which you can get LaTeX to render, say, in your blog! (example here, where the formulas are rendered with MathJax)
- Mathpix Snipping Tool 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.
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}
.
The amsmath
package provides miscellaneous enhancements for improving the information structure and printed output of documents that contain mathematical formulas, as stated in this useful guide.
Extra mathematical fonts and symbols can be used by including the amssymb
package. A recap can be found here.
The listings
package 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 a guide with examples.
Based on the previous package, pythonhighlight
is a simple Python highlighting style to be used with LaTeX. You can find the very simple instructions here.
To write pseudocode, you can use algorithms, which consists in two packages: algorithm
and algorithmic
. Here you can find examples and useful commands.
For natural deductions there's the bussproofs
package. You can find the user guide with examples here.
If you find tedious manually writing truth tables, here 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 a quick tutorial. You can also automatically generate the code using this website.
Created by Damiano Azzolini. Contacts: mail github
Expanded upon by the editor of the Mathspp Blog, RojerGS, and by Lara Vignotto (mail, github)