# Bringhurst chapter style in memoir

I'm trying to imitate Robert Bringhurst's chapter style in memoir. The class includes one such chapter style, but does not typeset the chapter number on the right side margin, as in Bringhurst's book. This is a sample of Bringhurst's The Elements of Typographic Style (grabbed from Amazon):

My MWE is as follows:

\documentclass{memoir}
\usepackage{kantlipsum}
\makeatletter
\makechapterstyle{Bringhurst}{%
\chapterstyle{default}
\renewcommand*{\printchaptername}{}
\renewcommand*{\printchapternum}{%
\makebox[0pt][l]{%
\hspace{\textwidth}%
\resizebox{!}{\beforechapskip}{\chapnumfont \thechapter}%
}%
}%
\renewcommand*{\afterchapternum}{}
\renewcommand*{\printchaptertitle}[1]{%
\raggedright\large\scshape\MakeUppercase{##1}}
\renewcommand*{\afterchaptertitle}{%
\vskip\onelineskip \hrule\vskip\onelineskip}}
\makeatother
\frenchspacing
\begin{document}
\chapterstyle{Bringhurst}
\chapter{This Is My First Chapter}
\kant[3]
\end{document}


which renders thus:

How can I fix my code in order lower the chapter number to the level of the first text line before the chapter title?

-
I was thinking in using textpos package, but there must surely be a simpler way. – NVaughan Jan 1 '13 at 23:26
I can't answer your question, but I can tell you that Eivind Uggedal's Master's thesis using classicthesis.sty has what you are looking for. It (PDF) and source are freely available on the web. – user23861 Jan 2 '13 at 0:15
@bennettr: Welcome to TeX.SE! This site focuses more on Questions and Answers- it's a little different from other forum-based sites :) I've flagged this answer, so it will probably be converted to a comment – cmhughes Jan 2 '13 at 0:20
– lhf Mar 9 at 14:40

Here is a third suggestion, this time using xcoffins. It has an easy and intuitive way of handling boxes that need to be joined, attached, shifted... one should note, though, that xcoffins' syntax might still change in the future.

The basic idea is simple: define coffins (i.e. boxes)

\NewCoffin\testA
\NewCoffin\testB


set them to contain what you like

\SetHorizontalCoffin\testA{\huge A}
\SetHorizontalCoffin\testB{bbb}


rotate, scale or resize them, join (bounding box is extended to contain both, \JoinCoffins) or attach (bounding box is not extended, \JoinCoffins*) them using so-called handles or poles and maybe used some horizontal or vertical offset

% join bottom center of \testA with top center of \testB
% and shift \testB 1em down:
\JoinCoffins\testA[hc,b]\testB[hb,t](0pt,-1em)


and finally typeset them:

\TypesetCoffin\testA


This is all very well explained in the documentation.

I use this idea below using three coffins: \main is used as a shell that will be filled with contents and typeset in the end. \titleline is filled with a horizontal ruled and joined with \main, \chapternumber is filled with the scaled and coloured chapter number for numbered chapters or is left empty else. It is then attached to main and shifted into the margin and (what seemed an appropriate amount) down:

\documentclass[b5paper]{memoir}
\usepackage[T1]{fontenc}
% not then font used by Bringhurst, but anyway:
\usepackage{libertine}
% we want to letterspace uppercased words and those in small caps, so:
\usepackage{microtype}

% the chapter style:
\usepackage{xcoffins,xcolor}
\NewCoffin\main
\NewCoffin\titleline
\NewCoffin\chapternumber

\makechapterstyle{Bringhurst}{%
\renewcommand*\printchaptername{}
\renewcommand*\afterchapternum{}
% numbered chapters:
\renewcommand*\printchapternum{%
\SetHorizontalCoffin\chapternumber{%
\textcolor{black!10}{\thechapter}%
}%
\ScaleCoffin\chapternumber{8}{8}%
}
% unnumbered chapters:
\renewcommand*\printchapternonum{\SetHorizontalCoffin\chapternumber{}}
\renewcommand*\printchaptertitle[1]{%
\memRTLraggedright\normalfont\large\MakeUppercase{\textls[75]{##1}}}
\renewcommand*\afterchaptertitle{%
\vskip.5\onelineskip
\SetHorizontalCoffin\titleline{\color{black!50}\rule{\linewidth}{1.5pt}}%
\JoinCoffins\main\titleline
\JoinCoffins*\main\chapternumber(\textwidth+\marginparsep,-4\baselineskip)%
\TypesetCoffin\main
\vskip\onelineskip
}
}

\chapterstyle{Bringhurst}

% sections and subsections:

% the section style:
\noindent\normalfont\scshape\MakeLowercase{\textls[50]{#1}}}
\setsecindent{0pt}

% the subsection style:
\setsecnumdepth{subsection}

% the subsubsection style:

\usepackage{lipsum}
\begin{document}

\chapter{The Grand Design}
\section{First Principles}
\subsection{Typography exists to honor content}

\lipsum

\end{document}


-
It's very handy to design all sorts of layouts (titlepages...) – clemens Jan 2 '13 at 20:31
xcoffins is useful but this doesn't address what I thought was the main issue in the question of attaching the number to the first line of text even if there are intervening (section or subsection) headings. – David Carlisle Jan 3 '13 at 0:41
@DavidCarlisle I can't read that from the question but maybe I'm mistaken. Anyway, it's not how it's set in Bringhurst's Elements - the chapter number is always set relative to the rule beneath the title there (I've checked my copy just to be sure) – clemens Jan 3 '13 at 1:16
yes I know:-) well anyway you got the tick so that's OK, I just thought I'd note for the record that I answered a different question in the code below, would have beem much easier otherwise, as you show to drop the number in the afterheading code, I was guided (mislead?) by the phrase "first text line" – David Carlisle Jan 3 '13 at 1:20

This lines the baseline of the number with the baseline of the text, you may want to raise it a bit.

\documentclass{memoir}
\usepackage{kantlipsum}
\makeatletter
\makechapterstyle{Bringhurst}{%
\chapterstyle{default}
\renewcommand*{\printchaptername}{}
\renewcommand*{\printchapternum}{%
}%
\renewcommand*{\afterchapternum}{}
\renewcommand*{\printchaptertitle}[1]{%
\raggedright\large\scshape\MakeUppercase{##1}}
\renewcommand*{\afterchaptertitle}{%
\vskip\onelineskip \hrule\vskip\onelineskip
\gdef\insertchapnum{%
\global\let\insertchapnum\relax
\makebox[0pt][l]{%
\hspace{\textwidth}%
\smash{\resizebox{!}{\beforechapskip}{\color[rgb]{.5,.5,.5}\chapnumfont \thechapter}}}}%
}}

\@nobreaktrue
\everypar{%
\if@nobreak
\@nobreakfalse
\clubpenalty \@M
\if@afterindent \else
{\setbox\z@\lastbox\insertchapnum}%
\fi
\else
\clubpenalty \@clubpenalty
\everypar{}%
\fi}}

\makeatother
\frenchspacing
\begin{document}
\chapterstyle{Bringhurst}
\chapter{This Is My First Chapter}
\section{A section title in the way}
\kant[3]

aaa
\end{document}


In the above, \@afterheading which is the code LaTeX inserts to suppress indentation of the first paragraph of a section is redefined to insert a token \insertchapnum after removing the indentation. \chapter defines \insertchapnum to use the code you had to insert a number (I just made it grey rather than black) and then globally redefine \insertchapnum to \relax so it does nothing until the next \chapter command defines it again.

-
Thanks! Nice result. But could you explain the code, please? – NVaughan Jan 2 '13 at 3:44
note added as requested – David Carlisle Jan 2 '13 at 7:16

I have been playing with page layouts, and have carefully reproduced aspects of Bringhurst's design, including an explicit calculation of the page parameters, measure, etc. The result was achieved using the titlesec package, placing the chapter number with the marginnote package:

% Set the font
\defaultfontfeatures{Scale=MatchLowercase,
Mapping=tex-text}
\setmainfont[Mapping=tex-text, % E.g. -- -> en-dash
Numbers=OldStyle,
UprightFeatures={LetterSpace=-0.9},
ItalicFeatures={LetterSpace=0.9},    % To cancel -0.9 tracking
SmallCapsFeatures={LetterSpace=10.0},
]{Minion Pro}

\setkomafont{marginnote}{
\fontsize{7pt}{9pt}\selectfont}
\setkomafont{chapternumber}{%
\fontspec[Numbers=OldStyle]{TeX Gyre Pagella}
\fontsize{72pt}{72pt}\selectfont}
\setkomafont{sectioning}{\normalfont}

\setkomafont{section}{\scshape}
\setkomafont{subsection}{\itshape}

% Chapters open on the right page.
\KOMAoptions{open=right}

\setlength{\parindent}{1.5em}
% Chapter formatting
\titleformat{name=\chapter}
[block]
{} % format
{\marginnote{\usekomafont{chapternumber}\thechapter}
[3\baselineskip]} % label
{0pt} % separation between label and heading
{\raggedright\usekomafont{chapter}\MakeTextUppercase} % before
[\trule] % after
\titlespacing*{\chapter}{0pt}{-\topskip}{0pt}

% Bringuest has the whole text flush left, so do not typeset the label
% independently here or the text will hang.
\titleformat{name=\section}
{\usekomafont{section}} % format
{} % label
{0pt} % separation between label and heading
{\thesection\hspace{0.5em}\MakeTextLowercase} % before
\titleformat{name=\subsection}
{\usekomafont{subsection}} % format
{} % label
{0pt} % separation between label and heading
{\raggedright{\normalfont\thesubsection}\hspace{0.5em}} % before

\titlespacing*{\section}{0pt}{0pt}{\baselineskip}
\titlespacing*{\subsection}{0pt}{\baselineskip}{\baselineskip}


The complete source is too long to post (it includes a modification to geometry that allows page changes in the middle of a document, and explores other typographic styles) but is available on bitbucket: Exploring Typography with LaTeX. Here is the result:

As you can see, I am still having some problems with the margin-notes, but the spacing, measure, and positioning of the chapter number is almost identical to Bringhurst's design (as a demonstration of how to do this in LaTeX rather than a suggestion that one should strive to exactly reproduce this style.)

Update

Here are the same ideas applied to the memoir class. Note: I am not fluent in memoir and had a little bit of difficulty getting the space before the section heads properly adjusted, so the vertical alignment is not exactly correct here (and I have not adjusted the page size etc. I just blindly set the text box to match Bringhurst's measurements.)

Note also that Bringhurst places the chapter numbers at the same vertical position regardless of the title text: it does not move up or down with the first line of text so that it will always be in the same place for a reader flipping through pages in the book.

\documentclass{memoir}
\usepackage{fontspec}
\usepackage{marginnote}
\usepackage{xparse}      % So we can define \trule with two optional args
\usepackage{xcolor}

% This rule will take exactly \baselinskip space, maintaining the grid. The
% raise value is the height above the next baseline. It will extend down
% thickness.
% \trule[thickness][raise]
\NewDocumentCommand\trule{O{0.4pt}O{0pt}}{
\vskip0pt\vtop to0pt{
\noindent\raisebox{#2}{\vbox{\leavevmode\hrule height#1}}}
}

\defaultfontfeatures{Scale=MatchLowercase,
Mapping=tex-text}
\setmainfont[Mapping=tex-text, % E.g. -- -> en-dash
Numbers=OldStyle,
UprightFeatures={LetterSpace=-0.9},
ItalicFeatures={LetterSpace=0.9},    % To cancel -0.9 tracking
SmallCapsFeatures={LetterSpace=10.0},
]{Minion Pro}

\usepackage{kantlipsum}

\settypeblocksize{496.32431pt}{255.8827pt}{1.25}
\makechapterstyle{Bringhurst}{%
\chapterstyle{default}
\setsecnumdepth{subsection}
\renewcommand{\chaptitlefont}
{\normalfont%
\renewcommand{\chapnumfont}{%
\fontspec[Numbers=OldStyle]{TeX Gyre Pagella}
\fontsize{72pt}{72pt}\selectfont
\color{black!30}}
\renewcommand*{\printchaptername}{}
\renewcommand*{\printchapternum}{%
\marginnote{\chapnumfont \thechapter}[3\baselineskip]
}%
\renewcommand*{\afterchapternum}{}
\renewcommand*{\printchaptertitle}[1]{
\chaptitlefont\raggedright\MakeUppercase{##1}}
\renewcommand*{\afterchaptertitle}{\trule\vspace{\oneline}}

\setsecindent{0pt}
\setbeforesecskip{\onelineskip}
\setaftersecskip{\onelineskip}

\setaftersubsecskip{\onelineskip}
\setsubsecindent{0pt}
}

\frenchspacing
\begin{document}
\chapterstyle{Bringhurst}
\chapter{The Grand Design}
\section{First Principles}
\subsection{Typography exists to honour content}
Like oratory, music, dance, calligraphy -- like anything that lends
its grace to language\ldots

\kant[3]
\end{document}


-
@cgnieder: Gah. Thanks. It should be public now. – mforbes Jan 8 '13 at 21:10
Thanks! Nice answer! But I'm submerged in memoir and don't like very much the Koma classes. – NVaughan Jan 8 '13 at 23:46
@NVaughan: Okay. Here is a memoir version. Note: I have never used memoir before, so am not sure of proper memoir style -- feel free to correct any mistakes. (Also, I had a bit of difficulty with the vertical spacing, so the vertical spacing is not exactly correct.) Anyway, it should give you enough to play with if you want to use the marginnote solution. – mforbes Jan 9 '13 at 1:20
OK! It looks quite similar to the original! Thanks. (Notice, however, that in memoir you don't need the marginnote package, as the class has good support for non-float margin notes.) – NVaughan Jan 9 '13 at 2:33
@mforbes I try to use your memoir version, it work great in general. I have a problem with the text which don't adapt to the page size A4 :/ – reyman64 Apr 3 '13 at 9:42

Another try using textpos:

\documentclass{memoir}
\usepackage[absolute]{textpos}
\usepackage{calc,graphicx}
\usepackage{kantlipsum}
\makeatletter
\makechapterstyle{Bringhurst}{%
\chapterstyle{default}%
\newlength{\numXpos}%
\newlength{\numYpos}%
\setlength{\numXpos}{\hoffset + 1in + \oddsidemargin + \textwidth + \marginparsep}%
\renewcommand*{\printchaptername}{}%
\renewcommand*{\printchapternum}{%
\begin{textblock*}{\textwidth}(\numXpos,\numYpos)
\resizebox{!}{\beforechapskip}{\chapnumfont \thechapter}%
\end{textblock*}
}%
\renewcommand*{\afterchapternum}{}
\renewcommand*{\printchaptertitle}[1]{%
\raggedright\large\scshape\MakeUppercase{##1}}
\renewcommand*{\afterchaptertitle}{%
\vskip\onelineskip \hrule\vskip\onelineskip}}
\makeatother
\frenchspacing
\begin{document}