Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use the following code for my letter:

\documentclass[a4paper, 11pt]{letter}

\usepackage{fontspec}
\usepackage{fancyhdr}


\newcommand{\DocumentTitle}{Motivation Letter}
\newcommand{\Author}{Johm Smith}

\setmainfont{Times New Roman}

\usepackage[hmargin=1in,vmargin=1in]{geometry}
\linespread{1.3}

\pagestyle{fancy}
\fancyhf{} % clear all header and footers
\fancyhead[L]{\DocumentTitle \\ \Author}
\fancyhead[R]{\thepage}
\fancyfoot[L]{\DocumentTitle \\ \Author}
\fancyfoot[R]{\thepage}

\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
\thispagestyle{fancy}

\begin{document}

\begin{letter}{ }

\signature{\Author}

\opening{To Whom It May Concern,}
\closing{Respectfully,}

\end{letter}

\end{document}

But there is no these header and footer on the first page. How to change this behavior?

share|improve this question
    
Try \thispagestyle{fancy}. –  Peter Grill Nov 15 '12 at 19:30
    
Possible Duplicate: Putting the title in the header for an article. –  Peter Grill Nov 15 '12 at 19:32
    
@Peter Grill Where I must put this. –  user14416 Nov 15 '12 at 19:38
    
You would normally add it to the preamble, but your code seems to work fine with the letter class. So, while code snippets are useful in explanations, I recommend you compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. –  Peter Grill Nov 15 '12 at 19:39

1 Answer 1

up vote 1 down vote accepted

In the letter document class, \opening issues \thispagestyle{firstpage}, where \ps@firstpage is defined in letter.cls for the first page of a letter. To apply the same header/footer to this page, you can \let the firstpage style to be fancy, using

\let\ps@firstpage\ps@fancy

A complete example:

\documentclass[a4paper, 11pt]{letter}

\usepackage{fontspec}
\usepackage{fancyhdr}


\newcommand{\DocumentTitle}{Motivation Letter}
\newcommand{\Author}{Johm Smith}

%\setmainfont{Times New Roman}

\usepackage[hmargin=1in,vmargin=1in]{geometry}
\linespread{1.3}

\pagestyle{fancy}
\fancyhf{} % clear all header and footers
\fancyhead[L]{\DocumentTitle \\ \Author}
\fancyhead[R]{\thepage}
\fancyfoot[L]{\DocumentTitle \\ \Author}
\fancyfoot[R]{\thepage}

\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}

\makeatletter
\let\ps@firstpage\ps@fancy
\makeatother

\begin{document}

\begin{letter}{ }
\signature{\Author}

\opening{To Whom It May Concern,}
\closing{Respectfully,}

\end{letter}
\end{document} 

enter image description here

I commented out the line \setmainfont{Times New Roman} in my example code, since I don't have this font in my system.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.