LaTeX is a powerful typesetting system widely used for creating professional-looking documents, especially in academia and research. If you’re using Ubuntu and want to get started with LaTeX, this guide will walk you through the installation process and help you create your first document with ease. Let’s dive in!
Just before you install LaTeX and its dependencies, make sure your system is updated by running:
sudo apt update
sudo apt upgrade
We will install LaTeX with some extra fonts and to edit and create our documents, we will also install TeXStudio:
sudo apt install texlive-latex-extra texlive-fonts-extra texstudio
On a LaTeX document, the first step is to declare the document class we will use. In this example, we will use the ‘article’ as it is one of the most used ones. Then we include ‘inputenc’ to be able to use emojis and characters of the UTF8 encoding. The packages ‘amsmath’, ‘amssymb’ and ‘amsthm’ will be used to draw mathematical expressions in our documents. ‘graphicx’ and ‘float’ are used to load pictures into our documents, but we also need to set a ‘graphicspath’, that is the directory where our images are loaded from. Finally, we include ‘hyperref’ and set it up to use the color blue, this will let us generate clickable links in our documents.
\documentclass{article}
\usepackage[utf8]{inputenc} % to be able to use characters like ç, ñ and other
\usepackage{amsmath, amssymb, amsthm} % for math equations
\usepackage{graphicx, float} % for pictures
\graphicspath{{images/}} % folder with pictures
\usepackage{hyperref} % add clickable links to your doc
\hypersetup{colorlinks=true, linkcolor=blue}
After loading and setting up our packages, we then need to set the title, author and date of the document:
\title{Test doc}
\author{TMVTech}
\date{March 2025}
Then we can begin our document. Inside it, use ‘maketitle’ so that LaTeX generates the title for us:
\begin{document}
\maketitle % show title, author and date
% other document code here
\end{document}
Sections are a big title with a number before it. Subsections are similar, but with smaller text:
\section{Testing Sections}
\subsection{Subsection 1}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.
\subsection{Subsection 2}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.
There are two ways of writing math in LaTeX. You can write an equation inline by wrapping it in dollar signs, the other option, is to begin an equation and write it inside:
\section{Math}
\subsection{Equations}
You can write equations in the middle of a sentence, this one, $E=mc^2$, is a little different than normal text, but it fits well.
There are some math symbols that are a little hard to find, you can use \url{https://detexify.kirelabs.org/classify.html} to find them. For example, this sum: $\sum F=ma$.
And you can even make a group of equations:
\begin{equation}
\label{eq1}
\begin{split}
A = \frac{\pi^2}{2} \\
B = \frac{1}{2} \pi^2
\end{split}
\end{equation}
If you want to move things to the next page you can use ‘newpage’, and all the text below this line will be drawn on another page:
\newpage
To load images, begin a figure block and use ‘includegraphics’ with the size and path:
\section{Image Test}
\begin{figure}[H]
\centering
\includegraphics[width=8cm]{tmv.png}
\caption{Caption}
\label{fig:label}
\end{figure}
Here is how the test document should look. If you can’t see the PDF file below, click here.
And that’s all for this article. Thanks for reading, and stay tuned for more tech insights and tutorials. Until next time, and keep exploring the world of tech!