2

After running tlmgr update --all (I hadn't run it in a while) this code (from the dtx files all version of REVTeX 4 (version 4.2 is coming!)):

\expandafter\ifx\csname package@font\endcsname\@undefined\else
\expandafter\RequirePackage\expandafter{\csname package@font\endcsname}%
\fi

gives

This is pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017) (preloaded   format=latex 2017.12.21)  22 DEC 2017 16:56
entering extended mode
restricted \write18 enabled.
%&-line parsing enabled.
**foo.tex
(./foo.tex
LaTeX2e <2017-04-15>
Babel <3.15> and hyphenation patterns for 84 language(s) loaded.
! Missing \endcsname inserted.
<to be read again> 
                   \package@font 
l.3 \fi

?

This error doesn't happen if I run under older TeXLive installations and I didn't encounter until I ran the update. How can I figure out what broke?

Thanks, Mark

  • I just tried pdflatex revtex4.1.dtx in a texlive 2016 setup (the oldest I have to hand) and it gave this error – David Carlisle Dec 22 '17 at 22:42
2

This test

\expandafter\ifx\csname package@font\endcsname\@undefined

is never going to test true as \csname ljhgjghlj\encdname returns a csname \let to \relax so you always do

\RequirePackage\expandafter{\csname package@font\endcsname}%

even when it's not defined, in which case you get an error.

  • revtex4.dtx has the correct test against \relax but revtex4-1.dtx has this test against \@undefined which could never have worked unless you define \@undefined to be defined, which is weird. – David Carlisle Dec 22 '17 at 22:26
  • Can you imagine why the class doesn't use \@ifundefined{package@font}? I can't. – egreg Dec 22 '17 at 22:45
  • Thanks David. I confess to being a bit too quick to post. This works under my much older (2014) TeXLive installation, but I guess when I was working on this under my initial 2017 install, I was only running tex and not latex to create the generated files and not create the formatted PDF docs. I’m just not sure at this point. Anyway, i will just remove the offending code or perhaps switch to the suggestion by egreg. Thanks! – Mark Doyle Dec 24 '17 at 18:02
  • @MarkDoyle it could only work if you had some package that had erroneously defined \@ifundefined or that always ensured that \package@font was defined. The code fragment as posted in your question would always have given an error. – David Carlisle Dec 24 '17 at 18:04

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.