## LaTeX forum ⇒ Text Formatting ⇒ Letter Header Missing First Page

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
chmst1999
Posts: 4
Joined: Sun Feb 24, 2019 7:54 am

### Letter Header Missing First Page

I am unable to figure out how to get the same header on all pages of this document. It shows up on everything but the first page, but I can't seem to get it on page 1. Can anyone help fix this problem? The following document works in my editor, but has a few errors. If there is an easier way to set this up correctly please let me know.

Here is what I want:
1. same header on all pages
2. line under header on all pages
3. be able to adjust the distance the text starts from the line below the header
\documentclass[12pt]{letter} % Uses 10pt\usepackage[document]{ragged2e}\usepackage{makecell}\usepackage{graphicx}\usepackage{tabularx}\usepackage{geometry}\usepackage{fancyhdr}\pagestyle{fancy} \geometry{ letter, includehead, includefoot, total={170mm,257mm}, headheight=5mm, left=20mm, }\usepackage{hyperref}\hypersetup{    colorlinks=true,    linkcolor=blue,    filecolor=magenta,    urlcolor=blue} %Header\makeatletter\thispagestyle{plain}\def\ps@myheader{  \def\@oddhead{%\includegraphics[height=20mm,left]{example-image}\hfil}   \let\@evenhead\@oddhead% make right page headers the same as left		 \centering 		\begin{tabularx}{\textwidth}{ccc}        	 &\textsc{\large\bf First A. Last}& \\          	 &\textsc{P.O. BOX 999, Square, ZZ 11223}&  \\           	\textsc{\Mobilefone \hspace{1mm} (555) 555-5555} & \textsc{\Letter \hspace{1mm}  <!-- e --><a href="mailto:email@schools.k12.zz.us">email@schools.k12.zz.us</a><!-- e -->} & \href{http://goo.gl/AAAA}{http://goo.gl/AAAA}%\hline        \end{tabularx}% } \end{centering}} \begin{document}   \let\@evenhead\@oddhead% make right page headers the same as left\pagestyle{myheader} \signature{First And Last}           % name for signature \longindentation=0pt                       % needed to get closing flush left\let\raggedleft\raggedright                % needed to get date flush left \begin{letter}{Mr. Whom Ever\\Superintendent\\P.O. Box 8888\\Smallville, YY 76543}\opening{Dear Mr. Ever:} page 1    \newpage    page 2    \newpage   page 3 \vspace{\baselineskip}\linebreak\closing{Sincerely,} \encl{enclosure 1, enclosure 2}		% Enclosures\end{letter}\end{document}

Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm
Welcome to the forum.

\documentclass[12pt,headsepline]{letter} % Uses 10pt\usepackage[document]{ragged2e}\usepackage{makecell}\usepackage{graphicx}\usepackage{tabularx}\usepackage{geometry} \geometry{letterpaper,% <------- corrected includehead, includefoot,total={170mm,257mm},headheight=5mm,left=20mm,head=58.99994pt,%<------ added}\usepackage{hyperref}\hypersetup{colorlinks=true,linkcolor=blue,filecolor=magenta,urlcolor=blue} %Header\usepackage{blindtext}\usepackage{marvosym}\usepackage{scrlayer-scrpage}\chead{\begin{tabularx}{\textwidth}{ccc}&\textsc{\large\bf First A. Last}& \\&\textsc{P.O. BOX 999, Square, ZZ 11223}& \\ \textsc{\Mobilefone \hspace{1mm} (555) 555-5555} & \textsc{\Letter \hspace{1mm} <!-- e --><a href="mailto:email@schools.k12.zz.us">email@schools.k12.zz.us</a><!-- e -->} & \href{http://goo.gl/AAAA}{http://goo.gl/AAAA}%\hline\end{tabularx}%} \begin{document} \signature{First And Last} % name for signature \longindentation=0pt % needed to get closing flush left\let\raggedleft\raggedright % needed to get date flush left \begin{letter}{Mr. Whom Ever\\Superintendent\\P.O. Box 8888\\Smallville, YY 76543}\opening{Dear Mr. Ever:}\thispagestyle{scrheadings} \blindtext[22] \vspace{\baselineskip}%\linebreak Doesn't make any sense\closing{Sincerely,} \encl{enclosure 1, enclosure 2}	% Enclosures\end{letter}\end{document}

I would probably use some KOMA-stuff here.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

chmst1999
Posts: 4
Joined: Sun Feb 24, 2019 7:54 am
Thank you! I had some trouble compiling the email in your fix. I tried \email but I think I’ll have to define that.

Your fixes work well. However, now I have the pages numbered in the top left corner. Is there a way to remove that? I don’t see where it is being directed to number the pages.

Again, thank you!

Johannes_B
Site Moderator
Posts: 4044
Joined: Thu Nov 01, 2012 4:08 pm
I thought the letter symbols is what you want based on the code you shared.

Anyway, if you don't want the page numbers, add \ihead*{}.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

chmst1999
Posts: 4
Joined: Sun Feb 24, 2019 7:54 am
Johannes your work is great. This version is much better than what I had. The only thing still in there is the page numbers on the left side of the header. I don't know where to put the \ihead*{} to remove that. If I can get rid of those, this will be exactly what I need. Thanks for your help!

UPDATE: I fixed it with the line below included after the start of the document (in %%%%%)
\pagenumbering{gobble} % stops page numbering throughout document

Now the document and header work as I want without the page numbering!

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Welcome to Overleaf --- just edit your LaTeX on the left,% and we'll compile it for you on the right. If you open the% 'Share' menu, you can invite other users to edit at the same% time. See <!-- m --><a class="postlink" href="http://www.overleaf.com/learn">http://www.overleaf.com/learn</a><!-- m --> for more info. Enjoy!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \documentclass[12pt,headsepline]{letter} % Uses 10pt\usepackage[document]{ragged2e}\usepackage{makecell}\usepackage{graphicx}\usepackage{tabularx}\usepackage{geometry}  \geometry{letterpaper,% <------- corrected includehead, includefoot,total={170mm,257mm},headheight=5mm,left=20mm,head=58.99994pt,%<------ added}\usepackage{hyperref}\hypersetup{colorlinks=true,linkcolor=blue,filecolor=magenta,urlcolor=blue} %Header\usepackage{blindtext}\usepackage{marvosym}\usepackage{scrlayer-scrpage}\newcommand*{\email}[1]{\href{mailto:#1}{\nolinkurl{#1}}}\ihead*{}\chead{\begin{tabularx}{\textwidth}{ccc}&\textsc{\large\bf First A. Last}& \\&\textsc{P.O. BOX 999, Square, ZZ 11223}& \\ \textsc{\Mobilefone \hspace{1mm} (555) 555-5555} & \textsc{\Letter \hspace{1mm} \email{anyone@anywhere.k12.mt.us}} & \href{http://goo.gl/AAAA}{http://goo.gl/AAAA}%\hline\end{tabularx}%} \begin{document} \signature{First And Last} % name for signature \longindentation=0pt % needed to get closing flush left\let\raggedleft\raggedright % needed to get date flush left %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\pagenumbering{gobble} % stops page numbering throughout document%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  \begin{letter}{Mr. Whom Ever\\Superintendent\\P.O. Box 8888\\Smallville, YY 76543}\opening{Dear Mr. Ever:}\thispagestyle{scrheadings} \blindtext[10] \vspace{\baselineskip}%\linebreak Doesn't make any sense\closing{Sincerely,} \encl{enclosure 1, enclosure 2}	% Enclosures\end{letter}\end{document}

Stefan Kottwitz
\ohead{} instead of \ihead*{} would work here.