\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.
Recommended setup: LuaLaTeX with ltjsarticle
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
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, loadluatexja-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
- Ruby under XeLaTeX:
luatexja-rubyrequires LuaLaTeX. Under XeLaTeX (xeCJK), use thepxrubricapackage (\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, andxeCJKstop with a fatal error under pdfLaTeX (LuaTeX is requiredorFatal Package fontspec Error); switch to LuaLaTeX or XeLaTeX. - Using macOS- or Windows-only font names: Naming
Hiragino Mincho ProNorYu Minchobreaks compilation on Linux and cloud servers without those commercial fonts. UseHarano Aji Mincho,Noto Serif CJK JP, orIPAexMinchofor portable builds. - Loading
xeCJKunder LuaLaTeX:xeCJKis XeLaTeX-only; under LuaLaTeX,ltjsarticleloadsluatexja, and you loadluatexja-fontspecexplicitly for\setmainjfont. - Legacy
jsarticleoruplatextemplates: Classes like\documentclass{jsarticle}or\documentclass[uplatex]{jlreq}expectpLaTeXorupLaTeX. Where you can edit the template, port toltjsarticleor\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, aluatexja-*package (such asluatexja-ruby), or one of six classes:ltjsarticle,ltjsbook,ltjsreport,ltjarticle,ltjbook, orltjreport. - Auto selects XeLaTeX for the
xeCJKexample above. If you useltjtarticleorjlreq, 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, andIPAexGothic.
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.
