I'm trying to create this header style in a memoir
document (this is a mock-up in Inkscape):
I thought of tikz
, and I've seen this cool one, but I'm thinking this isn't so complex and tikz
for every header is perhaps overkill.
I can't think of how to do this:
- page number under the head rule in a color box
- lowered head rule (default is just under the header baseline)
- rule and page number bleeding 3mm into the margins
I have got this far:
The layout and so on code is on Github, ready to compile. The part dealing with the headers is in theheaders.sty:
\nouppercaseheads
\newlength\BOOK@bleed
\setlength{\BOOK@bleed}{3mm}
\newlength\BOOK@headWidth
\newlength\BOOK@footWidth
% TODO: header should bleed on each side
%\setlength{\BOOK@headWidth}{\textwidth + 2\foremargin + 2\BOOK@bleed}
\setlength{\BOOK@headWidth}{\textwidth + 2\foremargin}
\setlength{\BOOK@footWidth}{\textwidth}
\makepagestyle{toprightnum}
\makerunningwidth{toprightnum}[\BOOK@footWidth]{\BOOK@headWidth}
\makeheadposition{toprightnum}{center}{center}{center}{center}
\makeheadrule{toprightnum}{\BOOK@headWidth}{0.5pt}
\newcommand\headerFmt{\headerFont\headerSize\color{header}}
\newcommand\pageNumFmt{\pageNumFont\pageNumSize\color{pagenum}}
% TODO: page number should drop under the headrule with a gray
% background
\makeoddhead{toprightnum}%
{\headerFmt%
\hspace*{\foremargin}\MakeLowercase{\rightmark}}%
{}%
{\headerFmt%
\MakeLowercase{\leftmark}%
\parbox[c][][t]{\foremargin}{%
\pageNumFmt%
\mbox{}\hfill\textbf{\thepage}\hfill\mbox{}%
}%
}
\makeevenhead{toprightnum}%
{\headerFmt%
\parbox[c][][t]{\foremargin}{%
\pageNumFmt%
\mbox{}\hfill\textbf{\thepage}\hfill\mbox{}%
}%
\MakeLowercase{\leftmark}%
}%
{}%
{\headerFmt%
\MakeLowercase{\rightmark}\hspace*{\foremargin}%
}
\makeoddfoot{toprightnum}{}{}{}
\makeevenfoot{toprightnum}{}{}{}
\makepsmarks{toprightnum}{%
\def\chaptermark##1{%
\markboth{##1}{\rightmark}}%
\def\partmark##1{%
\markright{##1}{}}%
\let\sectionmark\@gobble
}
Best Answer
I discovered
xcoffins
through this design, after that it was a breeze: