# Page header of LaTeX and Friends

In Showcase of beautiful typography done in TeX & friends Marc van Dongen shows his book LaTeX and Friends, http://tex.stackexchange.com/a/46348/15360.

He uses a specific page header as can be seen in the pictures he shows us.

Page number <vertical rule> Chapter number


or

Chapter name <vertical rule> Page number


I really like it and would like to get the same format or very similar to it if possible and was wondering how this can be achieved?

-

One option using fancyhdr and the offsets provided by the package. Using

\fancyhfoffset[OR,EL]{\dimexpr\marginparsep+\marginparwidth\relax}


the headers are offset by an amount equal to \marginparsep+\marginparwidth to the right on odd-numbered pages and to the left on even-numbered ones. Then the actual headers are placed using

\fancyhead[OR]{\textsc{\leftmark}\quad\smash{\rule[-.2ex]{1pt}{4cm}}\quad\thepage}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}


A complete example code:

\documentclass{book}
\usepackage{fancyhdr}
\usepackage{lipsum}

\pagestyle{fancy}
\fancyhf{}
\fancyhfoffset[OR,EL]{\dimexpr\marginparsep+\marginparwidth\relax}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}

\begin{document}

\chapter{Test chapter}
\lipsum[1-40]

\end{document}


-
Instead of \enspace\enspace you could use \quad. By the way, I don't know where I read it (and how “important” it is) but \enskip is the LaTeX preferred way, instead of \enspace. –  Manuel May 26 '14 at 1:48
@Manuel I changed to \quad. In this case, there's no difference between \enspace and \enskip; both are kernel commands: the former is a \kern: \def\enspace{\kern.5em } the other is a \hskip: \def\enskip{\hskip.5em\relax}. –  Gonzalo Medina May 26 '14 at 1:57
Using \enspace may be dangerous if it happens to fall at where a paragraph should start, because it would issue a vertical space; \enskip would start horizontal mode, instead, but allowing a line break. A header is normally typeset in restricted horizontal mode, so there's no difference between the two, in that case. –  egreg May 26 '14 at 9:27