How to install LaTex on Ubuntu 22.04 Jammy Jellyfish Linux

Latex is a document writing system, which is especially useful for writing mathematical equations. The objective of this tutorial is to provide the reader with instructions on how to install LaTeX on Ubuntu 22.04 Jammy Jellyfish Linux.

In this tutorial you will learn:

  • How to install LaTeX on Ubuntu 22.04
  • How to compile a basic Latex document from the command line
LaTex on Ubuntu 22.04 Jammy Jellyfish Linux
LaTex on Ubuntu 22.04 Jammy Jellyfish Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Ubuntu 22.04 Jammy Jellyfish
Software LaTex
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install LaTex on Ubuntu 22.04 step by step instructions



Twitter icon Follow LinuxConfig.org on Twitter for the latest tips and tricks about Linux!


The official Ubuntu repository consists of various meta packages from which each targets different type of a LaTeX user. Below you can find the most common installation packages for LaTeX and their approximate disk space requirements based on Ubuntu 22.04 with minimal installation selected:

  • texlive-base – 160 MB
  • texlive-latex-recommended – 203 MB
  • texlive – 269 MB
  • texlive-latex-extra – 464 MB
  • texlive-full – 5903 MB

The first package texlive-base will install just the basics to get you started with LaTeX. texlive or texlive-latex-extra is most likely the best way to get started for most users.

However, our package selection is only motivated by the requirement for the least disk space consumed after the LaTeX installation. If you have plenty of space and a good download speed nothing stops you to go for texlive-full package. But be aware that this package will fetch the whole lot, including, but not limited to, eg. Japanese language pack.

Furthermore, Ubuntu offers more profession targeted package selections such as:

  • texlive-publishers
  • texlive-science
  • texlive-pstricks
  • texlive-pictures
  • texlive-metapost
  • texlive-music
  • texlive-xetex
  • texlive-luatex
  • texlive-games
  • texlive-humanities
  1. Regardless of your package choice you can install LaTeX by use of the apt command. The following Linux command will install the LaTeX package: texlive-latex-extra. Replace the package name with the one you wish to install, open a command line terminal and enter:
    $ sudo apt install texlive-latex-extra
    

    That’s all there is to it.

  2. Now, that we have LaTeX installed let’s just confirm the installation by compiling a simple LaTeX code. Open up any text editor like for example gedit, enter the following code and save as hello-world.tex:
    \documentclass{article}
    \usepackage{hyperref}
    \begin{document}
    Hello world \LaTeX
    
    \url{https://linuxconfig.org}
    \end{document}
  3. Once you have the above LaTeX code saved use the pdflatex command to compile it to PDF. If the pdflatex command is available on your system you will need to install texlive-extra-utils before you can use it:
    $ pdflatex hello-world.tex
    
  4. The above step will compile your hello-world.tex to hello-world.pdf. Next, start Evince PDF viewer to see the result:
    $ evince hello-world.pdf
    

    Compiled Latex document
    Compiled Latex document



  5. (optional) Install a LateX editor and compiler for an easy LateX document editing and compilation.

Closing Thoughts

In this tutorial, we learned how to install LaTex on Ubuntu 22.04 Jammy Jellyfish Linux. This included several different LaTex packages depending on how big of an installation you want and if you want any targeted profession packages. We also saw how to compile a test LaTex document in order to verify that the installation was set up correctly.