Tx · LaTeX & TikZ

How to Fix “Mismatched LaTeX Support Files Detected”

Published By the 9to5Science editorial team

At a glance

  1. 1. Identify the mismatch

    The LaTeX format and the expl3 support files being loaded are probably from different versions or installations.

  2. 2. Check file locations

    Use kpsewhich to see which copies of the relevant files your TeX installation finds.

  3. 3. Update consistently

    Update LaTeX and its packages using the package manager for the installation you actually use.

  4. 4. Refresh formats

    If the warning remains, rebuild the formats and confirm that no older installation is taking precedence.

The message “Mismatched LaTeX support files detected” is a version-consistency error, not usually a problem in the document itself. It means that LaTeX has loaded a format or support file that does not match the version of another LaTeX or expl3 file it is using.

The usual fix is to update the TeX installation that actually compiles your document, then rebuild its formats if necessary. If the message persists, look for an older or second TeX installation whose files are taking precedence.

What the message means

LaTeX runs using a prebuilt format. Commands such as pdflatex, xelatex, and lualatex run an engine with a prebuilt LaTeX format. That format is created from LaTeX kernel code. Packages and support files—including files from the LaTeX3 programming layer, expl3—are then found on the system when the document is compiled.

These components need to be compatible. A partial update can leave a new expl3 file beside an older format, or leave new kernel files beside old support files. The same problem can happen if one TeX installation supplies the executable and format while another supplies packages through the file search path.

This is why changing your document source, removing an unrelated package, or suppressing the error is unlikely to solve the underlying problem. The installation needs to be made consistent.

Check which files are being used

If you have a Kpathsea-based TeX system, such as TeX Live, open a terminal and run:

kpsewhich -all expl3.sty
kpsewhich -all expl3-code.tex
kpsewhich -all latex.ltx

The -all option lists every matching copy that the search path can find. Multiple results are not automatically an error, but they are worth investigating—especially if the paths belong to different TeX Live releases, a system installation and a personal installation, or old manually installed files.

Also check which engine is running:

which pdflatex
pdflatex --version

On Windows, use where pdflatex in Command Prompt or where.exe pdflatex in PowerShell instead of which. If you use XeLaTeX or LuaLaTeX, check that engine as well. An editor may be configured to run a different executable from the one found in your terminal, so inspect the editor’s compiler settings too.

Update the active TeX installation

Use the package manager belonging to the installation identified above. Do not update one TeX installation and then compile with an engine from another.

  • TeX Live installed with its own installer: update the installation with tlmgr, for example tlmgr update --self --all. Administrative or system-wide installations may require the appropriate elevated privileges.
  • TeX Live installed by a Linux distribution: update it through that distribution’s package manager. Avoid mixing distribution-managed TeX files with an independently managed tlmgr installation.
  • MiKTeX: use MiKTeX Console to check for updates. If you have both user and administrator installations, update the one used by your compiler; packages or formats may need updating in both modes if both are in use.

After updating, close and reopen your editor or terminal so it does not keep using an old process or configuration. Then compile a small test document.

Rebuild formats if the mismatch remains

If the files have been updated but the error continues, the prebuilt format may not have been regenerated. For TeX Live, the system-wide and user-level commands are typically:

fmtutil-sys --all
fmtutil-user --all

Use the command appropriate to how TeX Live is installed; a user normally cannot rebuild system formats without administrative permission. In MiKTeX, use the format-update or format-building tasks in MiKTeX Console. Menu names can vary between versions.

Rebuilding formats is a follow-up step, not a substitute for updating mismatched files. If it fails, check the update log and resolve that error first.

Worked example: two TeX Live installations

Suppose kpsewhich -all expl3-code.tex prints a file under /usr/local/texlive/2024/, followed by a file under /usr/share/texlive/. Meanwhile, which pdflatex points to /usr/bin/pdflatex. The executable is likely associated with the distribution-managed installation, but an environment setting or search-path configuration may be allowing it to find a file from the separate /usr/local installation first.

Choose the installation you intend to use. Then make the executable, format, and support files all come from that installation. For example, use the distribution’s package manager and remove or correct the conflicting path configuration if you intend to use /usr/bin/pdflatex. If you intend to use the independent TeX Live installation, configure your editor and shell to use its executable and files consistently. Rerun the kpsewhich checks afterward to verify the paths.

Do not fix this example by copying one support file over another. The files belong to a versioned set, and replacing only one can create a different mismatch.

Common mistakes

  • Updating only the package named in the error: the mismatch may involve the LaTeX format, the kernel, or other support files, so update the complete active distribution.
  • Using tlmgr on a distribution-managed TeX Live: this can mix files managed by different tools. Use the operating system’s package manager when that is how TeX Live was installed.
  • Rebuilding formats before completing updates: a rebuilt format can still be incompatible with outdated support files.
  • Editing the document to hide the message: the error identifies a TeX installation inconsistency; document-level workarounds can conceal it without correcting it.
  • Assuming the terminal and editor use the same engine: verify the executable and configuration used by the actual compile command.

References

  1. The LaTeX2e Sources
  2. TeX Live Guide
  3. MiKTeX Documentation

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.