LaTeX Windows Local Fix Skill
Diagnose and fix LaTeX compilation issues on Windows (TeX Live 2025).Environment Facts
- TeX Live 2025 binary path:
C:\texlive\2025\bin\windows\xelatex.exe - TeX Live is NOT in PATH by default on this machine
- CJK fonts available:
Microsoft YaHei(msyh.ttc),Noto Sans SC(NotoSansSC-VF.ttf) - Shell: bash (Git Bash / Claude Code) — use forward slashes or quoted Windows paths
- PDF viewer lock: xdvipdfmx cannot overwrite a PDF open in Adobe Acrobat; SumatraPDF does not lock
Compile Command
Always use the full path:Common Errors & Fixes
1. xelatex.exe not found / “无法执行命令”
Cause: TeX Live bin directory not in system PATH.
Fix A — permanent (run PowerShell as admin):
Options → Configure TeXstudio → Commands → XeLaTeX
Set to: C:/texlive/2025/bin/windows/xelatex.exe -synctex=1 -interaction=nonstopmode %.tex
Fix C — VS Code LaTeX Workshop (settings.json):
2. xdvipdfmx:fatal: Unable to open "file.pdf" / Broken pipe
Cause: The output PDF is open in a PDF viewer (Adobe Acrobat locks the file).
Fix: Close the PDF viewer, then recompile.
Permanent fix: Switch to SumatraPDF — it does not lock PDF files and supports hot-reload.
TeXstudio: Options → Configure → Viewer → External viewer → set SumatraPDF path.
3. Font shape 'TU/lmr/bx/sc' undefined / scshape warning
Cause: \scshape used with a CJK font (Microsoft YaHei has no small-caps variant).
Fix: Remove \scshape from headings and \titleformat:
4. \footskip is too small (0.0pt)
Cause: \usepackage[empty]{fullpage} sets footskip to 0.
Fix: Add after the margin adjustments:
5. Font shape 'TU/MicrosoftYaHei/m/it' undefined
Cause: \textit{} applied to CJK text — Microsoft YaHei has no italic variant.
Fix: Remove \textit wrappers from \resumeSubheading subtitle rows:
6. Text overlap below \resumeSubSubheading{Stack: ...}{}
Cause: \resumeSubSubheading ends with \vspace{-7pt}, stacking on top of \resumeItemListEnd’s \vspace{-5pt} = −12pt total, pulling the next entry up.
Fix: Replace Stack lines with a custom \resumeStack command:
7. Noto Sans CJK SC not found
Cause: Full CJK variant not installed; only Noto Sans SC (variable font) is present.
Fix: Use Microsoft YaHei instead:
Noto Sans CJK SC (pre-installed there).
8. Section title text overlap (\textnormal{\small(...)} in \section{})
Cause: Nested font commands inside \section{} interact with \titlerule \vspace{-5pt}.
Fix: Use \normalfont\small inline, and reduce the after-rule vspace:
CJK Font Setup (XeLaTeX)
File Writing Rules
- Never use bash heredoc for Chinese content — shell encoding pipeline corrupts UTF-8 CJK characters
- Always write
.texfiles with the Write/Edit tools (guaranteed UTF-8) - Never use
sed -ion Windows bash for multi-line replacements — it can zero-out the file; use Edit tool instead
Workflow for This Project
Current CV files:- Source:
C:\Users\29711\AppData\Local\Temp\cv_latex_en.tex(master copy) - Source:
C:\Users\29711\AppData\Local\Temp\cv_latex_zh.tex - Output:
D:\OneDrive\Desktop\CV-DarrrnPig-HongBird2026-LaTeX-EN.tex(copy for compilation) - Output:
D:\OneDrive\Desktop\CV-DarrrnPig-HongBird2026-LaTeX-ZH.tex