1

How to write rhead only on the first page? Why does this code not work?

\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fancyhdr}

\lhead{}
\chead{}


\usepackage{amssymb} 
\usepackage{atbegshi}
\rhead{AAAAAA}
\AtBeginShipoutFirst{\rhead{}}
\pagestyle{fancy}

\begin{document}
AAAAAAAA
\newpage
AAAAAAAAA
\end{document}

enter image description here

6
  • Would it be possible somehow with \AtBeginShipoutFirst{\rhead{}}?
    – Elena Greg
    Mar 20 at 8:08
  • your code writes only on the first page -- what is the problem
    – js bibra
    Mar 20 at 8:30
  • I do not know, I added the result to my question.
    – Elena Greg
    Mar 20 at 8:50
  • My impression is that you want to remove the right header in the first page, is this correct?
    – egreg
    Mar 20 at 9:15
2

My impression is that you want to suppress the header in the first page.

You can use a conditional in the code for the right header (but this will keep the rule).

\documentclass[11pt,a4paper]{article}
\usepackage{fancyhdr}

\pagestyle{fancy}
\fancyhead{}
\fancyhead[R]{\ifnum\value{page}=1 \else AAAAAA\fi}
\setlength{\headheight}{13.6pt}

\begin{document}

AAAAAAAA

\newpage

AAAAAAAAA

\end{document}

Alternatively, issue \thispagestyle{plain} after \begin{document}.

1
  • Thank you very much
    – Elena Greg
    Mar 20 at 10:48

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.