2

I'm wondering how to achieve this header style using two rules with a thick one on the bottom, and the page number in a shadowed square ?.

The version in the image below is the right page version. page header

1

This is a rather crude (but sufficient) way of constructing the shadowed boxes. \headrulewidth specified the wider/thicker rule while \hrulefill sets a thinner/regular rule.

enter image description here

\documentclass[twoside]{article}

\usepackage{fancyhdr,xcolor}
\usepackage{lipsum}

\setlength{\headheight}{20pt}% Adjust based on content
\fancyhf{}% Clear header/footer
\renewcommand{\headrulewidth}{2pt}% Thick header rule
\renewcommand{\footrulewidth}{0pt}% No footer rule (default)
\fancyhead[LO]{Some header text \hrulefill\hspace*{4em}}%
\fancyhead[RO]{
  \raisebox{\depth}[0pt][0pt]{\makebox[0pt][r]{\colorbox{black}{\makebox[4em]{\phantom{\thepage}}}\hspace*{2pt}}}%
  \makebox[0pt][r]{\raisebox{5pt}{\fcolorbox{black}{white}{\makebox[4em]{\thepage}}}}%
}
\fancyhead[RE]{\hspace*{4em}\hrulefill Some header text}%
\fancyhead[LE]{
  \raisebox{\depth}[0pt][0pt]{\makebox[0pt][l]{\colorbox{black}{\makebox[4em]{\phantom{\thepage}}}}}%
  \makebox[0pt][l]{\hspace*{2pt}\raisebox{5pt}{\fcolorbox{black}{white}{\makebox[4em]{\thepage}}}}%
}
\pagestyle{fancy}

\begin{document}

\sloppy\lipsum[1-50]

\end{document}

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.