# Undefined control sequence error on \fancy@reset, \f@ncyolh and \f@ncyorh when using newlfm class

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?

• 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. Jun 29, 2017 at 20:53
• ...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
• And the complete patched newlfm: pastebin.com/5bkkMEap Oct 10, 2017 at 15:10

Presumably the following patch (via etoolbox) suffices:

\usepackage{etoolbox}

\makeatletter

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.
• 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. Jan 19, 2021 at 22:38
• @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.