# Which Compiler Is Used for Cover Letters in AI Job Search

> Discover why xelatex compiles AI Job Search cover letters. Learn how this LaTeX compiler uses fontspec for modern fonts like Lato and Raleway in custom classes.

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

---

**The AI Job Search repository uses `xelatex` to compile cover letters because the custom `cover.cls` class requires the `fontspec` package to load modern fonts like Lato and Raleway.**

The MadsLorentzen/ai-job-search project automates job application workflows, including the generation of tailored cover letters through LaTeX templates. Understanding which compiler is used for cover letters in AI Job Search ensures your local environment matches the repository's build pipeline and avoids font-related compilation errors.

## Why XeLaTeX Is Required for Cover Letters

The default cover letter template depends on `cover.cls`, a custom class file located at `cover_letters/cover.cls`. This class utilizes the `fontspec` package to embed system fonts (specifically Lato and Raleway), which mandates a Unicode-aware LaTeX engine. According to the source code analysis, `xelatex` is the designated compiler because it natively supports `fontspec` and modern font handling without requiring legacy font encodings.

### Documentation in SETUP.md

The setup guide explicitly states the compiler requirement. In [`SETUP.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/SETUP.md) (section covering LaTeX dependencies), the documentation notes that "the cover letter compiles with `xelatex` because `cover.cls` requires `fontspec`" (line 53). This file serves as the primary reference for environment configuration and dependency installation.

### The Cover Example Template

The minimal working example at `cover_letters/cover_example.tex` contains an inline comment confirming the build requirement: the file "must always compile with `xelatex`" (line 6). This template functions as the reference implementation and is used in continuous integration to validate the compilation pipeline.

## How to Compile Cover Letters Locally

To generate PDF cover letters that match the repository's output, you must invoke `xelatex` with non-interactive flags suitable for automation.

### Basic Compilation Command

From the repository root, execute:

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

```

The `-interaction=nonstopmode` flag prevents the compiler from halting on minor warnings, ensuring unattended builds complete successfully. This command produces a single-page PDF that respects the font specifications defined in `cover.cls`.

### Compiling Custom Cover Letters

For company-specific outputs generated by the application assistant:

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

```

The `-halt-on-error` option is recommended in CI environments to ensure that font loading failures or missing dependencies cause immediate build termination rather than incomplete PDF generation.

### CI/CD Validation

The GitHub Actions workflow at [`.github/workflows/ci.yml`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.github/workflows/ci.yml) enforces the compiler choice through automated smoke testing. Lines 154-157 execute `xelatex` against the example cover letter to verify that the template remains compilable after code changes:

```yaml
- name: Compile cover letter example (xelatex)
  run: |
    cd cover_letters
    xelatex -interaction=nonstopmode -halt-on-error cover_example.tex

```

This validation ensures that environment drift or font package updates do not break the cover letter generation pipeline.

## Custom Templates vs. Stock Templates

While the stock template strictly requires `xelatex`, the architecture supports alternative compilers for user-defined templates. According to [`.claude/skills/job-application-assistant/06-cover-letter-templates.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.claude/skills/job-application-assistant/06-cover-letter-templates.md), templates registered via the `/add-template` command may specify custom compile commands. However, the default implementation—which generates cover letters using the built-in `cover.cls`—always invokes `xelatex` to satisfy the `fontspec` dependency.

## Summary

- **XeLaTeX is required** for all stock cover letters due to the `fontspec` dependency in `cover_letters/cover.cls`.
- **Documentation is explicit** about this requirement in [`SETUP.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/SETUP.md) and inline comments within `cover_letters/cover_example.tex`.
- **CI pipelines validate** compilation using `xelatex` in [`.github/workflows/ci.yml`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.github/workflows/ci.yml) to ensure build integrity.
- **Local builds should mirror CI** by using `xelatex -interaction=nonstopmode` to avoid font loading errors.
- **Custom templates** may use alternative compilers, but the default workflow strictly enforces `xelatex`.

## Frequently Asked Questions

### Can I use pdfLaTeX instead of XeLaTeX for cover letters?

No. The stock `cover.cls` file requires the `fontspec` package to load the Lato and Raleway font families, which is incompatible with pdfLaTeX. Attempting to compile with `pdflatex` will result in fatal errors regarding font encoding and package loading.

### Where is the compiler requirement defined in the codebase?

The requirement appears in three critical locations: [`SETUP.md`](https://github.com/MadsLorentzen/ai-job-search/blob/main/SETUP.md) explains the technical dependency on `fontspec`, `cover_letters/cover_example.tex` contains a mandatory compilation comment, and [`.github/workflows/ci.yml`](https://github.com/MadsLorentzen/ai-job-search/blob/main/.github/workflows/ci.yml) enforces the requirement through automated smoke tests that execute `xelatex` against the example template.

### Does the repository support LuaLaTeX for cover letters?

While `fontspec` technically functions with LuaLaTeX, the repository specifically configures, tests, and validates with `xelatex`. Using LuaLaTeX may produce valid output but is not verified in the continuous integration pipeline and may behave differently regarding font rendering.

### How do I compile a cover letter if I modified the default template?

If you maintain a custom template that does not rely on `fontspec`, you can specify an alternative compiler during the build process. However, if your modifications still utilize `cover_letters/cover.cls`, you must continue using `xelatex` to ensure the modern font packages load correctly and the output matches the expected single-page format.