forum icon indicating copy to clipboard operation
forum copied to clipboard

问题求助:“ LaTeX3 Error: Mismatched LaTeX support files detected.”

Open chwang297635 opened this issue 2 years ago • 11 comments

检查

  • [ ] 已在 issues 中进行搜索(包括已关闭的问题)

编译环境

  • 操作系统
    • [x] Windows 11
  • TeX 发行版
    • [x] TeX Live

描述问题

1. 使用tlmgr更新宏包之后,出现上述错误。据查,“此错误消息是在集成到LaTeX内核后故意在2020年中期添加的,因为它经常发生,从而生成本地文件。此文件不会更新,因此使用旧版本的LaTeX(预加载旧版本)冻结,然后在更新时,两个不同的版本不兼容”;
2. 编译最小实例文档后可以复现此问题;
3. 已尝试搜索该问题,详见链接,然并不能解决问题,故求助。

-->

最小工作示例(MWE)

\documentclass[UTF8,fontset=windows]{ctexart}
\begin{document}
    你好 \LaTeX{} 世界!
\end{document}

(用 XeLaTeX 编译后)输出

! 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 2022-02-24.

For immediate help type H <return>.
 ...

l.77      \ExplLoaderFileDate{expl3.sty}}
                                         %
?

根据提示键入H之后,得到如下信息: 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.

LaTeX will abort loading the incompatible support files but this may lead to later errors. Please ensure that your LaTeX format is correctly regenerated.

链接

  • TeX.SX:https://tex.stackexchange.com/questions/585664/how-to-solve-mismatched-latex-support-files-problem-permanently
  • GitHub:

chwang297635 avatar Apr 02 '22 12:04 chwang297635

这个问题出现的好频繁, 我遇见过好多次了, 是在更新的时候编译了吗?

syvshc avatar Apr 02 '22 13:04 syvshc

安装TeXLive之后是可以用XeLaTeX正常编译的,然而用tlmgr更新所有宏包之后就出现错误了。

chwang297635 avatar Apr 02 '22 14:04 chwang297635

  • TeX.SX:https://tex.stackexchange.com/questions/585664/how-to-solve-mismatched-latex-support-files-problem-permanently

根据问题里提到的,执行 fmtutil-user --all 重新生成 fmt 文件呢。可能需要管理员权限。怀疑此类问题由执行 tlmgr update 时的权限不足导致。

这个 tex-sx 里描述的问题是,「每次更新 kernel 相关,fmt 都不会重新生成」。现在在 texlive 2022 锁版期间,没法验证你的情况是不是和它相同。可以等以后有更新后再确认。

理论上现在仍然是可以验证的,比如我上传一个旧版本的 latex(latex.r61041.tar.lz4),甚至你本地就有备份(执行 tlmgr restore <pkg name> 查看,例如 tlmgr restore latex)。

muzimuzhi avatar Apr 02 '22 20:04 muzimuzhi

感谢回复。然而我运行fmtutil -sys --all问题没有得到解决。链接中提到的“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.”应该怎么操作呢?我下载了最新版本的l3kernel宏包,没有出现问题的expl3.sty文件,该如何编译得到呢?

chwang297635 avatar Apr 03 '22 02:04 chwang297635

不要按照这个评论去操作


then you have to copy the l3kernel files to your local TEXMF tree

我没有如此操作过,我只能说一下我的理解,当然,我建议你尝试一下,毕竟 2022 快出了(

你需要在 https://ctan.org/pkg/l3kernel 上下载 l3kernel.tds.zip 文件

image

然后把它解压,放在 texlive/texmf-local/ 路径下,相同的文件夹会直接合并

or fmtutil-sys --all to rebuild all

然后再运行 fmtutil-sys -all 来重建格式文件。

syvshc avatar Apr 03 '22 03:04 syvshc

想问一下 @muzimuzhi 这里建议使用 fmtutil-user --all 而不是 -sys 是为什么呢,这会涉及到权限的问题吗?

syvshc avatar Apr 03 '22 03:04 syvshc

@syvshc 感谢!但是为什么要放在texlive/texmf-local/路径下?我看了下这个文件夹的子文件夹都是空的。我的理解是用下载之后的文件替换texlive\2021\texmf-dist\tex\latex\l3kernel,不知道是不是我理解有误。 image image

chwang297635 avatar Apr 03 '22 04:04 chwang297635

不要按照这个评论操作


@syvshc 感谢!但是为什么要放在texlive/texmf-local/路径下?我看了下这个文件夹的子文件夹都是空的。我的理解是用下载之后的文件替换texlive\2021\texmf-dist\tex\latex\l3kernel,不知道是不是我理解有误。

如果你没有处理过 local 文件夹,那它就是空的,texlive 中 local 的权限比 texmf-dist 的权限高,目的是用 local 的文件来生成新的格式文件,所以还是放到 texmf-local

syvshc avatar Apr 03 '22 04:04 syvshc

你需要在 https://ctan.org/pkg/l3kernel 上下载 l3kernel.tds.zip 文件

@syvshc 不到万不得已,不要、不要手动下载、安装。装到 texmf-local,会让之后的更新通通失效。

链接中提到的“You may have manually installed a newer version of l3kernel instead of updating LaTeX. [...]”

@chwang297635 为什么挑出了最不推荐直接阅读的一段……这一段以 Z 字路牌开始,它意味着

don’t read the paragraph unless you need to The TeXbook, Preface

试试 https://tex.stackexchange.com/q/576918 评论区的建议

muzimuzhi avatar Apr 03 '22 07:04 muzimuzhi

不到万不得已,不要、不要手动下载、安装。装到 texmf-local,会让之后的更新通通失效。

抱歉, 我没有点开链接亲自查看内容.

但是我刚才解决了一个相同的报错, 在这里记录一下解决的过程, 提供一个可能的解决方案.

首先手动运行 fmtutil-sys --byengine pdftex, 或者去 /texlive/2021/texmf-var/web2c/pdftex 查看 log 文件. [^pdftex] 看到了一些形如

[^pdftex]: 这里不必是 pdftex, 在重建的过程中, 哪个引擎出问题了就去哪里看.

! I can't find file `dehypht-x-2021-02-26.tex'.                                                                         
\addlanguage ...me =#5 \uselanguage {#1}\input #2 
\if *#3*\else \input #3 \f... 
l.32 ...1-02-26}{dehypht-x-2021-02-26.tex}{}{2}{2}

看起来是一个文件没有找到, 但是我在路径里发现了 C:\texlive\2021\texmf-dist\tex\generic\dehyph-exptl\dehypht-x-2022-03-16.tex, 但是fmtutil 缺在找一个旧版的文件, 那多少是有点问题.

然后我找到了这个 comment: https://github.com/termux/termux-packages/issues/3830#issuecomment-493765032 , 然后我使用

tlmgr install collection-langgerman -reinstall

来重新安装了这个集合 (或许只重装 dehyph-exptl 这个宏包也可以?), 再运行 fmtutil-sys -all 就不再用错误了.

syvshc avatar Apr 03 '22 09:04 syvshc

根据问题里提到的,执行 fmtutil-user --all 重新生成 fmt 文件呢。可能需要管理员权限。怀疑此类问题由执行 tlmgr update 时的权限不足导致。

我刚刚解决一个执行 fmtutil-user --all 可以解决的, 看来真的是权限问题, 这个问题是在安装的时候权限选择不当造成的吗?另外在运行完后有如下提示:

*************************************************************
*                                                           *
* WARNING: you are switching to fmtutil's per-user formats. *
*         Please read the following warnings!               *
*                                                           *
*************************************************************

You have run fmtutil-user (as opposed to fmtutil-sys) for the first time;
this has created format files which are local to your personal account.

From now on, any changes in system formats will *not* be automatically
reflected in your files; furthermore, running fmtutil-sys will no longer
have any effect for you.

As a consequence, you yourself have to rerun fmtutil-user after any
change in the system directories. For example, when one of the LaTeX or
other format source files changes, which happens frequently.
See https://tug.org/texlive/scripts-sys-user.html for details.

If you want to undo this, remove the files mentioned above.

Run fmtutil --help for full documentation of fmtutil.

它的意思是我在之后每次更新宏包都需要手动运行 fmtutil-user --all 来重建格式文件吗?

syvshc avatar Apr 20 '22 06:04 syvshc