Problem
A document that sets monofontfallback (or mainfontfallback / sansfontfallback)
fails to compile with --pdf-engine=lualatex: LuaLaTeX crashes with attempt to index a nil value inside luaotfload, before any PDF is produced.
Reproduction
meta.yaml:
monofont: "Latin Modern Mono"
monofontfallback:
- "Latin Modern Roman"
echo 'Some `inline code`.' | pandoc --metadata-file meta.yaml -o doc.pdf --pdf-engine=lualatex
Result:
luaotfload | resolve : sequence of 3 lookups yielded nothing appropriate.
...luaotfload-fallback.lua:50: attempt to index a nil value (local 'f').
Error producing PDF.
The generated LaTeX contains:
\directlua{luaotfload.add_fallback("monofontfallback",{
"Latin Modern Roman"
})}
Cause
This traces to how luaotfload parses fallback names — confirmed by a luaotfload
maintainer in latex3/luaotfload#331. luaotfload appends a ;-fallback feature to
each name passed to add_fallback, and its font-name parser ends a name only at
:, ( or /. So a bare "Latin Modern Roman" absorbs the appended feature
(Latin Modern Roman;-fallback), the lookup fails, and the resulting nil is then
indexed. The fix confirmed in that thread is to terminate each fallback name with a
colon — "Latin Modern Roman:".
The template emits the name without a trailing colon here:
|
$for(mainfontfallback)$"$mainfontfallback$"$sep$,$endfor$ |
Environment
- pandoc 3.9.0.2 (latest release)
- TeX Live 2026, luaotfload 3.29
Related: #11252. Font fallback support was added in #9204.
Problem
A document that sets
monofontfallback(ormainfontfallback/sansfontfallback)fails to compile with
--pdf-engine=lualatex: LuaLaTeX crashes withattempt to index a nil valueinside luaotfload, before any PDF is produced.Reproduction
meta.yaml:Result:
The generated LaTeX contains:
Cause
This traces to how luaotfload parses fallback names — confirmed by a luaotfload
maintainer in latex3/luaotfload#331. luaotfload appends a
;-fallbackfeature toeach name passed to
add_fallback, and its font-name parser ends a name only at:,(or/. So a bare"Latin Modern Roman"absorbs the appended feature(
Latin Modern Roman;-fallback), the lookup fails, and the resultingnilis thenindexed. The fix confirmed in that thread is to terminate each fallback name with a
colon —
"Latin Modern Roman:".The template emits the name without a trailing colon here:
pandoc/data/templates/font-settings.latex
Line 12 in 239522c
Environment
Related: #11252. Font fallback support was added in #9204.