Text Formattingremove page numbers from header

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

remove page numbers from header

Post by chmst1999 »

I am trying to write a letter with consistent letterhead on every page. I believe I have a working document now (thanks to help from a prior post). However, now the header has the page numbers in the top-left corner. I don't want page numbers. Is there a way to have everything work the way it is but omit the page numbers in the header?

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!

Code: Select all

\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}} & \ComputerMouse \hspace{1mm} \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}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

remove page numbers from header

Post by Stefan Kottwitz »

Nice that you found it!

Switching off the numbering style (to none) is one way. Another way would be modifying the header entries, with the scrlayer-scrpage tools. For example, \ohead{} woud do it.

I prefer scrlttr2 over the letter class, btw.

Stefan
LaTeX.org admin
Post Reply