Skip to main content
To write a Japanese document in LaTeX, use LuaLaTeX with \documentclass{ltjsarticle} (from LuaTeX-ja). If you only need Japanese text inside an existing English document class such as article, use XeLaTeX with the xeCJK package. Do not use pdfLaTeX for new Japanese documents. Both workflows handle kanji, hiragana, and katakana in UTF-8 without legacy pLaTeX or upLaTeX. For furigana (ルビ), jump to Furigana (ruby) and vertical writing. ltjsarticle (along with ltjsreport and ltjsbook) is the LuaLaTeX port of the standard Japanese jsclasses. It applies Japanese line-breaking rules (kinsoku shori), inserts proper spacing between Japanese and Latin characters, and localizes headings (目次, 図, 表) and dates (\today).
lualatex-japanese.tex
Ready to use this syntax? Continue in the browser editor when you want to adapt the example in a real project.Open LaTeX Cloud Studio
Use \setmainjfont{...} and \setsansjfont{...} from luatexja-fontspec to choose Japanese serif (Mincho) and sans-serif (Gothic) fonts. For documents that follow the W3C Japanese Layout Requirements closely, \documentclass[lualatex]{jlreq} is another standard class built for LuaLaTeX.

Adding Japanese to an English class: XeLaTeX with xeCJK

When you are writing mostly in English—or working with a template that defines its own document class (article, report, or a journal class)—you do not need to switch to ltjsarticle. Compile with XeLaTeX, load fontspec and xeCJK, and assign a Japanese CJK font with \setCJKmainfont{...}.
xelatex-japanese.tex
For local XeLaTeX builds, check that Noto Serif CJK JP is installed; in LaTeX Cloud Studio, the Noto CJK families are supplied by the compiler image’s operating system.

Furigana (ruby) and vertical writing

To add furigana (ruby annotations, ルビ) in LuaLaTeX, load luatexja-ruby and write \ruby{base}{reading}. Separating both the base characters and readings with | aligns each kanji with its own reading instead of centering across the whole word.
japanese-ruby.tex
Two common variations for Japanese layouts:
  • Ruby under XeLaTeX: luatexja-ruby requires LuaLaTeX. Under XeLaTeX (xeCJK), use the pxrubrica package (\usepackage{pxrubrica} and \ruby{漢字}{かんじ}) instead.
  • Vertical writing (縦書き): Compile with LuaLaTeX and use \documentclass{ltjtarticle} or \documentclass[lualatex,tate]{jlreq} for top-to-bottom, right-to-left columns.

Common mistakes

  • Compiling with pdfLaTeX: ltjsarticle, luatexja, and xeCJK stop with a fatal error under pdfLaTeX (LuaTeX is required or Fatal Package fontspec Error); switch to LuaLaTeX or XeLaTeX.
  • Using macOS- or Windows-only font names: Naming Hiragino Mincho ProN or Yu Mincho breaks compilation on Linux and cloud servers without those commercial fonts. Use Harano Aji Mincho, Noto Serif CJK JP, or IPAexMincho for portable builds.
  • Loading xeCJK under LuaLaTeX: xeCJK is XeLaTeX-only; under LuaLaTeX, ltjsarticle loads luatexja, and you load luatexja-fontspec explicitly for \setmainjfont.
  • Legacy jsarticle or uplatex templates: Classes like \documentclass{jsarticle} or \documentclass[uplatex]{jlreq} expect pLaTeX or upLaTeX. Where you can edit the template, port to ltjsarticle or \documentclass[lualatex]{jlreq} and verify the layout.

In LaTeX Cloud Studio

LaTeX Cloud Studio compiles with TeX Live 2026 and sets each project’s LaTeX Engine to Auto (Recommended) by default:
  • Auto checks for LuaTeX-ja first and selects LuaLaTeX when your sources declare luatexja, a luatexja-* package (such as luatexja-ruby), or one of six classes: ltjsarticle, ltjsbook, ltjsreport, ltjarticle, ltjbook, or ltjreport.
  • Auto selects XeLaTeX for the xeCJK example above. If you use ltjtarticle or jlreq, switch LaTeX Engine to LuaLaTeX manually in project settings.
  • Preinstalled Japanese fonts in the compile environment include Harano Aji Mincho, Harano Aji Gothic, Noto Serif CJK JP, Noto Sans CJK JP, IPAexMincho, and IPAexGothic.
Limitation to note: LaTeX Cloud Studio provides pdfLaTeX, XeLaTeX, and LuaLaTeX, and does not offer pLaTeX or upLaTeX. If your journal requires pLaTeX or upLaTeX, use an environment that provides that engine. Ready to start a Japanese document in the browser? Start from the Basic Article template in LaTeX Cloud Studio and replace main.tex with whichever complete example above fits your setup.