13

I want to convert this template with pdflatex to PDF but newlfm expects fancyhdr.sty to be current version. Installed is the newest version 4.0.1. How can this error be fixed or is it a bug?

! Class newlfm Error: Version of fancyhdr.sty is not current.
(newlfm)              Please obtaina recent copy of fancyhdr.sty (Version 1.99d
 or later) from CTAN..

See the newlfm class documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.44 ...ad the current version of fancyhdr.sty}}{}
                                                  %
? H
Go to CTAN anddownload the current version of fancyhdr.sty
?

3 Answers 3

8

This is an issue with an outdated newlfm class. However, it's fairly easy to recreate the layout provided by the template. And, as a personal preference, the code is far more clear in terms of the layout if you avoid using newlfm (which hasn't been updated in more than a decade).

enter image description here

\documentclass{article}

\usepackage{charter} % Use the Charter font for the document text

\usepackage[margin=1in]{geometry}
\usepackage{fancyhdr,graphicx}

\fancypagestyle{firstpage}{%
  \fancyhf{}% Clear header/footer
  \renewcommand{\headrulewidth}{0pt}%
  \renewcommand{\footrulewidth}{1pt}%
  % Add more detail here if needed
}
\fancypagestyle{otherpages}{%
  \fancyhf{}% Clear header/footer
  \renewcommand{\headrulewidth}{1pt}%
  \renewcommand{\footrulewidth}{1pt}%
  % Add more detail here if needed
}

\AtBeginDocument{\thispagestyle{firstpage}}
\pagestyle{otherpages}

\setlength{\parindent}{0pt}
\setlength{\parskip}{1ex}

\begin{document}

\vspace*{\dimexpr-\headsep-\headheight-1pt}

\includegraphics[width=2.1in]{logo.png}

\rule{\linewidth}{1pt}

\bigskip\bigskip

\hfill
\begin{tabular}{ l @{} }
  \today \\[12pt] % Date
  123 Broadway \\ % Address
  City, State 12345 \\
  Phone: (000) 111-1111 \\
  Email: john@smith.com
\end{tabular}

\bigskip

\begin{tabular}{ @{} l }
  Mrs.\ Jane Smith \\ % Addressee of the letter above the to address
  Recruitment Officer \\ % To address
  The Corporation \\
  123 Pleasant Lane \\
  City, State 12345
\end{tabular}

\bigskip

Dear Mrs.\ Smith,

\bigskip

PARAGRAPH ONE: State the reason for the letter, name the position or type of work you are applying for and identify the source from which you learned of the opening (i.e. career development center, newspaper, employment service, personal contact).

PARAGRAPH TWO: Indicate why you are interested in the position, the company, its products, services - above all, stress what you can do for the employer. If you are a recent graduate, explain how your academic background makes you a qualified candidate for the position. If you have practical work experience, point out specific achievements or unique qualifications. Try not to repeat the same information the reader will find in the resume. Refer the reader to the enclosed resume or application which summarizes your qualifications, training, and experiences. The purpose of this section is to strengthen your resume by providing details which bring your experiences to life. 
 
PARAGRAPH THREE: Request a personal interview and indicate your flexibility as to the time and place. Repeat your phone number in the letter and offer assistance to help in a speedy response. For example, state that you will be in the city where the company is located on a certain date and would like to set up an interview. Alternatively, state that you will call on a certain date to set up an interview. End the letter by thanking the employer for taking time to consider your credentials. 

\bigskip

Sincerely yours,

\vspace{50pt}

John Smith

\end{document}
5
  • It works, though I have an issue with \includegraphics[width=2.1in]{logo.png} it does not work. I tried it with the original code \includegraphics[width=1.2\linewidth]{logo.png}}} and works neither. How can this be fixed?
    – sdf
    Feb 17, 2021 at 20:45
  • @sdf: I downloaded logo.png from the template. You need that in your working folder.
    – Werner
    Feb 17, 2021 at 20:47
  • Yes done but says ! LaTeX Error: Cannot determine size of graphic in logo.png (no BoundingBox). in line 31.
    – sdf
    Feb 17, 2021 at 21:35
  • @sdf: You're probably compiling with LaTeX. Change to compile with pdfLaTeX (in OverLeaf, click on Menu in the top-left corner, then change the compiler to pdfLaTeX).
    – Werner
    Feb 17, 2021 at 21:37
  • Yes, running (pdf)LaTeX in DVI mode, which requires explicitly setting the bounding box for image files. Changed to pdflatex and works.
    – sdf
    Feb 17, 2021 at 21:50
6

fancyhdr has renamed several of its internal commands to get a more consistent naming scheme. newlfm uses an outdated command name to check if fancyhdr is outdated. Back in 2009 that worked, nowadays it doesn't. But even if you remove the check from newlfm, it won't work because it uses a couple of internal fancyhdr commands that have also got new names. Anyway, I wouldn't recommend using internal commands from fancyhdr, and I think newlfm could be rewritten without them.

My first advise is to go with @Werner's solution.

If newlfm is a requirement, there are two solutions:

  1. Get an old version of fancyhdr. The last one that will work with newlfm is V3.8, which can be found at Github. But this is not the recommended solution, just a stopgap.
  2. Make a patched copy of newlfm.cls. I think the following patch will work.
diff -u newlfm.cls.orig newlfm.cls
--- newlfm.cls.orig 2021-02-18 11:29:10.000000000 +0100
+++ newlfm.cls  2021-02-18 11:38:36.000000000 +0100
@@ -38,10 +38,6 @@
 \RequirePackage{eso-pic}%
 \RequirePackage{setspace}%
 \RequirePackage{lastpage}%
-\@ifundefined{ps@@empty}{%
-  \ClassError{newlfm}{Version of fancyhdr.sty is not current. \MessageBreak Please obtain%
-    a recent copy of fancyhdr.sty (Version 1.99d or later) from CTAN.}  {Go to CTAN and%
-    download the current version of fancyhdr.sty}}{}%
 \RequirePackage{calc}[1997/11/11]%
 \RequirePackage{graphicx}[1997/06/09]%
 \RequirePackage{rotating}[1997/06/09]%
@@ -1687,13 +1683,13 @@
 \txa{@zpqutil:\@zpqutil}
 \fi
 }
-\newcommand{\@zfancyhead}[5]{#1\hbox to\headwidth{\fancy@reset
+\newcommand{\@zfancyhead}[5]{#1\hbox to\headwidth{\f@nch@reset
   \@zfancyvbox\headheight{\hbox
     {\rlap{\parbox[b]{\headwidth}{\raggedright#2}}\hfill
       \parbox[b]{\headwidth}{\centering#3}\hfill
       \llap{\parbox[b]{\headwidth}{\raggedleft#4}}}\zheadrule}}#5}
 
-\newcommand{\@zfancyfoot}[5]{#1\hbox to\headwidth{\fancy@reset
+\newcommand{\@zfancyfoot}[5]{#1\hbox to\headwidth{\f@nch@reset
     \@zfancyvbox\footskip{\zfootrule
       \hbox{\rlap{\parbox[t]{\headwidth}{\raggedright#2}}\hfill
         \parbox[t]{\headwidth}{\centering#3}\hfill
@@ -2144,7 +2140,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \vspace*{\the\@marg@tp@a}
 \txa{headrulewidth:\headrulewidth}
-\@zfancyhead{\relax}{\f@ncyolh}{\f@ncyolh}{\f@ncyorh}{\relax}
+\@zfancyhead{\relax}{\f@nch@olh}{\f@nch@olh}{\f@nch@orh}{\relax}
 \txa{HgtHead:\the\@Hgt@Head,utill:\the\@utill,zpqutil:\@zpqutil}
 \addtolength{\@Hgt@Head}{\@utill}
 \addtolength{\@Hgt@Head}{\@zpqutil}
3
  • Unfortunately, the referenced fancyhdr version from GitHub doesn't play well with newlfm: ! Undefined control sequence. \@zfancyhead ...1\hbox to\headwidth {\f@nch@reset Sep 13, 2022 at 20:57
  • 1
    The patch did work though! To save time for future generations of poor newlfm users, here's the resulting newlfm.cls, that you can put in the directory with your tex file using the class: gist.githubusercontent.com/ulysses4ever/… Sep 13, 2022 at 21:13
  • 1
    The next release of fancyhdr (version 4.1) will add support for newlfm that will eliminate the errors. Sep 16, 2022 at 18:19
1

Some great answers are above, Werner's being the most versatile.

However, if you are looking for a quick fix, check if the pdf is being created by the compiler. If yes, comment out line nos. 41 through 44 of newlfm.cls file.

Clicking on the error takes you to the condition that throws this error. I tried this on an off-line compiler (TeXstudio as editor). Note that GNU license requires you to save the .cls as a separate file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .