Getting Started with pdfLaTeX in Linux - A Complete Guide

Getting Started with pdfLaTeX in Linux - A Complete Guide

Nov 15, 2025

Introduction

LaTeX is a powerful document preparation system widely used in academia, research, and technical writing. This system is useful i.e., when writting documents about technical models in finance as it excels at producing professional formatted documents with mathematical equations along with bibliographies, cross-references, media assets and more. Furthermore, pdfLaTeX is one of the most popular LaTeX engines that directly compiles .tex files into PDF documents.

This post will walk you through everything you need to know about installing and using pdfLaTeX in Linux, which is my prefered OS, from a basic setup to creating your first document. Whether you’re writing academic papers, preparing technical reports, or creating presentations, pdfLaTeX provides the tools you need for professional-quality output. Other online services like Overleaf are fantastic tools, but sometimes you don’t have access to them, and still requiring processing LaTEX files, in here a good option.

Why pdfLaTeX?

pdfLaTeX offers several advantages over traditional LaTeX:

  • Direct PDF output: No need for intermediate DVI files
  • Better font handling: Native support for TrueType and OpenType fonts
  • Image support: Direct inclusion of PDF, PNG, and JPEG images
  • Hyperlinks: Built-in support for clickable references and URLs
  • Microtyping: Advanced typography features for better-looking documents

Step 1 - Installing TeX Live Distribution

TeX Live is the most comprehensive and recommended LaTeX distribution for Linux systems. It includes pdfLaTeX and thousands of packages for various document types.

Distribution Full Installation Command Minimal Installation Command
Ubuntu/Debian sudo apt install texlive-full sudo apt install texlive-latex-base texlive-latex-extra
Fedora/RHEL sudo dnf install texlive-scheme-full sudo dnf install texlive texlive-latex
Arch Linux sudo pacman -S texlive-core texlive-latexextra (Minimal install is typically same as above)

Note: Full installations provide all packages but require several GB of disk space. Minimal installations include only essential LaTeX components.

After installation, you may verifying that pdfLaTeX is properly installed:

> pdflatex --version
pdfTeX 3.141592653-2.6-1.40.25 (TeX Live 2023/Debian)
kpathsea version 6.3.5

You should see output showing the pdfLaTeX version information.

Step 2 - Setting Up a Text Editor

While you can use any text editor to write LaTeX documents, some editors provide special features like syntax highlighting, auto-completion, and integrated compilation.

Distribution Installation Command
Ubuntu/Debian sudo apt install texstudio
Fedora sudo dnf install texstudio
Arch Linux sudo pacman -S texstudio

Visual Studio Code with LaTeX Workshop extension:

The LaTeX Workshop extension for Visual Studio Code is a powerful complement to dedicated LaTeX editors like TeXstudio. While TeXstudio offers a specialized environment with features tailored for LaTeX editing, VS Code with LaTeX Workshop brings the flexibility of a modern code editor, including integrated version control, customizable keybindings, and support for multiple programming languages. This can be especially useful for users who work on projects involving both code and documentation, as everything can be managed within a single interface. The extension of my preference can be accessed here.

Moreover, TeXstudio is not required to use VS Code as an IDE for LaTeX. The LaTeX Workshop extension provides features such as syntax highlighting, live preview, error reporting, and build tools directly within VS Code. Meaning that users can compile, preview, and edit LaTeX documents without needing to install TeXstudio. However, some users may still prefer TeXstudio for its specialized tools, so using both can offer the best of both worlds depending on workflow preferences.

If you are a fan of the terminal you might be interested in vim-latex plugin, that may be installed with:

> sudo apt install vim-latexsuite

I do prefer the IDE.

Step 3 - Creating Your First LaTeX Document

Let’s create a simple LaTeX document to test your installation. Create a file called first_document.tex:

> nano first_document.tex

Add the following content:

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

\title{My First Quant Technical Document}
\author{Cristian}
\date{\today}

\begin{document}

\maketitle

\section{Introduction}
This is my first technical document created with pdfLaTeX in Linux.

\section{Mathematics}
Here's a simple equation:
\begin{equation}
    dX_t = \theta (\mu - X_t)\,dt + \sigma\,dW_t
\end{equation}
\end{equation}

Here's a brief definition and explanation of Brownian motion and the properties of $dW_t$:

Brownian motion, often denoted as $W_t$, is a continuous-time stochastic process with the following properties:

\section{Lists}
\subsection{Unordered List}
\begin{itemize}
    \item $W_0 = 0$
    \item Independent increments: For $0 \leq s < t$, the increment $W_t - W_s$ is independent of the past.
    \item Normally distributed increments: $W_t - W_s \sim \mathcal{N}(0, t-s)$
    \item Continuous paths: $W_t$ is almost surely continuous in $t$
\end{itemize}

\section{Conclusion}
The differential $dW_t$ represents an infinitesimal increment of Brownian motion, which is independent of previous increments and can be simulated by sampling from a normal distribution:
$$
dW_t \sim \mathcal{N}(0, dt)
$$
where $dt$ is a small time step. In numerical simulations, $dW_t$ is typically approximated by drawing random samples from a normal distribution with mean $0$ and variance $dt$.

\end{document}

Step 4 - Compiling Your Document

Now for compiling your .tex file into a PDF using pdfLaTeX:

> pdflatex first_document.tex

This command will generate several files:

  • first_document.pdf - Your final PDF document
  • first_document.aux - Auxiliary file for references
  • first_document.log - Compilation log file

To view your PDF just use your prefered software for vizualizing PDF format files.

Multiple Compilation Passes

For documents with cross-references, bibliographies, or tables of contents, you need to compile your .tex file several times to ensure all references are resolved. Typically, run:

> pdflatex document.tex

Repeat the compilation until all references are updated and warnings about unresolved references disappear (usually two or three passes). If using BibTeX, insert a bibtex run after the first compilation:

> pdflatex document.tex
> bibtex document
> pdflatex document.tex
> pdflatex document.tex

The first pass generates auxiliary files, and subsequent passes resolve references and update the document structure.

Step 5 - Working with Bibliographies

Why BibTeX?. BibTeX is the standard tool for managing bibliographies in LaTeX. It separates citation data from your main document, making it easy to organize, update, and reuse references. BibTeX automatically formats citations and reference lists according to your chosen style, saving time and reducing errors.

Benefits of BibTeX

  • Centralizes references in a single .bib file for easy management.
  • Supports a wide range of citation styles (plain, IEEE, APA, etc.).
  • Enables automatic formatting and sorting of references.
  • Simplifies collaboration—multiple authors can share and update the bibliography.
  • Makes it easy to reuse references across multiple documents and projects.
  • Reduces manual errors and ensures consistency in citations.

With BibTeX, you can efficiently handle academic references, streamline your workflow, and maintain professional standards in your documents.

Create a bibliography file (references.bib)

Storing references in a separate .bib file is a best practice in LaTeX projects, as it keeps your bibliography organized and makes it easy to manage, update, or reuse citations across multiple documents. This format allows you to maintain a centralized database of sources, ensuring consistency and simplifying collaboration in academic and technical writing.

Common types of bibliography entries you may include in a .bib file are:

Entry Type Description Example Usage
@book Books and textbooks Academic textbooks
@article Journal articles Peer-reviewed publications
@inproceedings Conference papers Conference proceedings
@techreport Technical reports Institutional reports
@misc Online resources or other materials Websites, manuals, datasets

Additionally, by using BibTeX with a dedicated bibliography file you will streamline citation management and supports a wide range of reference types for professional documentation.

@book{hull2018options,
    author    = {John C. Hull},
    title     = {Options, Futures, and Other Derivatives},
    publisher = {Pearson},
    year      = {2018},
    edition   = {10th}
}

@book{shreve2004stochastic,
    author    = {Steven E. Shreve},
    title     = {Stochastic Calculus for Finance II: Continuous-Time Models},
    publisher = {Springer},
    year      = {2004}
}

@book{chan2013algorithmic,
    author    = {Ernie Chan},
    title     = {Algorithmic Trading: Winning Strategies and Their Rationale},
    publisher = {Wiley},
    year      = {2013}
}

@article{black1973pricing,
    author  = {Fischer Black and Myron Scholes},
    title   = {The Pricing of Options and Corporate Liabilities},
    journal = {Journal of Political Economy},
    year    = {1973},
    volume  = {81},
    number  = {3},
    pages   = {637--654}
}

Update your LaTeX document

Then as an extension of abovementioned example, we can add the section of references by adding the section as shown below, and subsequently compiling the files again.

\section{References in Quantitative Finance}

Quantitative finance has evolved through foundational works that have shaped modern financial theory and practice. For example, the Black-Scholes model introduced by Black and Scholes \cite{black1973pricing} revolutionized option pricing. Hull's textbook \cite{hull2018options} is widely used for learning derivatives and risk management. The concept of stochastic calculus in finance is well explained by Shreve \cite{shreve2004stochastic}. For practical algorithmic trading, Chan's book \cite{chan2013algorithmic} is a popular resource.

\bibliographystyle{plain}
\bibliography{references}
> pdflatex document.tex
> bibtex document
> pdflatex document.tex
> pdflatex document.tex

Step 6 - Common pdfLaTeX Commands and Options

You can summarize the most useful pdfLaTeX commands in the table below:

Command & Option Purpose/Description Example Usage
pdflatex document.tex Basic compilation Compile .tex to PDF
pdflatex -interaction=batchmode ... Silent mode (suppress output) Hide compilation details
pdflatex -halt-on-error ... Stop on first error Abort on first error
pdflatex -output-directory=build ... Specify output directory Save output files in build/
pdflatex -shell-escape ... Enable shell escape (for certain packages) Allow execution of external commands

Tip: Use these options as needed to streamline your workflow and troubleshoot issues efficiently.

Warning: Only use -shell-escape with trusted documents as it allows LaTeX to execute system commands.

Step 7 - Essential LaTeX Packages

Since more sophisticated presentations require extra tools, pdfLatex also allows to add extra packages to enrich the document. Based on the distribution they can be installed as dollows.

Distribution Installation Command
Ubuntu/Debian sudo apt install texlive-latex-extra texlive-fonts-extra texlive-science
Fedora sudo dnf install texlive-collection-latexextra texlive-collection-fontsextra
Arch Linux sudo pacman -S texlive-latexextra texlive-fontsextra

Some usefull packages can be identified below, with the respective line to be added in our document, ready for use.

\usepackage{graphicx}    % For including images
\usepackage{hyperref}    % For hyperlinks
\usepackage{amsmath}     % Advanced math
\usepackage{geometry}    % Page layout
\usepackage{listings}    % Code listings
\usepackage{xcolor}      % Colors
\usepackage{booktabs}    % Professional tables

Installing Support for Different Languages

LaTeX supports many languages through dedicated language packages. You can install language support to write documents in languages other than English, enabling proper hyphenation, date formats, and special characters.

For example, to add Spanish language support on Ubuntu/Debian, run:

> sudo apt-get install texlive-lang-spanish

After installation, you can use the babel package in your LaTeX document:

\usepackage[spanish]{babel}

This approach works for other languages as well—just install the corresponding texlive-lang-<language> package and set the desired language in your document.

Installing Scientific Notation Support

To work with scientific notation, advanced math symbols, and specialized scientific packages in LaTeX, you can install the texlive-science package. This package provides a wide range of utilities for scientific writing, including support for chemistry, physics, engineering, and more.

Install it on Ubuntu/Debian with:

> sudo apt-get install texlive-science

This package complements the standard LaTeX installation by adding modules for scientific notation, units, and domain-specific formatting. If you need even more specialized utilities, consider installing additional packages such as texlive-math-extra or texlive-physics for extended mathematical and physical notation support.

Package Name Purpose/Description Installation Command
texlive-math-extra Extra math utilities and symbols sudo apt-get install texlive-math-extra
texlive-physics Physics-specific symbols and tools sudo apt-get install texlive-physics

These packages ensure you have all the tools necessary for professional scientific and technical documentation in LaTeX.

Step 8 - Troubleshooting Common Issues

When working with pdfLaTeX in Linux, you may encounter issues such as missing files, unavailable packages, permission errors, outdated auxiliary files, or compilation failures. Addressing these problems quickly ensures smooth document preparation and compilation.

Issue Solution Command(s) Description
File not found errors sudo tlmgr update --self
sudo tlmgr update --all
Update TeX Live package database
Missing packages sudo tlmgr install <package-name> Install specific LaTeX package
Permission denied errors sudo chown -R $(whoami) /usr/local/texlive Fix directory ownership for TeX Live
Old auxiliary files rm *.aux *.log *.out *.toc *.bbl *.blg Remove outdated auxiliary files
View compilation errors less document.log
grep -i error document.log
Inspect log file for error messages

Step 9 - Automation with Makefiles

Automating LaTeX compilation with a Makefile streamlines your workflow by:

  • Reducing manual steps—just run make to compile, make clean to remove auxiliary files.
  • Ensuring consistent builds, especially for multi-pass compilation and bibliography updates.
  • Making it easy to share reproducible build instructions with collaborators.

Makefile vs. CMake

  • Makefile: Simple, text-based automation tool ideal for LaTeX and small projects. Directly specifies build rules and dependencies.
  • CMake: More advanced, cross-platform build system generator, mainly used for C/C++ projects. Generates platform-specific build files (e.g., Makefiles, Ninja, Visual Studio solutions).

For LaTeX documents, a Makefile is usually sufficient and easier to maintain.

# Makefile for LaTeX documents

DOCUMENT = document
LATEX = pdflatex
BIBTEX = bibtex

all: $(DOCUMENT).pdf

$(DOCUMENT).pdf: $(DOCUMENT).tex
	$(LATEX) $(DOCUMENT).tex
	$(BIBTEX) $(DOCUMENT)
	$(LATEX) $(DOCUMENT).tex
	$(LATEX) $(DOCUMENT).tex

clean:
	rm -f *.aux *.log *.out *.toc *.bbl *.blg *.pdf

.PHONY: all clean

Then simply run:

make # This line compiles the document
make clean # This one cleans auxiliary files

Step 10 - Advanced Tips and Best Practices

Use latexmk for automatic compilation

latexmk is a highly recommended tool for automating LaTeX document compilation. It intelligently tracks dependencies and automatically runs the necessary sequence of commands (such as multiple pdflatex and bibtex passes) to resolve references, bibliographies, and indexes. This eliminates the need for manual multi-pass compilation and reduces errors caused by forgetting a step.

Benefits of latexmk

  • Automatically detects changes and recompiles only when needed.
  • Handles complex documents with cross-references and bibliographies seamlessly.
  • Supports continuous preview mode (-pvc), updating the PDF whenever you save changes.
  • Simplifies workflow for large projects and collaborative environments.

When to use latexmk

  • For documents with bibliographies, indexes, or cross-references requiring multiple compilation passes.
  • When you want a hands-off, reliable build process.
  • In collaborative or version-controlled projects to ensure consistent builds.
  • For continuous editing and previewing during document development.

Using latexmk streamlines your LaTeX workflow, saves time, and helps avoid common compilation pitfalls.

# Install latexmk
> sudo apt install latexmk  # Ubuntu/Debian

# Compile with automatic dependency handling
> latexmk -pdf document.tex

# Continuous preview mode
> latexmk -pdf -pvc document.tex

Organize large projects

Organizing large projects by separating functionality into distinct files or modules is essential for maintainability, scalability, and readability. This modular approach allows teams to collaborate more effectively, quickly locate and update specific components, and test features without impacting unrelated parts of the project. For large-scale applications, a clear separation of concerns and modularity are crucial for long-term developments, making it easier to manage complexity and adapt to evolving designs.

# Project structure
project/
├── main.tex
├── references.bib
├── chapters/
│   ├── 00_introduction.tex
│   ├── 01_methodology.tex
│   └── 02_conclusion.tex
├── figures/
│   ├── plot1.jpeg
│   └── diagram.png
└── Makefile

Use \include and \input for modular documents

In LaTeX, the \include and \input are commands used to modularize large documents by splitting them into smaller, manageable files.

  • \input{filename}: Inserts the contents of filename.tex at the exact location of the command. It is lightweight and does not start a new page.
  • \include{filename}: Also inserts the contents of filename.tex, but starts a new page before and after the included file. It creates separate auxiliary files for each included part, which helps with faster compilation of large documents.

Its relevance lays on that by using these commands allows you to organize complex projects (such as theses, books, or reports) into chapters or sections, making collaboration and maintenance easier. For example, you can keep each chapter in a separate file and include them in your main document:

\documentclass{article}

\begin{document}

\include{chapters/00_introduction}
\include{chapters/01_methodology}
\include{chapters/02_conclusion}

\end{document}

Version control with Git

Keeping control of versions for these text-based formats is essential for maintaining a clear history of changes. Version control systems like Git allow you to track modifications, revert to previous states, and safely roll out or roll back design updates proposed in LaTeX documentation. This is especially valuable when documenting models, as it ensures that every change is recorded and recoverable, supporting collaborative workflows and reliable production deployments.

# Create .gitignore for LaTeX projects
cat > .gitignore << EOF
*.aux
*.log
*.out
*.toc
*.bbl
*.blg
*.synctex.gz
*.fdb_latexmk
*.fls
EOF

# Initialize git repository
git init
git add main.tex references.bib
git commit -m "Initial commit"

Takeaways

You now have a complete pdfLaTeX setup in Linux and know how to:

  • Install TeX Live distribution
  • Set up a text editor for LaTeX
  • Create and compile basic documents
  • Work with bibliographies
  • Use common pdfLaTeX commands and options
  • Troubleshoot compilation issues
  • Automate your workflow

pdfLaTeX is a powerful tool for creating professional documents, and with practice, you’ll be able to produce beautifully formatted academic papers, reports, and presentations. The key is to start simple and gradually incorporate more advanced features as you become comfortable with the basics.

Additional Resources


Hope this information is useful for you. Any doubt not hesitate reaching me out via LinkedIn, I’ll be really happy to help.