I just upgraded to MacTeX 2021 and now nothing that uses my custom LaTeX class complies any more. The cause appears to be that when you load a file and there are two possibilities with the same name, it now prefers the "local" one instead of the one in the "central" texmf, whereas in the past it has always been the reverse.

A minimal example is create two files, one in a subdirectory:

test.tex prob/article.cls

where test.tex is

Some text

and prob/article.cls is:


Then pdflatex test.tex works fine with TeXLive 2020 and earlier but not TeXLive 2021, where I get:

This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
LaTeX2e <2020-10-01> patch level 4
L3 programming layer <2021-02-18> (./prob/article.cls
Document Class: prob/article WTF edition
) (/usr/local/texlive/2021/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def)

! LaTeX Error: The font size command \normalsize is not defined:
               there is probably something wrong with the class file.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
l.2 \begin{document}

In retrospect, having files with same names as ones in the standard library was asking for trouble, but is this new behavior intensional and is there any way to turn it off? The with either version of TeXLive, kpsewhich -all article.cls gives the same output (in particular, the files come in the same order).

  • you will have to rename your class. You have already loaded article.cls and latex will not load it again. – Ulrike Fischer Apr 28 at 17:12
  • This already fails with TL 2020 – egreg Apr 28 at 17:21
  • It was a deliberate change because LaTeX identifies package options by the name, supporting two files with the same name in different folders was at least tricky. You can make your document work by “un-loading article.cls” inside your prob/article.cls by using something like this, but you really shouldn't: use a different name – Phelype Oleinik Apr 28 at 17:28
  • @PhelypeOleinik Looks like an answer to me – Joseph Wright Apr 28 at 17:34
  • @egreg It definitely works for me with TL 2020, but I don't update the packages periodically; a colleague who does so reported the failure to me with TL 2020. – Nathan Dunfield Apr 28 at 17:39

This was a deliberate change because LaTeX identifies package options by the name, so supporting two files with the same name in different folders was at least tricky. In your case you have two very different article.cls which won't clash. However it also happens that people have local copies of LaTeX packages, so something like:


would fail (and maybe \usepackage{myunitemplate/array} was hidden in a class file and \usepackage{array} in another package, making things harder to detect).

For this and other reasons, since the 2020-10-01 release, LaTeX enforces that packages and classes are identified by their name and extension only, so that usages like the above do not load array.sty.

If that is precisely what you want to do, you can special-case this and use something like

\expandafter\let\csname ver@article.cls\endcsname\relax
\expandafter\let\csname opt@article.cls\endcsname\relax

before loading LaTeX's article.cls, so that options and the file version are cleared before LaTeX tries to load it. I must enforce that this should not be done, and instead you should use an unique name to identify your class.

  • Thanks for the very helpful and detailed response! – Nathan Dunfield Apr 28 at 18:37
  • 2
    Not only give it a unique name, also put it in your personal tree and it will be found. The TeX Live installed by MacTeX has the root of your person tree at ~/Library/texmf; ~/Library is the library folder in your HOME folder, NOT /Library/ which is at the root of you Drive. If you have created it you need to go to ~/Library and create the texmf folder and then tex/latex/ sub folders. Place the cls file sin a subfolder there. It will then be found autonatically. – Herb Schulz Apr 28 at 18:37
  • @HerbSchulz Thanks for the tip, but I already do that and, as you say, everything is then found automatically. My design mistake was not name-mangling the filenames like I name-mangle the internal macros in the class. – Nathan Dunfield Apr 28 at 18:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.