8

Background

I updated my TeX Live installation on my Mac a while ago and got the error

LaTeX3 Error: Mismatched LaTeX support files detected.

I found a solution at Mismatched LaTeX support files detected. As far as I understand it (which isn't very far), there are system formats and local formats, and TeX Live is updating the wrong one. The fix is to update the formats.

Using fmtutil-user --all worked for me. It spewed out a load of stuff, then output

fmtutil [INFO]: log file copied to: /Users/<user>/Library/texlive/2020/texmf-var/web2c/luatex/dvilualatex.log
fmtutil [INFO]: /Users/<user>/Library/texlive/2020/texmf-var/web2c/luatex/dvilualatex.fmt installed.

I don't know what this tells me, but my TeX Live preferences has TeX programs set at /Library/TeX/texbin, which seems to be a link to /usr/local/texlive/2020/bin.

Problem

Every time I update TeX Live, I have to apply the solution again.

Question

Is there a way to make TeX Live use the correct formats permanently so that I don't have to keep running fmtutil-user --all after every TeX Live update?


Extra information

The original solution has a comment by Ulrike Fischer to

check if you have some local formats around which hide the system formats. (with eg kpsewhich --all --engine=pdftex pdflatex.fmt)

When I did that, it output

/Users/<user>/Library/texlive/2020/texmf-var/web2c/pdftex/pdflatex.fmt
/usr/local/texlive/2020/texmf-var/web2c/pdftex/pdflatex.fmt

but I don't know what that's telling me.

4
  • 2
    Try to delete the formats in /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. Commented Mar 3, 2021 at 12:08
  • @UlrikeFischer Thanks. I put all those format files in the bin, then ran 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 sudo? Commented Mar 3, 2021 at 12:33
  • yes you need sudo if you originally installed the system one under sudo Commented Mar 3, 2021 at 12:36
  • @DavidCarlisle Thank you. I used the installer to install it, so I'm not sure – although I did have to input my password, so I guess the installer was using sudo. The sys version 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! Commented Mar 3, 2021 at 12:47

1 Answer 1

13
+50

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):

TL;DR

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:

/home/<user>/.texlive2021/texmf-var/web2c/pdftex/pdflatex.fmt
/usr/local/texlive/2021/texmf-var/web2c/pdftex/pdflatex.fmt

then delete the file from the path that starts /home/<user>/.texlive<year> (or /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[1].

The error message says (along these lines):

! LaTeX3 Error: Mismatched LaTeX support files detected.
(LaTeX3)        Loading 'expl3.sty' aborted!
(LaTeX3)        
(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>.
 ...                                              
                                                  
l.77      \ExplLoaderFileDate{expl3.sty}}
                                         %
?

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:
 - /home/<user>/.texlive2021/texmf-var/web2c/pdftex/pdflatex.fmt 
 - /usr/local/texlive/2021/texmf-var/web2c/pdftex/pdflatex.fmt 
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 kpsewhich call).

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 kpsewhich;

  • enter image description here 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 lualatex 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 .fmt file.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .