# What LaTeX Packages and Compilers Are Used in the AI Job Search Framework

> Discover the LaTeX packages and compilers like LuaLaTeX and XeLaTeX that power the AI Job Search framework for professional CV and cover letter generation.

- Repository: [Mads Lorentzen/ai-job-search](https://github.com/MadsLorentzen/ai-job-search)
- Tags: internals
- Published: 2026-08-29

---

**The AI Job Search framework uses LuaLaTeX for CV generation and XeLaTeX for cover letters, relying on packages such as `fontspec`, `fancyhdr`, `geometry`, and `import` to produce professional PDF documents.**

The `MadsLorentzen/ai-job-search` repository automates job application document generation using specific **LaTeX packages and compilers** tailored to each document type. Understanding this toolchain is essential for customizing templates or troubleshooting build failures in the document pipeline.

## LuaLaTeX for CV Compilation

### Why LuaLaTeX Is Required

According to [`SETUP.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/SETUP.md), `pdflatex` often fails on modern MiKTeX installations when processing the **FontAwesome5** font expansion required by the `moderncv` class. The framework mandates **LuaLaTeX** to handle these modern font features reliably. The continuous integration workflow in [`.github/workflows/ci.yml`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.github/workflows/ci.yml) validates this choice by explicitly invoking `lualatex` with strict error handling flags.

### CV Package Dependencies

The main CV template in `cv/main_example.tex` declares several direct dependencies:

- `\usepackage[utf8]{inputenc}` – Ensures UTF-8 encoding support
- `\usepackage[scale=0.80]{geometry}` – Controls page margins with a 0.80 scale factor
- `\usepackage{import}` – Facilitates modular document structure for sections

Additionally, the `moderncv` document class automatically loads `fontawesome5` for icons. The `hyperref` package is also provided by the class, though it remains commented out in the template source.

## XeLaTeX for Cover Letter Compilation

### Font Management with XeLaTeX

Cover letters require **XeLaTeX** because the custom `cover.cls` class in `cover_letters/cover.cls` uses `\RequirePackage{fontspec}` to load system fonts. This compiler provides the necessary backend for `fontspec` to access the bundled **Lato** and **Raleway** OpenType fonts located in `cover_letters/OpenFonts/fonts/`.

### Cover Letter Package Stack

The `cover_letters/cover_example.tex` template and its underlying class rely on the following packages:

- **`\usepackage{fancyhdr}`** – Customizes headers and footers for professional layout
- **`fontspec`** – Loads the Lato and Raleway font families via `\fontspec` declarations
- **`xunicode`** and **`xltxtra`** – Loaded automatically by `fontspec` to handle Unicode characters and XeLaTeX-specific optimizations

## Build Commands and CI Integration

The repository standardizes compilation flags across both document types. As defined in [`SETUP.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/SETUP.md) and validated in [`.github/workflows/ci.yml`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.github/workflows/ci.yml), the build commands use non-stop mode and halt immediately on errors to fail fast in automation.

Compile a CV with LuaLaTeX:

```bash
cd cv
lualatex -interaction=nonstopmode -halt-on-error main_example.tex

# For generated job-specific files:

lualatex -interaction=nonstopmode -halt-on-error main_<company>_<role>.tex

```

Compile a cover letter with XeLaTeX:

```bash
cd cover_letters
xelatex -interaction=nonstopmode -halt-on-error cover_example.tex

# For generated job-specific files:

xelatex -interaction=nonstopmode -halt-on-error cover_<company>_<role>.tex

```

## Summary

- **LuaLaTeX** compiles CVs to handle `fontawesome5` font expansion where `pdflatex` fails, using directly declared packages including `inputenc`, `geometry`, and `import` in `cv/main_example.tex`.
- **XeLaTeX** compiles cover letters to support `fontspec` for custom Lato and Raleway fonts, utilizing `fancyhdr` for layout control as defined in `cover_letters/cover.cls`.
- Both compilers use the flags `-interaction=nonstopmode -halt-on-error` as specified in [`SETUP.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/SETUP.md) and enforced in [`.github/workflows/ci.yml`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.github/workflows/ci.yml).
- The framework separates concerns strictly: CV generation depends on the `moderncv` class ecosystem, while cover letters depend on the custom `cover.cls` and bundled OpenFonts.

## Frequently Asked Questions

### Why does the CV use LuaLaTeX instead of pdfLaTeX?

According to the `ai-job-search` source code, `pdflatex` frequently fails on modern MiKTeX installations when expanding `fontawesome5` fonts required by the `moderncv` document class. LuaLaTeX provides superior font handling capabilities that ensure consistent icon rendering across different platforms and TeX distributions.

### Can I switch the cover letter compiler to LuaLaTeX?

No. The custom `cover.cls` class explicitly requires XeLaTeX because it relies on `\RequirePackage{fontspec}` to load the bundled Lato and Raleway OpenType fonts from `cover_letters/OpenFonts/fonts/`. While LuaLaTeX technically supports `fontspec`, the repository's class structure and font path configuration are specifically validated for XeLaTeX compilation only.

### Where are the font files located for cover letters?

The Lato and Raleway font files are stored in `cover_letters/OpenFonts/fonts/`. These are accessed by `cover.cls` through `fontspec` commands when XeLaTeX processes the document, ensuring the custom typography renders correctly without requiring system-wide font installation on the build machine.

### How does the CI pipeline validate LaTeX compilation?

The [`.github/workflows/ci.yml`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.github/workflows/ci.yml) file defines separate jobs that execute `lualatex -interaction=nonstopmode -halt-on-error` on `cv/main_example.tex` and `xelatex` with identical flags on `cover_letters/cover_example.tex`. This automated validation ensures that template modifications or dependency updates do not break PDF generation in the pipeline.