I18n
Set up multilingual, multi-script typesetting with polyglossia and fontspec under XeLaTeX. Use to add a language, configure fonts per script (Latin, Cyrillic, Greek, Arabic, Hebrew, CJK, Devanagari), handle RTL or CJK text, or fix font fallback. Triggers on "add a language", "write in Russian/Arabic/Chinese", "set up polyglossia", "right to left text", "i18n", "Serbian Cyrillic".From its SKILL.md
npx -y skills add igorilic/latex-agentic --skill i18nAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
5.7 KB, as published. Nobody here has run it
i18n
Configure a document for one or more languages and scripts using polyglossia
fontspecunder XeLaTeX. The arguments are the target languages (e.g.i18n russian arabicori18n serbian-cyrillic). If none are given, read thelanguagesarray from.latex-agentic.json, and ask the user which languages to add if it is empty.
The per-language recipes — preamble snippets, font candidate chains, sample
sentences, and gotchas — live in
${CLAUDE_PLUGIN_ROOT}/skills/i18n/references/languages.md. Read that file and
copy the relevant recipe for each requested language rather than improvising.
For involved multilingual layout work (mixed RTL/LTR runs, CJK line-breaking, font shaping problems), delegate to the i18n-typesetter agent.
Procedure
-
Resolve the language list. Combine the arguments with the existing
languagesarray from the contract:cat .latex-agentic.json 2>/dev/nullIdentify the primary (default) language and any secondary languages. For Serbian, clarify which script(s):
serbian-cyrillic,serbian-latin, or both — they need differentpolyglossiavariants and may use different fonts. -
Confirm XeLaTeX. This workflow requires the
xelatexengine (fontspec/polyglossiado not work under pdflatex). If.latex-agentic.jsonhas"engine": "pdflatex", advise switching toxelatexand update it (with the user's agreement). -
Load polyglossia and set languages. In the preamble, after
fontspec:\usepackage{fontspec} \usepackage{polyglossia} \setdefaultlanguage{<primary>} \setotherlanguage{<secondary-1>} \setotherlanguage{<secondary-2>}Use the polyglossia language names and options from the recipe — e.g.
[variant=...]for dialects ([variant=british]{english},[variant=monotonic]{greek}) and[script=...]where a language has multiple scripts (\setotherlanguage[script=cyrillic]{serbian}), or plain\setotherlanguage{arabic}. -
Configure fonts per script with explicit fallback chains. For each script in play, define a font family guarded by
\IfFontExistsTFso the document still compiles when the preferred font is absent. Prefer TeX Live-shipped fonts first, then Noto, then common OS fonts:- Latin / Cyrillic / Greek: CMU Serif → Noto Serif → DejaVu Serif.
- Arabic (and Persian/Urdu): Amiri → Noto Naskh Arabic → Scheherazade.
- Chinese (simplified): FandolSong → Noto Serif CJK SC → Source Han Serif.
- Japanese: HaranoAjiMincho → Noto Serif CJK JP.
- Korean: NanumMyeongjo → Noto Serif CJK KR.
- Hebrew: Noto Serif Hebrew → David CLM → Frank Ruehl CLM.
- Devanagari (Hindi): Noto Serif Devanagari → Shobhika → Lohit Devanagari.
The fallback pattern (one family per non-default script, paired to its polyglossia language via
\newfontfamily\<lang>font):\newfontfamily\arabicfont[Script=Arabic]{Amiri} % guarded variant: \IfFontExistsTF{Amiri} {\newfontfamily\arabicfont[Script=Arabic]{Amiri}} {\IfFontExistsTF{Noto Naskh Arabic} {\newfontfamily\arabicfont[Script=Arabic]{Noto Naskh Arabic}} {\newfontfamily\arabicfont[Script=Arabic]{Scheherazade New}}}Set the main document font from the primary language's recipe with
\setmainfont. Copy the exact\newfontfamilylines (includingScript=/Language=options) fromreferences/languages.md. -
Enable xeCJK when any CJK language is present. Load it (after fontspec, before polyglossia's CJK font setup) and set the CJK main font:
\usepackage{xeCJK} \setCJKmainfont{FandolSong} % or Noto Serif CJK SC, per recipe -
RTL load-order trap. For Arabic/Hebrew/Persian, do not load
bidimanually —polyglossialoads it last, in the correct position, on its own. Loadingbidi(orhyperrefafterbidiincorrectly) by hand causes the classic "bidi must be loaded last" / reversed-output errors. Just declare the RTL language with\setotherlanguageand switch with\begin{<lang>}...\end{<lang>}or\text<lang>{...}. Ifhyperrefis in the document, it still loads near the end but polyglossia's bidi coordination takes precedence — let polyglossia manage it. -
Switch languages in the body. Use environments for blocks and inline commands for short runs:
\begin{arabic}…\end{arabic} % block \textrussian{…} % inline -
Update the contract. Write the final language set back into
.latex-agentic.json'slanguagesarray (primary first), and ensure"engine": "xelatex". -
Test compile with a sample sentence per language. Insert each language's real sample sentence (from the recipe) into the body, then compile with the canonical command and confirm the script renders (no tofu boxes, correct direction):
latexmk -xelatex -interaction=nonstopmode -file-line-error "$MAIN"Inspect the resulting PDF (or the
.logfor missing-font / missing-glyph warnings). Remove the sample sentences afterward unless the user wants them kept. If a preferred font was unavailable, report which fallback was used and how to install the preferred one.