如何才能使每页的页码位于距右上角四分之三英寸处并向内四分之三英寸处?
\documentclass[12pt, a4paper]{report}
\pagestyle{myheadings}
\begin{document}
Peter
\newpage
Palmer
\end{document}
答案1
为了实现你想要的,删除行
\pagestyle{myheadings}
并把
\pagestyle{empty}
我们将使用该包eso-pic
及其\AddToShipoutPicture
宏将页码定位在正确的位置。
也就是说,在你的序言中添加以下几行:
\usepackage{eso-pic}
\AddToShipoutPicture{%
\AtPageUpperLeft{%
\setlength\unitlength{0.25in}%
\hspace*{\dimexpr\paperwidth-1in\relax}%
\makebox(1,-3)[rt]{\thepage}%
}}
梅威瑟:
\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}
为了确保页码位于正确的位置,请取消注释两行注释
\usepackage[step=0.25in,arrows=false,firstcolor=white,secondcolor=white]{pagegrid}
\pagegridsetup{top-right}
从页面右上角开始创建一个宽度为 0.25 英寸的网格。结果是:
答案2
带background
包装和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}