It is still not quite clear why these local formats appear when updating, so there is no definitive solution so far. I will update this answer when the cause is found out; meanwhile these are the steps to solve the problem (which should occur at most when
l3kernel is updated, which is not that often):
First run from the command line:
kpsewhich --all --engine=pdftex pdflatex.fmt if you are using pdfLaTeX
kpsewhich --all --engine=luahbtex lualatex.fmt if you are using LuaLaTeX
kpsewhich --all --engine=xetex xelatex.fmt if you are using XeLaTeX
then look at the output. If you have two lines of output, looking like this:
then delete the file from the path that starts
/Users/<user>/Library if you're on Mac) and the problem should be gone!
The problem persists
If you are still getting the error:
- check if you are using the correct
kpsewhich call for the engine you are using;
- check that the output of the
kpsewhich call returns only one line;
- if you are using LaTeX-dev. then add
-dev to the
.fmt file in the
kpsewhich call, for example,
pdflatex-dev.fmt and check for the two lines as above;
If nothing works, read on.
Slightly longer version
This error message was intentionally added mid-2020 after
expl3 was integrated into the LaTeX kernel because it happens quite often that
tlmgr generates the local
.fmt file. This
.fmt file is not updated, thus frozen with an old version of LaTeX (with an old version of
expl3 preloaded), and then when you update, the two different versions are incompatible.
The error message says (along these lines):
! LaTeX3 Error: Mismatched LaTeX support files detected.
(LaTeX3) Loading 'expl3.sty' aborted!
(LaTeX3) The L3 programming layer in the LaTeX format
(LaTeX3) is dated 2021-02-18, but in your TeX tree the files require
(LaTeX3) at least 2021-05-11.
For immediate help type H <return>.
Which means that the
expl3 that different versions of
expl3 were detected. If you are running from the command line, you can type
H <enter> at the prompt above, then the error message may show two different texts, depending on some heuristics. By far the most common is:
The cause seems to be an old format file in the user tree.
LaTeX found these files:
Try deleting the file in the user tree then run LaTeX again.
which points to the two files I mentioned above (this error message is actually just a wrapper to that
It is possible, however, that the issue is not a stale format file. In this case, the error help for the error message will read:
The most likely causes are:
- A recent format generation failed;
- A stray format file in the user tree which needs to be removed or rebuilt;
- You are running a manually installed version of expl3.sty
which is incompatible with the version in LaTeX.
which are the likely causes for the problem. In order:
An error during format generation is very unlikely, but you can try running
fmtutil-sys --all (you may need
sudo depending how you installed TeX Live) and see if the output shows something suspicious;
The stray format is the issue described above, but depending how you run LaTeX (namely if you run with
-no-shell-escape), then it won't be able to run
You may have manually installed a newer version of
l3kernel instead of updating LaTeX. If that's what you want to do, then you have to copy the
l3kernel files to your local
TEXMF tree, then run
mktexfmt pdflatex (or
xelatex) to rebuild the LaTeX formats (or
fmtutil-sys --all to rebuild all). Rebuilding the formats will then pick up the changes to
l3kernel. Note that running
mktexfmt will create a local
.fmt file, so you might need to delete (or regenerate) that after an update.
1 Not really incompatible, but it would often lead to a dark path of debugging only to find that the problem was the stale
/Users/<user>/Library/texlive/2020/texmf-var/web2c/pdftex/pdflatex.fmt, perhaps run a
fmtutil-sys --all(sys not user!), and then never run fmutil-user again.
fmtutil-sys --all– sys not user :) – and when it was done, it said:
fmtutil [INFO]: log file copied to: /usr/local/texlive/2020/texmf-var/web2c/luatex/luatex.log fmtutil [INFO]: /usr/local/texlive/2020/texmf-var/web2c/luatex/luatex.fmt installed. TeX::LSR: ls-R file not writable, skipping: /usr/local/texlive/2020/texmf-var/ls-R Cannot write ls-R in /usr/local/texlive/2020/texmf-var. at /usr/local/texlive/2020/texmf-dist/scripts/texlive/mktexlsr.pl line 583.Do I need use
sysversion spewed out a lot more stuff this time, ending with
fmtutil [INFO]: disabled formats: 5 fmtutil [INFO]: successfully rebuilt formats: 54 fmtutil [INFO]: total formats: 59 fmtutil [INFO]: exiting with status 0, which looks better. Now all I have to do is wait for TeXLive to be updated so I can check that this has fixed it!