30

I updated to TeXLive 2017 and couldn't get newlfm.cls to work without errors. Here is a minimal example:

\documentclass{newlfm}
\begin{document}
\begin{newlfm}
\end{newlfm}
\end{document}

LaTex is throwing undefined control sequence errors on \fancy@reset, \f@ncyolh, and \f@ncyorh.

What causes the errors? What am I missing?

4
  • 4
    Welcome to TeX.SX! The fancyhdr package has been updated and those macros have been removed. This happens when a class/package uses internals of another package.
    – egreg
    Jun 29, 2017 at 20:53
  • 2
    ...and there's technically very little need to use newlfm since everything in terms of the layout can be recreated using the default article class.
    – Werner
    Jun 29, 2017 at 21:00
  • @egreg: thanks for the pointer. It works now after patching newlfm.cls according to the new fancyhdr macros. For anyone who is interested, here is a patch: pastebin.com/F3KcpYYJ
    – wto
    Jun 30, 2017 at 2:44
  • 4
    And the complete patched newlfm: pastebin.com/5bkkMEap Oct 10, 2017 at 15:10

1 Answer 1

35

Presumably the following patch (via etoolbox) suffices:

\usepackage{etoolbox}

\makeatletter
\patchcmd{\@zfancyhead}{\fancy@reset}{\f@nch@reset}{}{}
\patchcmd{\@set@em@up}{\f@ncyolh}{\f@nch@olh}{}{}
\patchcmd{\@set@em@up}{\f@ncyolh}{\f@nch@olh}{}{}
\patchcmd{\@set@em@up}{\f@ncyorh}{\f@nch@orh}{}{}
\makeatother

The error resulted from hard-coding package-dependent variables, which was changed in an updated release of fancyhdr. By adding the above to your preamble, the older fancyhdr names will be substituted for the newer names.

3
  • As of version 4.0 of fancyhdr, \ps@@empty was renamed to \f@nch@ps@empty, and newlfm also checks to make sure that \ps@@empty is defined. If it isn't, it throws an error. Until this is fixed, it is also necessary to put \RequirePackage{fancyhdr} \makeatletter \let\ps@@empty\f@nch@ps@empty \makeatother before the \documentclass invocation, otherwise it won't be possible to use newlfm.
    – Adam Liter
    Jan 19, 2021 at 22:38
  • 1
    @AdamLiter: If you have the option of using newlfm, I'd probably just avoid it. You can do a similar job using article (with fancyhdr and geometry) and the code is more readable; the same goes for letter.
    – Werner
    Jan 19, 2021 at 22:41
  • Agreed. I just had to recompile an old document that used it with TeX Live 2020, and I ran into this issue, so I just thought I would put this here in case anyone else runs into a similar issue and finds this information helpful.
    – Adam Liter
    Jan 19, 2021 at 22:43

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.