2

I want to create a document with both header and footer. So far the footer has been working fine but not the header, which is missing for some reason. Do anyone have a clue as to why it happens?

%!TEX TS-program = xelatex
\documentclass[12pt]{article}

%opening
\title{Example}

\usepackage[margin = 1.0in]{geometry}
\usepackage{fancyhdr}
\usepackage{amsmath, amsfonts, amssymb}
\usepackage{braket}
\usepackage{fontspec}

\pagestyle{fancy}
\fancyhf{}
\rhead{Not working}
\rfoot{\thepage}
\setmainfont{Times New Roman}
\newcommand{\bd}{\textbf}

\begin{document}
\maketitle

\bibliographystyle{APA}
\bibliography{bibliography.bib}

\end{document}

snapshot

3
  • 1
    Actually the footer isn't working either, because the page number is in the centre, not right. The point is that when using \maketitle with the article class the page style plainis used. See e.g. tex.stackexchange.com/a/30230/82917
    – campa
    Mar 9 at 9:58
  • Now that you mention it, I didn't recognize the footer was centered. I will check out the link you included. Thanks
    – Rei
    Mar 9 at 10:01
  • @Rei -- welcome -- the answer below should work -- have alook -- I have not used bibliography so commented out
    – js bibra
    Mar 9 at 10:18
0

enter image description here

\documentclass[12pt]{article}

%opening
\title{Example}

\usepackage[margin = 1.0in]{geometry}
\usepackage{fancyhdr}
\usepackage{amsmath, amsfonts, amssymb}
\usepackage{braket}
%\usepackage{fontspec}
\renewcommand{\headrulewidth}{0pt}
\fancypagestyle{firststyle}
{
    \fancyhf{}
    \fancyfoot[R]{\footnotesize Page \thepage}
        \fancyhead[R]{\footnotesize Not Working}
}
\begin{document}
    \maketitle
\thispagestyle{firststyle}
%   \bibliographystyle{APA}
%   \bibliography{bibliography.bib}
    
\end{document}
2
  • Thank you. So I suppose the way to go here is to overwrite the plain style with your firststyle and apply it to the paper, is that right?
    – Rei
    Mar 9 at 10:39
  • first option have a look at the documentation -- second this site has numerous examples of fancyhdr -- you can search in the bar above -- in case of specific problem please revert -- incidentally you can name your style anything as example \fancypagestyle{mystyle} and then initialise or call that style after begin document
    – js bibra
    Mar 9 at 12:45

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.