Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Good day everyone. I need some help on my report. My professor requires me to place page number on each page at exactly 1.25 inch from the top on the right side of the paper. Hope you can help me. Below is my sample code.

  \documentclass[12pt,a4paper]{report}
  \usepackage{fancyhdr}
  \usepackage{lipsum}

  \fancyhf{}
  \fancyhead[R]{\thepage}
  \pagestyle{fancy}


 \fancypagestyle{plain}{%
 \fancyhf{} % clear all header and footer fields
 \fancyhead[R]{\thepage} % except the center
 }

 \begin{document}

 \chapter{Introduction}
 \lipsum

 \chapter{Review}
 \lipsum

 \end{document}
share|improve this question
    
1.25 inch is the bottom 'line' of your page number, so that the foot of the number is placed one that 'line' or is the page number top aligned to that 1.25in top margin? And I suppose that the page number should only the right side if is on a page with odd number, i.e. a recto page and on the left side, if it is a verso page? –  Christian Hupfer Jul 9 at 15:19

3 Answers 3

The \topmargin length is what you're likely looking for. See Page Layout in the LaTeX Wikibook, or the following for more options:

\documentclass[12pt,a4paper]{report}
\usepackage{fancyhdr}
\usepackage{layout}

\setlength{\topmargin}{0.25in}

\fancyhf{}
\fancyhead[R]{\thepage}
\pagestyle{fancy}
\fancypagestyle{plain}
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\thepage} % except the right

\begin{document}

\layout{}

\end{document}

enter image description here

share|improve this answer
    
Just too close, the page number is about 1.35 inch from the top when I tried to print it on an A4-sized paper. I changed the length of the top margin from 0.25 to 0.15, and I got the correct format. Thanks a lot buddy. –  olivarries Jul 10 at 3:24

I suggest usage of the geometry package, with tmargin=1.25in option.

\documentclass[12pt,a4paper]{report}
\usepackage[showframe=true,tmargin=1.25in]{geometry}
\usepackage{fancyhdr}
\usepackage{lipsum}

\fancyhf{}
\fancyhead[R]{\thepage}

\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyhead[R]{\thepage} % except the center
}


\pagestyle{fancy}

\begin{document}

\chapter{Introduction}
\lipsum

\chapter{Review}
\lipsum

\end{document}

enter image description here

The lines are introduced by the showframe=true option, just for checking.

share|improve this answer
    
I used this and printed a page on an A4 paper. However, the page number is just at 0.85 from the top. –  olivarries Jul 10 at 3:08
    
I printed it too and the bottom of the figure was about 1.14in from the top, which is not 1.25in, that is true. The top of the figure was about 1in from the top paper edge. –  Christian Hupfer Jul 10 at 4:31

This solution also uses the geometry package, but takes into account the depth of descenders in the current font. If you want the baseline of page numbers to be exactly at 1.25in from the top of the papersheet, you add these lines to your preamble:

\newlength{\adjustd}
\settodepth{\adjustd}{gjpqy}  
\usepackage[top=\dimexpr 1.25in + \headsep + \adjustd \relax]{geometry}

The following snapshot shows why descenders must be taken into account (geometry loaded with option showframe):

enter image description here

If it's the top of page numbers that you want to be at 1.25in, you have to add two more lines:

\newlength{\adjusta}
\settoheight\adjusta{0123456789}

For uppercase figures, 0 will be enough.

and replace last line above with:

\usepackage[top=\dimexpr 1.25in +\headsep + \adjustd + \adjusta \relax]{geometry}

Of course, if your page numbers use oldstyle figures, 1.25 will be the distance from highest figures (5 and 8) to the top of the sheet, and figures with descenders (3, 4, 5, 7 and 9) should be taken into account in the definition of \adjd. If you want that the top of figures without ascenders be at 1.25in, replace the definition of \adjusta with

\settoheight\adjusta{01234579}.
share|improve this answer
    
I wonder a little bit about the descenders with figures. Is it necessary for 'usual' page number figures to regard descenders (I agree with some kind of calligraphic figures, oldstyle figures, there might be descenders), but perhaps you could provide a screen shot where such descenders occur? –  Christian Hupfer Jul 9 at 18:32
1  
@ Christian Hupfer: Actually there are two problems, and I don't know which you refer to: 1. In any case, simply choosing top=1.25in + headsep will make the baseline of ordinary figures not be at 1.25in of the top of the sheet, but a little less, because headheight takes into account descenders, hnce the 1st solution. I'll include a screenshot that shows this. 2. The case of old style figures for page numbering has been taken into account to be as complete as possible. I agree with you: usual academic work does not use them. –  Bernard Jul 9 at 18:48
    
Thanks for the quick reply. I noted that 'slight' vertical offset in my version too, now I know why, since you explained it. And regarding the second aspect: I was just curious and did not want to criticize you. I agree with you, that style of figures other than 'usual' page number style will occure rarely in papers or in a thesis. –  Christian Hupfer Jul 9 at 19:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.