2

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?

4
  • Try \thispagestyle{fancy}. Nov 15 '12 at 19:30
  • Possible Duplicate: Putting the title in the header for an article. 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. Nov 15 '12 at 19:39
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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