0

I'm preparing a document using LaTeX where I need to put the page number in the bottom right corner. I achieved this using the package fancyhdr and applying the fancy page style. However, for the Bibliography section, things are not working out properly:

  1. At first, the bibliography was not formatting as it should for Fancy style. I then wrote: \thispagestyle{fancy} right before: \bibliography{referencias}{} - For a first moment this was giving me the result I wanted, but when the Bibliography as longer than one page, the first page had a centered page number counter while all the other pages had the page number correctly in the bottom right corner.

I searched for this problem at the StackExchange and in Forums, but most of the questions are about fancy headers in the Bibliography.

I must have all page numbering in the bottom right corner. Anyone knows how I can fix this?

Here is my MWE:

\documentclass[12pt]{report}

\usepackage{lipsum}
\usepackage{fancyhdr}
\fancyfoot{}
\fancyhead{}
\renewcommand{\footrulewidth}{0pt} % control width bottom rule
\renewcommand{\headrulewidth}{0pt} % control width header rule
\fancyfoot[R]{\thepage}
\pagestyle{fancy}

\usepackage{natbib} %Bibliografia

\begin{document}

\section*{Dummy Text}
\lipsum[1-3]

{
\thispagestyle{fancy} %% This works for all pages in bibliography, except the first. 
\bibliography{referencias}{}
\nocite{*}
\bibliographystyle{geo-apalike}
}

\end{document}

Note: I wrote the bibliography citing the works until it reached more than one page and also with \nocite{*}. Both ways resulted the same output: first page of bibliography with centered page number, while the rest right justified.

enter image description here enter image description here enter image description here

1
  • 2
    That is normal The first page of a chapter uses the plain page style. A solution would be to redefine the plain style as you wish with fancyhdr.
    – Bernard
    Apr 19, 2021 at 15:24

1 Answer 1

1

The first page of each chapter, including the bibliography (which is a chapter), uses the plain style, with the page number in the center at the bottom. The rest of the pages will use the fancy style.

There are two options:

(1) Redefine the plain style to be equal to your fancy style, or

(2) Define a new style (I called it firstpage. Prints the page number between * to show the difference) to be applied to a single specific page using \thispagestyle{firstpage}

a

b

\begin{filecontents}{myreferences.bib}
    @book{Labov1972,
        Address = {Philadelphia},
        Author = {William Labov},
        Publisher = {University of Pennsylvania Press},
        Title = {Sociolinguistic Patterns},
        Year = {1972}}
    
    @book{Chomsky1957,
        Address = {The Hague},
        Author = {Noam Chomsky},
        Publisher = {Mouton},
        Title = {Syntactic Structures},
        Year = {1957}}
    
    @article{Barker1998,
        Author = {Chris Barker},
        Journal = {Natural Language \& Linguistic Theory},
        Pages = {679-717},
        Title = {Partitives, Double Genitives and Anti-Uniqueness},
        Volume = {16},
        Year = {1998}}
    
    @book{Berwick1985,
        Address = {Cambridge, MA},
        Author = {Berwick, Robert C.},
        Publisher = {MIT Press},
        Title = {Acquisition of syntactic knowledge},
        Year = {1985}}
\end{filecontents}


\documentclass[12pt]{report}

\usepackage{lipsum}
\usepackage{fancyhdr} %fancy headers

\fancyhf{} % clear all fancy headers
\renewcommand{\footrulewidth}{0pt} % control width bottom rule
\renewcommand{\headrulewidth}{0pt} % control width header rule
\fancyfoot[R]{\thepage}
\pagestyle{fancy} % all pages in fancy style

\fancypagestyle{firstpage}{% define a custom header OPTION 1 to be applied to specific pages
    \fancyhf{}
    \fancyfoot[R]{*\thepage*}  % prints *1*
}

\fancypagestyle{plain}{% define a custom header OPTION 2 to be applied in first pages of ALL chapters 
    \fancyhf{}
    \fancyfoot[R]{\thepage}
}   

\usepackage{natbib} %Bibliografia

\begin{document}

    \chapter{One}
%       \thispagestyle{firstpage} % to be used only in the first page of a chapter, instead of plain
        \lipsum[4-6]
    \section*{Dummy Text}
    \lipsum[1-3]
    
    \bibliographystyle{apalike}
    \nocite{*}

    \bibliography{myreferences}
    \thispagestyle{firstpage}  % prints *3*
    
\end{document}
1
  • Thank you @Simon! It worked for me
    – raulindo
    Apr 21, 2021 at 13:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .