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.

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

enter image description here

share|improve this question
    
Is the 3 the chapter, and 11 the page number? –  cmhughes Jan 7 '13 at 16:50
    
No, 3 is the page number, and 11 is the number of pages. Thanks for your interest. –  Nesbit Jan 7 '13 at 17:36

1 Answer 1

up vote 3 down vote accepted

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}
share|improve this answer
    
Perfect! Thank you so much, tohecz! –  Nesbit Jan 8 '13 at 14:15

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.