How to Install and Use LaTeX

🚀 Procedure for Ubuntu and Windows.


How to Install and Use LaTeX


LaTeX is a high-quality document preparation system, especially used for scientific, technical and mathematical texts. It allows the creation of documents with precise formatting, complex equations, automatic bibliographic references and professional structuring.

LaTeX is an abbreviation of Lamport TeX) was developed in the 1980s by Leslie Lamport. When writing, the writer uses plain text, rather than the formatted text found in WYSIWYG word processors such as Microsoft Word, LibreOffice Writer, and Apple Pages.

The writer uses markup tagging conventions to: define the overall structure of the document (such as an article, book, or letter), to format text throughout a document (such as bold and italics), and to add citations and cross-references.

A TeX typesetting system, such as TeX Live or MiKTeX, is used to produce an output article (electronic publication such as PDF or DVI) suitable for printing or digital distribution. It is also used for the production of personal letters, articles and books on various subjects.

Within the typesetting system, its name is stylized as LaTeX. Currently in the version called: LaTeX 2e.


Installation

In Ubuntu install TeX Live using APT:

sudo apt install texlive-latex-base

If you want a complete installation with fonts and extras, run:

sudo apt install texlive-latex-base texlive-fonts-recommended \
texlive-fonts-extra texlive-latex-extra

This will install almost 1GB of data, so it’s not that interesting for beginners.

You can also choose to install the editor TeXstudio (graphical editor for LaTeX):

sudo apt install texstudio

For more information, visit the address: https://www.texstudio.org/.

On Windows:

You can also use WinGet in PowerShell:

winget install -e --id TeXstudio.TeXstudio


Basic example of using LaTeX

Create a file with the extension .tex, for example: file.tex and insert the content below:

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

\title{My First Document}
\author{Your Name}
\date{\today}

\begin{document}

\maketitle

\section{Introduction}
Hello, world! This is my first document in LaTeX.

\section{Mathematics}
The quadratic formula is:
\[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \]

\end{document}

To compile, just use the pdflatex command:

pdflatex file.tex

It may ask you some questions and at the end there will be a question mark: ?, just press ENTER (several times) and it will finish creating the document anyway.

Then just open the file.pdf in your PDF viewer by clicking on it or running it in the terminal:

xdg-open file.pdf

This is in Ubuntu and similar.

It will also generate intermediate files such as: file.aux and file.log, just remove them if you want, next time pdflatex will overwrite them anyway.

rm file.aux file.log

If you are in TeXstudio, press the Compile button (usually a green arrow in TeXstudio):

  • LaTeX will generate a PDF file with the result.

Differences between compilers:

  • PDFLaTeX: Generates PDF directly (recommended for simple texts).
  • LaTeX + DVI: Generates an intermediate file (.dvi) before the PDF.
  • BibTeX: Used to manage bibliographic references.

How to Use LaTeX in Everyday Life?

  • Equations: Use $...$ (inline) or \[...\] (highlight).
  • Tables: Use environments such as tabular.
  • Images: Add with \includegraphics (package graphicx).
  • References: Use \cite{key} and BibTeX for bibliographies.


latex tips


Share


YouTube channel

Subscribe


Marcos Oliveira

Marcos Oliveira

Software developer
https://github.com/terroo

Related articles