# Compilation Requirements for LaTeX CV and Cover Letters in the ai-job-search Repository

> Discover compilation requirements for LaTeX CV and cover letters. Use LuaLaTeX for CVs and XeLaTeX for cover letters to avoid font and icon errors in the ai-job-search repository.

- Repository: [Mads Lorentzen/ai-job-search](https://github.com/MadsLorentzen/ai-job-search)
- Tags: how-to-guide
- Published: 2026-08-28

---

**Compile the CV with LuaLaTeX and the cover letter with XeLaTeX to handle custom OpenType fonts and modern icon packages without errors.**

The ai-job-search repository provides ready-to-use LaTeX templates for job applications, but each document type demands specific compilation engines. Understanding these compilation requirements for LaTeX CV and cover letters ensures your documents render correctly with the intended typography and iconography. The templates rely on modern TeX engines to process system fonts and advanced packages that traditional pdfLaTeX cannot handle.

## Engine Requirements by Document Type

### CV Compilation with LuaLaTeX

The curriculum vitae template requires **LuaLaTeX** as its primary engine. According to the source code comments in `cv/main_example.tex` at lines 5-7, the document specifies: "Compile with: lualatex main_example.tex". LuaLaTeX handles the `fontawesome5` icon font used by the ModernCV class without triggering the font-expansion errors common when using pdfLaTeX on recent MiKTeX installations.

### Cover Letter Compilation with XeLaTeX

The cover letter mandates **XeLaTeX** due to strict `fontspec` dependencies. The header of `cover_letters/cover_example.tex` explicitly notes: "Compile with: XeLaTeX (cover.cls requires fontspec)". The custom class defined in `cover_letters/cover.cls` (lines 17-33) imports `fontspec` to load the Lato and Raleway font families from the `OpenFonts/` directory, making XeLaTeX non-negotiable.

## Required Packages and Fonts

### CV Dependencies

The CV relies on the `moderncv` document class alongside `inputenc`, `geometry`, and `import` packages. Critical to its visual design are the **Lato** and **Raleway** font families stored in the repository's `OpenFonts/` folder. The `fontawesome5` package provides social media and contact icons, which LuaLaTeX processes more reliably than pdfLaTeX.

### Cover Letter Dependencies

The cover letter uses a custom `cover.cls` class that automatically loads `fontspec`, `xltxtra`, `xunicode`, `geometry`, `hyperref`, `xcolor`, `titlesec`, and `textpos`. Lato serves as the heading font while Raleway handles body text. These OpenType fonts require the `fontspec` interface provided exclusively by XeLaTeX.

## Step-by-Step Compilation Commands

Follow these exact commands to generate PDFs from the source templates:

```bash

# Compile the CV (LuaLaTeX)

cd cv
lualatex -interaction=nonstopmode main_example.tex

# Output: main_example.pdf

```

```bash

# Compile the Cover Letter (XeLaTeX)

cd cover_letters
xelatex -interaction=nonstopmode cover_example.tex

# Output: cover_example.pdf

```

Both commands can be integrated into build scripts or Makefiles for automated workflows.

## Automated CI/CD Verification

The repository's continuous integration pipeline validates these compilation requirements through [`.github/workflows/ci.yml`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.github/workflows/ci.yml) (lines 148-158). The CI runs separate jobs for each document type, executing `lualatex` for the CV and `xelatex` for the cover letter. This ensures that any changes to the templates or dependencies maintain compatibility with the required engines.

## Summary

- **LuaLaTeX** is required for the CV to process `fontawesome5` icons and avoid font-expansion errors.
- **XeLaTeX** is mandatory for the cover letter due to `fontspec` usage in `cover.cls`.
- Both documents depend on **Lato** and **Raleway** fonts located in the `OpenFonts/` directory.
- Compilation commands are documented in source file comments and enforced via CI/CD pipelines.

## Frequently Asked Questions

### Why can't I use pdfLaTeX for these templates?

pdfLaTeX lacks native support for the `fontspec` package and modern OpenType font loading mechanisms. The cover letter's `cover.cls` explicitly requires `fontspec` to access system fonts, while the CV's `fontawesome5` icons trigger font-expansion errors under pdfLaTeX on recent TeX distributions.

### Where are the font files located?

The Lato and Raleway font families are stored in the `OpenFonts/` directory at the repository root. Both the CV and cover letter templates reference these paths relative to their document locations, ensuring consistent typography across both documents.

### How do I install the required LaTeX engines?

Install LuaLaTeX and XeLaTeX through a complete TeX distribution such as TeX Live (cross-platform) or MiKTeX (Windows/Mac). Both engines are included in the standard installation of modern TeX distributions, though you should verify they are accessible in your system PATH before compiling.

### Can I compile both documents with one command?

While each document requires a different engine, you can create a build script that runs both commands sequentially. The repository's CI workflow demonstrates this approach by executing `lualatex` for the CV and `xelatex` for the cover letter in separate but coordinated jobs.