[Tex/LaTex] fontenc lualatex Undefined control sequence. \xdef\@fontenc@load@list{\@fontenc@load@list

font-encodingsluatexmiktex

I have a problem compiling with lualatex. I am using MikTex, and have completely uninstalled it, reinstalled, updated all packages, added other packages I use, and verified that both the admin and user packages are updated, manually updated all formats. Does anyone have a suggestion? I am only getting this problem with LuaLaTeX and MikTeX. I do not get the problem with TeXLive — but that is an older installation which I do not want to change until the MiKTeX installation works, so TeXLive might or might not work if upgraded. This is a recent failure. I compile with Unicode fonts, so I require either LuaLaTeX or XeLaTeX, but prefer LuaLaTeX (I have a different problem with XeLaTeX which is not relevant here). Thank you.

I get the message

!Undefined control sequence
l.115 \xdef\@fontenc@load@list{\@fontenc@load@list

when compiling with lualatex. I have narrowed it down to including the fontenc package (which I do not do directly, unicode-math does so). The test file is:

\documentclass{article}
\usepackage{fontenc}
\begin{document}
\end{document}

The log file is:

This is LuaTeX, Version 1.12.0 (MiKTeX 2.9.7300 64-bit)  (format=lualatex 2020.1.4)  1 MAR 2020 08:19
 restricted system commands enabled.
**test2.tex
(./test2.tex
LaTeX2e <2019-10-01> patch level 3
Lua module: luaotfload-main 2020-02-02 3.12 luaotfload entry point
Lua module: luaotfload-init 2020-02-02 3.12 luaotfload submodule / initializatio
n
Lua module: lualibs 2020-02-02 2.70 ConTeXt Lua standard libraries.
Lua module: lualibs-extended 2020-02-02 2.70 ConTeXt Lua libraries -- extended c
ollection.
Lua module: luaotfload-log 2020-02-02 3.12 luaotfload submodule / logging
Lua module: luaotfload-parsers 2020-02-02 3.12 luaotfload submodule / filelist
Lua module: luaotfload-configuration 2020-02-02 3.12 luaotfload submodule / conf
ig file reader
luaotfload | conf : Root cache directory is C:/Users/Administrator/AppData/Local
/MiKTeX/2.9/luatex-cache/generic-dev/names.
luaotfload | init : Loading fontloader “fontloader-2020-01-26.lua†from kpse
-resolved path “c:/bin/MiKTeX/tex/luatex/luaotfload/fontloader-2020-01-26.lua
â€.
Lua-only attribute luaotfload@state = 2
Lua-only attribute luaotfload@noligature = 3
Lua-only attribute luaotfload@syllabe = 4
luaotfload | init : Context OpenType loader version “3.11â€
Inserting `luaotfload.node_processor' at position 1 in `pre_linebreak_filter'.
Inserting `luaotfload.node_processor' at position 1 in `hpack_filter'.
Lua module: luaotfload-loaders 2020-02-02 3.12 luaotfload submodule / callback h
andling
Inserting `luaotfload.define_font' at position 1 in `define_font'.
Lua module: luaotfload-database 2020-02-02 3.12 luaotfload submodule / database
Lua module: luaotfload-unicode 2020-02-02 3.12 luaotfload submodule / Unicode he
lpers
Lua module: luaotfload-colors 2020-02-02 3.12 luaotfload submodule / color
Lua-only attribute luaotfload_color_attribute = 5
Lua module: luaotfload-resolvers 2020-02-02 3.12 luaotfload submodule / resolver
s
luaotfload | conf : Root cache directory is C:/Users/Administrator/AppData/Local
/MiKTeX/2.9/luatex-cache/generic-dev/names.
Lua module: luaotfload-features 2020-02-02 3.12 luaotfload submodule / features
Lua module: luaotfload-letterspace 2020-02-02 3.12 luaotfload submodule / color
Lua module: luaotfload-embolden 2020-02-02 3.12 luaotfload submodule / color
Lua module: luaotfload-notdef 2020-02-02 3.12 luaotfload submodule / color
Lua module: luaotfload-auxiliary 2020-02-02 3.12 luaotfload submodule / auxiliar
y functions
Inserting `luaotfload.aux.set_sscale_dimens' at position 1 in `luaotfload.patch_
font'.
Inserting `luaotfload.aux.set_font_index' at position 2 in `luaotfload.patch_fon
t'.
Inserting `luaotfload.aux.patch_cambria_domh' at position 3 in `luaotfload.patch
_font'.
Inserting `luaotfload.aux.fixup_fontdata' at position 1 in `luaotfload.patch_fon
t_unsafe'.
Inserting `luaotfload.aux.set_capheight' at position 4 in `luaotfload.patch_font
'.
Inserting `luaotfload.aux.set_xheight' at position 5 in `luaotfload.patch_font'.
Lua module: luaotfload-fallback 2020-02-02 3.12 luaotfload submodule / fallback
Lua module: luaotfload-multiscript 2020-02-02 3.12 luaotfload submodule / multis
cript
Lua module: luaotfload-script 2020-02-02 3.12 luaotfload submodule / Script help
ers
Lua module: luaotfload-tounicode 2020-02-02 3.12 luaotfload submodule / tounicod
e
Inserting `luaotfload.rewrite_fontname' at position 6 in `luaotfload.patch_font'
. (c:/bin/MiKTeX/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(c:/bin/MiKTeX/tex/latex/base/size10.clo
File: size10.clo 2019/12/20 v1.4l Standard LaTeX file (size option)
luaotfload | db : Font names database loaded from C:/Users/Administrator/AppData
/Local/MiKTeX/2.9/luatex-cache/generic-dev/names/luaotfload-names.luc)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(c:/bin/MiKTeX/tex/latex/base/fontenc.sty
Package: fontenc 2020/02/11 v2.0o Standard LaTeX package

! Undefined control sequence.
l.115 \xdef\@fontenc@load@list{\@fontenc@load@list

? x


Here is how much of LuaTeX's memory you used:
 427 strings out of 493864
 100000,106986 words of node,token memory allocated 346 words of node memory still in use:
   1 hlist, 1 rule, 1 dir, 3 kern, 1 glyph, 3 attribute, 44 glue_spec, 3 attribu
te_list, 1 write nodes
   avail lists: 2:8,3:1,4:1,5:2,7:2,9:3
 5202 multiletter control sequences out of 65536+200000
 15 fonts using 723367 bytes
 24i,0n,19p,131b,40s stack positions out of 5000i,500n,10000p,200000b,50000s

warning  (pdf backend): no pages of output.

PDF statistics: 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 131072)
 1 words of extra memory for PDF output out of 10000 (max. 100000000)

UPDATE: Here is the .log file using pdflatex. It is patch level 5.

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 2.9.7300 64-bit) (preloaded format=pdflatex 2020.3.1)  1 MAR 2020 23:21
entering extended mode
**./test2.tex
(test2.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-02-25> (c:\bin\MiKTeX\tex/latex/base\article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(c:\bin\MiKTeX\tex/latex/base\size10.clo
File: size10.clo 2019/12/20 v1.4l Standard LaTeX file (size option)
)
\c@part=\count167
\c@section=\count168
\c@subsection=\count169
\c@subsubsection=\count170
\c@paragraph=\count171
\c@subparagraph=\count172
\c@figure=\count173
\c@table=\count174
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen134
)
(c:\bin\MiKTeX\tex/latex/base\fontenc.sty
Package: fontenc 2020/02/11 v2.0o Standard LaTeX package
)
(c:\bin\MiKTeX\tex/latex/l3backend\l3backend-pdfmode.def
File: l3backend-pdfmode.def 2020-02-23 L3 backend support: PDF mode
\l__kernel_color_stack_int=\count175
\l__pdf_internal_box=\box45
) (test2.aux)
\openout1 = `test2.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info:    ... okay on input line 3.

(test2.aux) ) 
Here is how much of TeX's memory you used:
 572 strings out of 481311
 7697 string characters out of 2924405
 237403 words of memory out of 3000000
 16144 multiletter control sequences out of 15000+200000
 532338 words of font info for 24 fonts, out of 3000000 for 9000
 1141 hyphenation exceptions out of 8191
 25i,1n,19p,146b,36s stack positions out of 5000i,500n,10000p,200000b,50000s

No pages of output.
PDF statistics:
 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

Best Answer

This problem appears to be caused by the format file, lualatex.fmt, being in two places. One where it is being updated and another where it is not being updated. Unfortunately, the second location may be read first causing the formats to be out of sync. This situation may be caused by installing MiKTeX for both single user and for multiple users at different times. The format file will be regenerated automatically if it is not present.

The solution that worked for me was to find all instances of the lualatex.fmt file under c:\Users and remove them. I also found that other format files might be in more than one location, so the best bet would be to remove all format files either for the specific user (if installing for multiple users) or from all users (if installing for a single user). For me dvilualatex.fmt, xelatex.fmt, pdflatex.fmt and latex.fmt were also in two locations, but other format files were not. Except for the dvilualatex.fmt the others were not out of sync.

Just in case there are other issues, I will uninstall MiKTeX (again), but them remove anything remaining under c:\Users...\MiKTeX*. Then I will reinstall, update all packages, add in the extra packages that I use. I will then check to see if the formats need to be updated, and if so, update all formats.

That will take me a while, but if I discover anything new I will update this answer.

Update: I was careful to remove every trace of MiKTeX when I uninstalled. Then when I reinstalled, everything worked. There were no initial format files. When they were created, they were created in the c:\users\[user] directory and not in c:\users\all users directory. I did install for all users, and verified that in the console which said it was a "shared" installation.

That pretty much confirms (to me) that the problem lies in the failure of the uninstaller to completely remove every trace of the installation. That in turn leads to a reinstallation with different options causing conflicts.

The problem I had with XeLaTeX was my error (as I suspected) and not relevant to this problem.

Related Question