Page no positioning in latex using fancyhdr package.
We can manually position the page no. in LaTeX using fancyhdr
package. To position page no. (or any other thing) in header or footer there are total six position options, left, right and centre in header and footer. The corresponding commands are given in the table bellow
position | fancy head command |
---|---|
left header | \lhead |
right header | \rhead |
centre header | \chead |
left footer | \lfoot |
right footer | \rfoot |
centre footer | \cfoot |
And the page no inserted by the command \thepage
. Now suppose I want to insert page no in the left side of each page I can use following code:
\documentclass[a4paper, 11pt]{report}
\usepackage{amsmath}%just some package not necessary to
\usepackage{graphicx}%test this page no.
\usepackage{fancyhdr}
\pagestyle{fancy} %declaring page style
\lhead{\thepage} %page no inserted in left side of header
\chead{}
\rhead{}
\lfoot{}
\cfoot{}
\rfoot{}
\author{Apurba~Paul}
\title{Inserting page no in custom position in \LaTeX using fancyhdr}
\begin{document}
\maketitle
The content of the main body
\end{document}
Instead of \lhead
you can insert the page no command in any position. Also you can use same command to insert any information in header or footer (for example: Author name, chapter name etc.). Also header this will insert an horizontal line after header. To remove it you can use \renewcommand{headrulewidth}{0pt}
.
Also if you want page no should come in left side in even page and right side in odd page then you can specify that using the following command instead of above,
\fancyhead[LE,RO]{\thepage}
Hope this information will be helpful
APaul
Sources:
http://tex.stackexchange.com/questions/10043/page-number-positionhttp://mirrors.ctan.org/macros/latex/contrib/fancyhdr/fancyhdr.pdf
http://www.ctan.org/pkg/fancyhdr
Comments
Post a Comment
Please dont forget to tell me if this post helped you or not...