UbuntuUbuntu Based

How To Install LaTeX on Ubuntu 24.04 LTS

Install LaTeX on Ubuntu 24.04

LaTeX is a powerful and widely used document preparation system that enables users to create professional-looking documents, particularly in academia and research. With its extensive set of features and packages, LaTeX offers unparalleled control over document formatting, making it an essential tool for writing scientific papers, theses, and technical reports. Ubuntu 24.04 LTS, the latest long-term support version of the popular Linux distribution, provides a stable and reliable platform for installing and using LaTeX.

In this article, we will guide you through the step-by-step process of installing LaTeX on Ubuntu 24.04 LTS, ensuring that you have all the necessary tools and configurations to start creating high-quality documents.

Prerequisites

  • A server running one of the following operating systems: Ubuntu and any other Debian-based distribution like Linux Mint.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • Basic familiarity with the terminal and command-line interface.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies.
  • An Ubuntu 24.04 system with root access or a user with sudo privileges.

Install LaTeX on Ubuntu 24.04

Step 1. Updating the Package Repository.

To begin the installation process, open your terminal and run the following commands to update your system packages:

sudo apt update
sudo apt upgrade

Updating your packages ensures that you have the latest versions of all the necessary dependencies and helps prevent potential compatibility issues during the LaTeX installation.

Step 2. Installing LaTeX.

TeX Live is a comprehensive distribution of LaTeX that includes all the essential packages, fonts, and tools required for creating LaTeX documents. Ubuntu 24.04 LTS provides two options for installing TeX Live: a basic installation and a full installation.

  • Basic Installation

If you only need the core LaTeX packages and have limited disk space, you can opt for the basic installation by running the following command:

sudo apt install texlive

The basic installation includes the most commonly used LaTeX packages and is suitable for most users.

  • Full Installation

For users who require a more comprehensive set of LaTeX packages and tools, the full installation is recommended. To install the complete TeX Live distribution, run the following command:

sudo apt install texlive-full

The full installation provides access to a vast collection of LaTeX packages, fonts, and utilities, offering greater flexibility and options for document creation. However, keep in mind that the full installation requires a significant amount of disk space, typically around 5GB.

After the installation process is complete, it’s crucial to verify that LaTeX has been installed correctly. To check the installation, run the following command in your terminal:

latex --version

If the installation was successful, you should see the version number of your LaTeX distribution displayed in the terminal output. If you encounter any errors or the command is not found, double-check that you have followed the installation steps correctly and try running the installation command again.

Step 3. Configuring PATH Environment.

To ensure that the LaTeX binaries are accessible from any directory in your terminal, you need to add the LaTeX installation directory to your system’s PATH environment variable. By default, the LaTeX binaries are installed in /usr/local/texlive/YYYY/bin/ARCH, where YYYY represents the year of the TeX Live release and ARCH represents your system architecture (e.g., x86_64-linux).

To add the LaTeX binaries to your PATH, open your shell configuration file (e.g., ~/.bashrc for Bash) in a text editor and add the following line at the end of the file:

export PATH=/usr/local/texlive/YYYY/bin/ARCH:$PATH

Replace YYYY and ARCH with the appropriate values for your installation. Save the file and restart your terminal or run source ~/.bashrc for the changes to take effect.

Step 4. Creating and Compiling a LaTeX Document.

  • Creating a Simple LaTeX Document.

To create a LaTeX document, open your preferred text editor and create a new file with a .tex extension. For example, let’s create a file named example.tex and add the following content:

\documentclass{article}
\usepackage[utf8]{inputenc}

\title{My First LaTeX Document}
\author{Your Name}
\date{August 2024}

\begin{document}

\maketitle

\section{Introduction}
This is a simple LaTeX document created on Ubuntu 24.04 LTS.

\subsection{Subsection}
LaTeX allows you to create structured documents with ease.

\end{document}

This example document includes a title, author, date, and a simple section and subsection. You can customize the content and structure of your document based on your specific requirements.

  • Compiling the Document

To compile your LaTeX document and generate an output file (usually a PDF), run the following command in your terminal, replacing example.tex with the name of your .tex file:

pdflatex example.tex

The pdflatex command processes your LaTeX source file and generates several output files, including a PDF file with the same name as your .tex file. You can view the generated PDF file using a PDF viewer such as Evince or Adobe Reader.

If you encounter any errors during the compilation process, LaTeX will display error messages in the terminal, indicating the line numbers and nature of the errors. Carefully review the error messages and make the necessary corrections to your .tex file before recompiling.

Congratulations! You have successfully installed LaTeX. Thanks for using this tutorial for installing the LaTeX on the Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official Ubuntu website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button