# TexLive Compilers **LaTeX has several compilers**, each with different capabilities and output. The most common are `pdflatex`, `xelatex`, and `lualatex`. They all read `.tex` files and produce output (PDF by default). **pdflatex** is the standard compiler. It's fast, stable, and widely supported. It directly produces PDF output and is best for most documents. ```bash pdflatex document.tex ``` pdflatex uses traditional TeX fonts (Computer Modern) and font encoding (8-bit). Non-Latin characters and modern font formats require extra setup. It's the most conservative but most portable choice. **xelatex** uses Unicode natively and supports modern system fonts (TrueType, OpenType). Better for non-Latin scripts, custom fonts, and internationalization. ```bash xelatex document.tex ``` The `.tex` file remains the same; just compile with `xelatex` instead. You can use any font installed on your system: ```latex \usepackage{fontspec} \setmainfont{DejaVu Serif} \setsansfont{DejaVu Sans} ``` xelatex is slower than pdflatex but handles modern fonts and Unicode naturally. **lualatex** is like xelatex but uses Lua scripting for extensibility. It's newer and less widely used but powerful for complex document generation. ```bash lualatex document.tex ``` **Comparison:** | Feature | pdflatex | xelatex | lualatex | |---------|----------|---------|----------| | Speed | Fast | Slow | Slow | | Unicode | Limited | Yes | Yes | | System fonts | No | Yes | Yes | | Stability | Very stable | Stable | Newer | | Use case | General | International, custom fonts | Advanced scripting | **When to use each:** Start with `pdflatex` for simple documents. If you need custom fonts or non-Latin scripts, switch to `xelatex`. Use `lualatex` only if you need Lua scripting. **Output format:** All three produce PDF by default. To generate DVI (device-independent format) instead, use `pdftex -output-format=dvi document.tex` (rare nowadays). PostScript output (`dvips`) is mostly obsolete. **Compilation chain with BibTeX:** ```bash pdflatex main.tex # first pass bibtex main # extract citations pdflatex main.tex # second pass pdflatex main.tex # third pass (resolve references) ``` The same process works for all three compilers. BibTeX works the same way regardless. **Font caching:** xelatex and lualatex cache fonts. Clear the cache if you install new fonts: `rm -rf ~/.cache/fontconfig` (Linux), then recompile.