25

I want to know how can i set the page number of documents at right footer i.e. bottom right of the page in the whole document even on the chapter heading page too. Please help me out on this.

3
  • 1
    What \documentclass are you using?
    – Werner
    Jan 9, 2014 at 5:15
  • Which typesetting software package do you use? Is it TeX/LaTeX? If so, which document class do you employ?
    – Mico
    Jan 9, 2014 at 14:05
  • 1
    Report class with Latex. Jan 9, 2014 at 17:32

2 Answers 2

33

This should get you started.

\documentclass{article}

\usepackage{fancyhdr}
\usepackage{lipsum}

\title{Some document}
\author{Shivam Dhoot}

% Turn on the style
\pagestyle{fancy}
% Clear the header and footer
\fancyhead{}
\fancyfoot{}
% Set the right side of the footer to be the page number
\fancyfoot[R]{\thepage}

\begin{document}
\maketitle
% Input some blind text
\lipsum
\end{document}

Since you explicitly mention that you want the page number also on the footer of chapter heading pages, you need to redefine the plain style, which is used for these pages. Copying from this answer here I get this code here, which seems to be exactly what you want.

\documentclass{report} % to have chapters

\usepackage{fancyhdr} % to change header and footers
\usepackage{blindtext} % to quickly get a full document

\title{Some document}
\author{Shivam Dhoot}

\pagestyle{fancy} % Turn on the style
\fancyhf{} % Start with clearing everything in the header and footer
% Set the right side of the footer to be the page number
\fancyfoot[R]{\thepage}

% Redefine plain style, which is used for titlepage and chapter beginnings
% From https://tex.stackexchange.com/a/30230/828
\fancypagestyle{plain}{%
    \renewcommand{\headrulewidth}{0pt}%
    \fancyhf{}%
    \fancyfoot[R]{\thepage}%
}

\begin{document}
\maketitle

% Input some blind text
\blinddocument
\end{document}

Let us know if that helps or if you need more.

2
5

I use \usepackage{fancyhdr} and commands like you wrote. However, a horizontal line appears at the top of the page.

The packages are like below:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{textcomp}
\usepackage[portuguese]{babel}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{subeqnarray}
\usepackage{amssymb}
\usepackage{amsfonts}
\usepackage{graphicx}
\usepackage{multirow}
\usepackage{booktabs}
\usepackage{xcolor}
\usepackage{enumerate}
\usepackage{enumitem}
\usepackage{lscape}
\usepackage{lipsum}
%=================== pagina
\usepackage{fancyhdr}
\usepackage{lipsum}
% Turn on the style
\pagestyle{fancy}
% Clear the header and footer
\fancyhead{}
\fancyfoot{}
% Set the right side of the footer to be the page number
\fancyfoot[R]{\thepage}

The result are like:

enter image description here

How can I remove this horizontal line at the top?

Thank you. Erick.

3
  • Welcome to TeX.SX! Please, do not post a new question as an answer to a previous question.
    – KersouMan
    Jul 16, 2020 at 15:13
  • Ok, guys! My bad.
    – zanelatoeb
    Jul 17, 2020 at 15:46
  • 4
    \renewcommand{\headrulewidth}{0pt}% Jul 23, 2020 at 4:22

You must log in to answer this question.

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