Font & DB tools

These are not everyday commands — they are the maintenance tools that keep a TeX installation consistent. updmap and kanji-config-updmap manage *which fonts get embedded in the PDF*, while mktexlsr and fmtutil refresh the databases and precompiled formats TeX relies on. You reach for them after installing fonts or packages by hand, or when something “can’t be found.”

Maintenance tools fix finding, embedding, and startup

TeX maintenance becomes much clearer if you split failures into three layers. If a file you installed is not found, suspect the filename database. If a PDF embeds the wrong fonts, suspect the font maps. If an engine cannot load its .fmt at startup, suspect the format files. mktexlsr, updmap, and fmtutil repair those three layers respectively. Decide which layer is broken before running everything; that keeps shared machines and CI images predictable.

updmap — manage font maps

The DVI drivers (dvips, dvipdfmx) and pdftex learn the correspondence between a TeX font name and the actual font file — and how to embed it — from a font map. updmap regenerates that combined map from the enabled map files and options; you run it after enabling a new font’s map. updmap-sys acts on the system-wide configuration (needs admin rights); updmap acts on the per-user config, overriding the system one.

You write settings to updmap.cfg with --setoption KEY VALUE, and add or remove maps with --enable Map foo.map / --disable. Running updmap (or updmap-sys) afterward applies the changes. The practical rule is not to mix user and system settings. On shared machines or in CI, standardize on updmap-sys; reserve plain updmap for personal experiments. That avoids the “only one author gets different fonts” failure.

terminal
updmap-sys --enable Map myfont.map   # マップを有効化 / enable a map
updmap-sys                           # 合成マップを再生成 / regenerate the maps

kanji-config-updmap — pick the embedded Japanese font

The embedded font for Japanese (CJK) is decided at the dvi→pdf step (dvipdfmx). The easy way to choose it is kanji-config-updmap (texjporg): under the hood it sets updmap’s jaEmbed option (formerly kanjiEmbed), searching for common Japanese fonts and switching between them. Use status to see the current setting, auto to pick automatically, or pass a family name (e.g. ipaex, hiragino-pron, noto-otc) to switch to it.

terminal
kanji-config-updmap-sys status   # 現在の和文フォントを表示 / show the current font
kanji-config-updmap-sys ipaex    # IPAex フォントを埋め込む設定に / embed IPAex

mktexlsr / texhash — refresh the filename database

TeX uses the kpathsea library together with ls-R filename databases to locate files quickly within the large texmf trees. If you drop a file into a texmf tree by hand, TeX will not see it on its own. Rebuilding ls-R with mktexlsr (alias texhash) makes the new files findable.

terminal
mktexlsr        # ls-R を再構築(= texhash)/ rebuild ls-R (same as texhash)

fmtutil — rebuild the formats

Commands like pdflatex load a format file (.fmt, e.g. latex.fmt) at startup. It is a complete dump of the engine state right after loading the format (LaTeX, say), so the engine can start fast instead of re-reading everything from scratch. fmtutil regenerates these .fmt files. You use it after a change that affects a format, or when a .fmt is missing/corrupt and you get a “can’t find the format file” error. fmtutil-sys acts on the system trees; fmtutil --byfmt latex rebuilds one, and fmtutil-sys --all rebuilds them all. It is not something to run after every package install; treat it as a maintenance tool for engine-startup problems.

terminal
fmtutil --byfmt pdflatex   # pdflatex の .fmt を作り直す / rebuild just pdflatex
fmtutil-sys --all          # すべてのフォーマットを再生成 / rebuild every format

Choose the repair in order

  • If kpsewhich mypackage.sty cannot find a file, check where it was placed in TEXMF and whether mktexlsr is needed.
  • If only Japanese fonts in the PDF are wrong, first inspect the current jaEmbed with kanji-config-updmap-sys status.
  • If a newly installed Western font is wrong, check whether its .map was enabled with updmap-sys --enable Map ....
  • If the engine stops before startup with a missing-format message, rebuild just that format with fmtutil --byfmt.

When you need these

  • Installed a font by handupdmap (for Japanese embedding, kanji-config-updmap).
  • Dropped files or a package into texmf by handmktexlsr (texhash).
  • Changed something format-related / a .fmt brokefmtutil.
  • Normally the TeX Live manager tlmgr calls these for you — you only run them by hand for maintenance.