# unable to add page number on newlmf document

I tried to follow all advice I could find, esp. How can I add "page # of ##" on my document?, but somehow have been unsuccessful in inserting page numbers into my cover letter. Is the method different for newlfm documents, please?

\documentclass[10pt,stdletter,dateno,sigleft]{newlfm} % Extra options: 'sigleft' for a left-aligned signature, 'stdletternofrom' to remove the from address, 'letterpaper' for US letter paper - consult the newlfm class manual for more options

\usepackage{charter} % Use the Charter font for the document text
\sloppy
\newsavebox{\Luiuc}\sbox{\Luiuc}{\parbox[b]{1.75in}{\vspace{0.5in}
\includegraphics[width=1.2\linewidth]{logo.png}}} % Company/institution logo at the top left of the page

\newlfmP{sigsize=50pt} % Slightly decrease the height of the signature field
\newlfmP{addrfromphone} % Print a phone number under the sender's address
\newlfmP{addrfromemail} % Print an email address under the sender's address
\PhrPhone{Phone} % Customize the "Telephone" text
\PhrEmail{Email} % Customize the "E-mail" text

\lthUiuc % Print the company/institution logo

%----------------------------------------------------------------------------------------
%   YOUR NAME AND CONTACT INFORMATION
%----------------------------------------------------------------------------------------

\namefrom{John Smith} % Name

\today\\[12pt] % Date
City, State 12345
}

\phonefrom{(000) 111-1111} % Phone number

\emailfrom{john@smith.com} % Email address

%----------------------------------------------------------------------------------------
%   ADDRESSEE AND GREETING/CLOSING
%----------------------------------------------------------------------------------------

\greetto{Dear Mrs. Smith,} % Greeting text
\closeline{Sincerely yours,} % Closing text

\nameto{Mrs. Jane Smith} % Addressee of the letter above the to address

Recruitment Officer \\ % To address
The Corporation \\
123 Pleasant Lane \\
City, State 12345
}

%----------------------------------------------------------------------------------------

\begin{document}
\begin{newlfm}

%----------------------------------------------------------------------------------------
%   LETTER CONTENT
%----------------------------------------------------------------------------------------

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.

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.

%----------------------------------------------------------------------------------------

\end{newlfm}
\end{document}

• Please provide a MWE and it might be possible to adapt it for newlfm... – user31729 May 30 '14 at 21:13
• @ChristianHupfer: Thanks very much. MWE added. Cheers – Abhimanyu Arora May 30 '14 at 21:16
• Are you open to completely drop newlfm and recreate the layout using article? It will be just as freely adjustable but spare you the rigid format enforced by a specific document class. – Werner May 30 '14 at 21:39
• The document class sets the page style to empty. You can override that by adding \thispagestyle{plain}\pagestyle{plain} as the first thing inside the newlfm environment. But you'd have to adjust your margins as well. – Werner May 30 '14 at 21:40
• @Werner: I have already spent a lot of time in this cover letter and once the page numbers are added, I think it should be fine, maybe next time I will use the article class :-). In the meantime, can you please tell me how to adjust the margins? I tried to use the standard geometry approach but a new tab opens with an error... – Abhimanyu Arora May 30 '14 at 21:49

newlfm sets the page style to empty when parsing the environment. You can override this by executing \thispagestle{plain} (or some other style) inside the newlfm environment, perhaps also with \pagestyle{plain} - there are different page styles and layouts set for the first and subsequent pages.

I propose an alternative, more flexible approach though: Rewrite your cover letter using the standard article document class and manage the layout yourself:

\documentclass{article}

\usepackage{graphicx,charter,geometry,fancyhdr,lastpage}
\usepackage{lipsum}

\geometry{margin=1in}% Set the page geometry

\pagestyle{fancy}
\renewcommand{\footrulewidth}{0pt}% No footer rule
\fancyfoot[C]{\thepage~of~\pageref{LastPage}}% Centred footer

\setlength{\parindent}{0pt}% No paragraph indent
\setlength{\parskip}{.5\baselineskip}

\begin{document}

\includegraphics[width=.2\linewidth]{example-image}% Your logo here

\rule{\linewidth}{1pt}

\vspace{3\baselineskip}

\null\hfill
\begin{tabular}{l@{}}
\today \\ \\
City, State 12345 \\
Phone: (000) 111-1111 \\
Email: john@smith.com
\end{tabular}

\bigskip

\begin{tabular}{@{}l}
Mrs.\ Jane Smith \\
Recruitment Officer \\
The Corporation \\
123 Pleasant Lane \\
City, State 12345
\end{tabular}

\bigskip

Dear Mrs.\ Smith,

\medskip

\lipsum[1-15]% Your cover letter text here

\bigskip

\begin{tabular}{@{}l}
Sincerely yours, \\[50pt]
John Smith
\end{tabular}

\end{document}

• Since the document is intented to be letter, wouldn't it be better to use one of the letter classes to start with, e.g. scrlettr2 etc? – user31729 May 30 '14 at 21:55
• @ChristianHupfer: All of the letter classes (newlfm, letter.cls and KOMA-script's scrlettr2) lack any form of free layout flexibility (easily noticeable from all the layout questions on this site when dealing with letter classes) - a requirement of this post. So, I use a non-restrictive class (like article). Regardless, any of the letter layouts can be replicated using article, so I instinctively go for this option, always. – Werner May 30 '14 at 22:00
• Good to know, I never used any of the letter classes before. – user31729 May 30 '14 at 22:01
• I wholeheartedly agree with comments by @Werner. Having spent countless hours on finding layout and spacing options and still not being able to get to them to work in either newlfm or scrlettr2, using article class is the best option. – cryptic0 Apr 8 '16 at 18:05

The lastpage approach does work for newlfm as well, see the line somewhere after the start of the letter body ( I just placed it there)

\textbf{\textcolor{blue}{This is page \thepage~ of \pageref{LastPage} pages}}

In the output it will be printed blue. The current page is referred to with \thepage and the number of total pages is referred to with \pageref{LastPage}. Change the formatting and position at will...

\documentclass[10pt,stdletter,dateno,sigleft]{newlfm} % Extra options: 'sigleft' for a left-aligned signature, 'stdletternofrom' to remove the from address, 'letterpaper' for US letter paper - consult the newlfm class manual for more options
\usepackage{xcolor}%
\usepackage{lastpage}%

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

\sloppy
\newsavebox{\Luiuc}\sbox{\Luiuc}{\parbox[b]{1.75in}{\vspace{0.5in}
\includegraphics[width=1.2\linewidth]{logo.png}}} % Company/institution logo at the top left of the page

\newlfmP{sigsize=50pt} % Slightly decrease the height of the signature field
\newlfmP{addrfromphone} % Print a phone number under the sender's address
\newlfmP{addrfromemail} % Print an email address under the sender's address
\PhrPhone{Phone} % Customize the "Telephone" text
\PhrEmail{Email} % Customize the "E-mail" text

\lthUiuc % Print the company/institution logo

%----------------------------------------------------------------------------------------
%   YOUR NAME AND CONTACT INFORMATION
%----------------------------------------------------------------------------------------

\namefrom{John Smith} % Name

\today\\[12pt] % Date
City, State 12345
}

\phonefrom{(000) 111-1111} % Phone number

\emailfrom{john@smith.com} % Email address

%----------------------------------------------------------------------------------------
%   ADDRESSEE AND GREETING/CLOSING
%----------------------------------------------------------------------------------------

\greetto{Dear Mrs. Smith,} % Greeting text
\closeline{Sincerely yours,} % Closing text

\nameto{Mrs. Jane Smith} % Addressee of the letter above the to address

Recruitment Officer \\ % To address
The Corporation \\
123 Pleasant Lane \\
City, State 12345
}

%----------------------------------------------------------------------------------------

\begin{document}
\begin{newlfm}

%----------------------------------------------------------------------------------------
%   LETTER CONTENT
%----------------------------------------------------------------------------------------

\textbf{\textcolor{blue}{This is page \thepage~ of \pageref{LastPage} pages}}

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.

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.

%----------------------------------------------------------------------------------------

%%% Dummy paragraphs!

PARAGRAPH FOUR: 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.

PARAGRAPH FIVE: 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.

\end{newlfm}

\end{document}


• Thanks Christian, but I think it would be a better idea to put the text in blue at the end of each page. Can you please also tell me how to do that? Cheers – Abhimanyu Arora May 30 '14 at 21:36
• @AbhimanyuArora: That is not so easy, since the newlfm has a very restrictive format, as Werner stated. – user31729 May 30 '14 at 21:47
• Thanks for your time and trying to help out anyway. Cheers – Abhimanyu Arora May 30 '14 at 21:52