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.

How do I get the number of each page to be three quarters of an inch down and three quarters of an inch in from the top right hand corner?

\documentclass[12pt, a4paper]{report}
\pagestyle{myheadings}
\begin{document}
Peter
\newpage
Palmer
\end{document}
share|improve this question
    
Note that your question is actually ambiguous because it isn't clear how the measurement relates to the page number. Given that the page number is not a point but itself occupies space on the page, how should the number be located with respect to the point that is .75" down and .75" in? Note that this will become more important if you have more than 9 pages so that you go into double digits. In that case, even if you are careful to use tabular, lining figures to number the pages, you will still need to know what should happen as the numbers change the space they occupy. –  cfr Mar 9 at 2:57
    
@lockstep In my current document the number for each page is in a specific location in the top right corner. I want to move each number higher and to the right on the page. –  Peter Palmer Mar 9 at 5:54

2 Answers 2

up vote 4 down vote accepted

To achieve what you want, remove the line

\pagestyle{myheadings}

and put

\pagestyle{empty}

We will use the package eso-pic and its \AddToShipoutPicture macro to position the page number in the right place.

That is, add the following lines in your preamble:

\usepackage{eso-pic}
\AddToShipoutPicture{%
  \AtPageUpperLeft{%
    \setlength\unitlength{0.25in}%
    \hspace*{\dimexpr\paperwidth-1in\relax}%
    \makebox(1,-3)[rt]{\thepage}%
}}

MWE:

\documentclass[12pt, a4paper]{report}

%\usepackage[step=0.25in,arrows=false,firstcolor=white,secondcolor=white]{pagegrid}
%\pagegridsetup{top-right}

\usepackage{eso-pic}
\AddToShipoutPicture{%
  \AtPageUpperLeft{%
    \setlength\unitlength{0.25in}%
    \hspace*{\dimexpr\paperwidth-1in\relax}%
    \makebox(1,-3)[rt]{\thepage}%
}}

\pagestyle{empty}

\begin{document}
Peter
\newpage
Palmer
\end{document} 

Just to be sure that the page number is in the correct position, uncomment the two commented lines

\usepackage[step=0.25in,arrows=false,firstcolor=white,secondcolor=white]{pagegrid}
\pagegridsetup{top-right}

which create a grid of width 0.25 inches starting from the upper right corner of the page. The result is:

enter image description here

share|improve this answer
    
when I use your suggested MWE I now get a single page numbered 1 at the bottom and eso-pic.dtx printed on the page. –  Peter Palmer Mar 8 at 22:29
    
I get the following error messages when I run your MWE: (i) undefined control sequence \DocInput (ii) undefined control sequence \EnableCrossrefs\CodelineIndex\RecordChanges (iii) two \documentclass or \documentstyle commands. –  Peter Palmer Mar 9 at 5:36
    
Thank you this worked. I needed to remove some of my packages before I got the result. However the general layout has now changed. –  Peter Palmer Mar 9 at 17:53

With background package and tikz

\documentclass[12pt, a4paper]{report}

\usepackage{background}
\usetikzlibrary{calc}
\backgroundsetup{
angle=0,
scale=1,
opacity=1,
color=black,
contents={%
\begin{tikzpicture}[remember picture, overlay]
  \node[anchor=north east,inner sep=0pt] at ($(current page.north east) + 
                                          (-0.75in,-0.75in)$) {\thepage};
\end{tikzpicture}%
}
}
\pagestyle{empty}

%\usepackage[step=0.25in,arrows=false,firstcolor=white,secondcolor=white]{pagegrid}
%\pagegridsetup{top-right}

\begin{document}
Peter
\newpage
Palmer
\end{document}

enter image description here

share|improve this answer
    
When I use your MWE this is printed on page 1: calc angle=0, scale=1, opacity=1, color=black, contents=[remember picture, overlay] [anchor=north east,inner sep=0pt] at ((currentpage.northeast)+ (−0.75in,−0.75in)) 1; Peter. Palmer is printed on page 2 but there is no page number. Also there are 6 errors. –  Peter Palmer Mar 8 at 22:46
    
I copied your MWE just as you have it. The error messages are: (i) \begin{document} ended by \end{tikzpicture} (ii) undefined control sequence \node (iii) environment tikzpicture undefined (iv) undefined control sequence \backgroundsetup (v) missing \begin{document} (vi) undefined control sequence \usetikzlibrary –  Peter Palmer Mar 8 at 23:40
    
I have \background.sty but I do not have \tikz.sty. –  Peter Palmer Mar 9 at 5:38
    
The code works but it does not give me the result I needed. Thanks you. –  Peter Palmer Mar 9 at 18:07
    
@PeterPalmer You have to compile it 2-3 times to get the correct page. Then it works. –  Harish Kumar Mar 9 at 22:29

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.