newlfm 期待新的 fancyhdr.sty 但它是最新的

newlfm 期待新的 fancyhdr.sty 但它是最新的

我想转换这个模板pdflatexPDF 但newlfm期望fancyhdr.sty是最新版本。安装的是最新版本 4.0.1。这个错误如何修复,或者它是一个 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
?

答案1

这是一个过时的newlfm类。但是,重新创建模板提供的布局相当容易。而且,就个人喜好而言,如果您避免使用newlfm(十多年来从未更新过),代码在布局方面会更加清晰。

在此处输入图片描述

\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: [email protected]
\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}

答案2

fancyhdr已重命名其几个内部命令以获得更一致的命名方案。newlfm使用过时的命令名称来检查是否fancyhdr已过时。早在 2009 年,这种方法是可行的,但现在行不通了。但即使您从 中删除检查newlfm,它也不会起作用,因为它使用了一些fancyhdr也具有新名称的内部命令。无论如何,我不建议使用 中的内部命令fancyhdr,我认为newlfm可以在没有它们的情况下重写。

我的第一个建议是采用@Werner 的解决方案。

如果newlfm是要求的话,有两种解决方案:

  1. 获取旧版本的fancyhdr。最后一个可以使用的newlfm是 V3.8,可以在以下网址找到:Github。但这不是推荐的解决方案,只是权宜之计。
  2. 制作 的修补副本newlfm.cls。我认为以下修补程序将起作用。
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

上面有一些很好的答案,沃纳用途最广泛。

但是,如果您正在寻找快速修复方法,请检查 pdf 是否由编译器创建。如果是,请注释掉newlfm.cls文件的第 41 行到第 44 行。

单击错误会将您带到引发此错误的条件。我在离线编译器(TeXstudio 作为编辑器)上尝试了此操作。请注意,GNU 许可证要求您将 .cls 保存为单独的文件。

相关内容