6

Could anyone please show me how to get this page number formatting:

enter image description here

2
  • Is the 3 the chapter, and 11 the page number?
    – cmhughes
    Jan 7, 2013 at 16:50
  • No, 3 is the page number, and 11 is the number of pages. Thanks for your interest.
    – f10w
    Jan 7, 2013 at 17:36

1 Answer 1

4

The code should be well-commented I hope.

enter image description here

\documentclass{book}

\usepackage[usenames]{xcolor}
\usepackage{fancyhdr}
\usepackage[vmargin=1in,hmargin={1in,1.5in},headsep=0.3in,headheight=1in]{geometry}
\usepackage{lastpage}

\fancyhf{}
\fancyhead[LE,RO]{{\ooalign{%
\color{black!60!white}% background box color
\rule[0.05in]{0.8in}{1in}% background box raise, width, height
\cr
\hfil\strut\raisebox{0.25in}{% number raise
\sffamily\bfseries\color{white}% number color
\Huge% number fontsize
\thepage
\kern0.1em% distance number-bar
\rule{1pt}{1.4ex}% bar size
\kern0.15em% distance bar-totalnumber
\Large% totalnumber fontsize
\pageref{LastPage}}\hfil
}}}
\fancyheadoffset[LE,RO]{1.2in}% protrusion 
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}

\usepackage{lipsum}% just for dummy text

\begin{document}

\lipsum[1-35]
\newpage
\lipsum[1-35]

\end{document}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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