Hero Image
- Mihai Surdeanu

How to install and use LaTeX on Ubuntu 20.04

This short tutorial tries to explain how you can install and use LaTeX on Ubuntu 20.04 to be used for daily stuff. First of all, let’s discuss what LaTeX is. In just 4 words, LaTeX is: A document preparation system. It gives you the ability to write professional documents – from papers to presentations and books.

Having this in mind and an operating Ubuntu 20.04 system, we will try to see all the steps need to install LaTeX and to start use it. Let’s start!

Step 1: Install TexLive distribution with all associated packages

sudo apt install texlive-latex-extra

This operation requires around 1 GB of data available on disk. After confirmation, please be patient. The process will take some time.

After this operation, 933 MB of additional disk space will be used

Step 2: Create your first document

You can use nano, vim or any other tool for creating and editing files. In my case, I’ve used nano:

nano hello.tex
\documentclass[12pt]{article}
\begin{document}
Hello world!
$Hello world!$ %math mode 
\end{document}

Save you first document.

Step 3: Generate your first PDF file

At this point, you have an ugly .tex file. To generate a nice PDF from it, you have to compile it:

pdflatex hello.tex

If the operation is successful, you will see something similar with my output:

This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./hello.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def)
No file hello.aux.
[1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./hello.aux) )</usr/sha
re/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi12.pfb></usr/share/tex
live/texmf-dist/fonts/type1/public/amsfonts/cm/cmr12.pfb>
Output written on hello.pdf (1 page, 19578 bytes).
Transcript written on hello.log.

The output is written on hello.pdf. You can take a look over it! Good luck!

Other Related Posts:

Use logrotate to automatically manage your logfiles

Use logrotate to automatically manage your logfiles

Currently, I am using logrotate on all my VPS servers to automatically manage my logfiles and to avoid keeping them indefinitely. What's the potential problem by keeping them forever? Quite simple and intuitive. At some point, my servers will run out of free disk space and all applications deployed there will be impacted.

20th Nov 2020 - Mihai Surdeanu