Pandoc error “Unicode character … not set up for use with LaTeX” (Chinese, Japanese, Korean)

Quick answer

Pandoc uses pdflatex by default, and pdflatex has no CJK support, so the first Chinese, Japanese or Korean character stops the build. Use --pdf-engine=xelatex with -V CJKmainfont="<a CJK font>". Pick a font that covers your language: Microsoft YaHei has no Hangul, so Korean disappears silently.

The error, reproduced

$ pandoc test.md -o out.pdf
Error producing PDF.
! LaTeX Error: Unicode character 学 (U+5B66)
               not set up for use with LaTeX.

Reproduced with Pandoc 3.5 and MiKTeX 25.12 (pdfTeX 4.23) on the benchmark test file.

Why it happens

pdflatex works with 8-bit fonts and only knows characters that a loaded LaTeX package maps to a glyph. CJK ideographs are not mapped by default. xelatex and lualatex read Unicode directly and use system (OpenType) fonts, so they can typeset CJK once a font with those glyphs is selected.

Convert a Chinese document without installing anything

Open a Chinese sample

Fix: xelatex with a CJK font

pandoc input.md -o output.pdf \
  --pdf-engine=xelatex \
  -V CJKmainfont="Noto Sans CJK SC"
  • Tested: the same command with -V CJKmainfont="Microsoft YaHei" on Windows (Pandoc 3.5, XeTeX 4.16) built the Chinese and Japanese text correctly.
  • Use a font that is installed: list them with fc-list :lang=zh family (Linux/macOS with fontconfig) or check the Fonts settings on Windows.
  • Match the font to the language: SC for Simplified Chinese, TC for Traditional, JP for Japanese, KR for Korean. A Chinese font draws some Japanese kanji in Chinese forms; see wrong Han glyph forms.
  • Korean needs Hangul glyphs. In our test, CJKmainfont="Microsoft YaHei" produced a PDF without errors, but the Korean line was missing. Use Malgun Gothic, Noto Sans CJK KR or another Korean font.
  • Windows: "Microsoft YaHei" (Simplified Chinese), "Yu Gothic" (Japanese), "Malgun Gothic" (Korean). macOS: "PingFang SC", "Hiragino Sans", "Apple SD Gothic Neo".

Pitfalls we hit

  • xelatex without a font does not fail. Without CJKmainfont, xelatex finished and wrote a PDF in which every CJK line was blank. Always open the PDF.
  • Mixed documents. Our test file also contains Persian with zero-width non-joiners (U+200C). With CJKmainfont set, Pandoc 3.5’s template stopped with ! Missing control sequence inserted … \protected\def ^^^^200c. A file with only CJK text worked.
  • Arabic, Hindi, Bengali need their own fonts and script settings; see Arabic and Persian and Bengali and Hindi conjuncts.

Not up for TeX?

MarkPDF converts Markdown to PDF in the browser with Noto fonts for CJK and other scripts, no TeX install needed. It has no LaTeX features (cross-references, bibliographies), so keep Pandoc for those.

Frequently asked questions

Can I keep pdflatex?

Only with extra packages such as CJKutf8 and manual markup around CJK text. Switching to xelatex or lualatex is simpler and handles fonts directly.

xelatex or lualatex?

Both work with fontspec fonts. With Pandoc, xelatex plus CJKmainfont is the most common setup; lualatex uses the luatexja package for Japanese typesetting rules.

The PDF builds but some characters are missing. Why?

The chosen font lacks those glyphs (for example Hangul in a Chinese font). Pick a font for that language or a pan-CJK font such as Noto Sans CJK.

Related guides