Skip to content

Compile Module Reference

Purpose: Diagnose and fix compilation issues in Chinese LaTeX thesis projects.

Compiler Selection

CompilerBest ForCommand
XeLaTeXChinese documents, Unicode, system fontslatexmk -xelatex main.tex
LuaLaTeXModern features, Lua scripting, future-proofinglatexmk -lualatex main.tex
pdfLaTeXEnglish-only papers (poor CJK support)latexmk -pdf main.tex

latexmk Configuration

Create .latexmkrc in project root:

perl
$pdf_mode = 5;  # xelatex
$xelatex = 'xelatex -interaction=nonstopmode -no-shell-escape %O %S';
$bibtex_use = 2;
$biber = 'biber %O %S';

Enable -shell-escape only for sources you have explicitly verified as trusted.

Common Issues

ProblemSolution
Chinese font not foundSpecify fonts: \setCJKmainfont{SimSun}[BoldFont=SimHei]
Missing packagetlmgr install <package-name>
Bibliography not updatinglatexmk -C main.tex && latexmk -xelatex main.tex

Watch Mode

bash
latexmk -xelatex -pvc main.tex  # auto-recompile on changes

Full details: see ../latex/compilation.md

Released under the MIT License.