0

I'd just like to enquire on how this sort of chapter style is done. I am aware it is some permutation of the memoir class with hansen style chapter headings, however the number seems to be in sans-serif, the text in CMU serif, and the document to be in a different font to what I typically find on hansen templates. If anyone could replicate this for me, it would be greatly appreciated.

enter image description here

2 Answers 2

4

You didn't specify, what TeX format you are using. I show you what to do in OpTeX. The printing of the chapter number to the correct place is based to TeX primitive \lower and common macro \rlap, so this idea can be used in other TeX formats (for example LaTeX) too.

OpTeX prints the chapter title by \_printchap macro, so we can copy this macro from OpTeX source and modify it. We added the line beginning by \_lower20pt, other lines are just copy of the source. The printing starts with \_noindent, so we are in horizontal mode without paragraph indentation. Using \_lower20pt\_rlap we shifted the \_rlap box (i.e. its width is zero, its content goes to the right) by 20pt lower. The box includes \_printrefnum[@] which prints the chapter number in OpTeX and creates a destination for hyperlinks. This number is printed with scaled and sans serif font in \LightGrey color. The \_kern3pt shifts the chapter number a little to the right.

\fontfam[lm]

\_def\_printchap #1{\_vfill\_supereject \_prevdepth=0pt
   \_vglue\_medskipamount % shifted by topkip+\medskipamount
   {\_chapfont \_noindent
    \_lower20pt\_rlap{\LightGrey\_setfontsize{at70pt}\sans\_bf \_kern3pt \_printrefnum[@]}
    \_raggedright #1\_nbpar}\_mark{}%
   \_nobreak \_belowtitle{\_vskip2\_bigskipamount}%
   \_firstnoindent
}

\chap First Test

\lorem[1]

\chap Vector Bundles

\lorem[2]

\bye
1

You were on the right track! The example on the picture is very similar to the Hansen style made in the page 38 of this document as a showcase for the memoir class. Shout outs to Lars Madsen as he was the one who came with the original version for that particular setup!

Anyways, here is a code that may do what you need.

\documentclass{memoir}
\usepackage{xcolor}

\definecolor{NColor}{gray}{0.8}                 % Number color
\font\THICC=cmbx30 scaled 3500                  % New font definition

\makechapterstyle{hansen}{%                     % New chapter style
  \renewcommand\printchaptername{}              % Delete the “Chapter” prefix
  \renewcommand\printchapternum{%               % Setup the number format
    \raisebox{-1.6cm}[0pt][0pt]{%               % Align the number vertically
      \kern10pt                                 % Horizontal whitespace
      \color{NColor}                            % Text color
      \THICC                                    % Font type
      \thechapter%                              % Chapter number
    }%
  }
  \setlength\midchapskip{0pt}                   % Reset the chapter skip
  \setlength{\beforechapskip}{2\baselineskip}   % Define preceding skip
  \setlength{\afterchapskip}{\baselineskip}     % Define following skip
  \renewcommand\chaptitlefont{%                 % Setup the title format
    \normalfont                                 % Normal font face
    \HUGE                                       % “Huge” size
    \bfseries                                   % Bold face
    \raggedright                                % Flushed to the right
  }
  \renewcommand\printchaptertitle[1]{%          % Setup the printing
    \parbox[t][60pt]{\textwidth}{%              % Create the text box
      \chaptitlefont ##1}%                      % Use the title format
  }
}

\chapterstyle{hansen}                           % Use the new chapter format

\begin{document}

\let\clearforchapter\par % Consecutive chapters, not needed

\chapter{My First Chapter!}
Good news, everyone! There's a report on TV with some very bad news! Yep, I remember. They came in last at the Olympics, then retired to promote alcoholic beverages! I'm just glad my fat, ugly mama isn't alive to see this day.

This opera's as lousy as it is brilliant! Your lyrics lack subtlety. You can't just have your characters announce how they feel. That makes me feel angry! Man, I'm sore all over. I feel like I just went ten rounds with mighty Thor.

\chapter{Vector Bunbles}
They learn that this topic is incredibly difficult! I have no idea what a “tangent bundle” is! All I know is that this test text contains some big sounding words that I can only dream to one day understand. Oh well, here is a subtitle because why not.

\section{Vector Bundles and Basic Notions}
Here is some math!

\[ \xi = (E(\xi),\pi,B,\oplus,\bigodot) \]

\end{document}

The output should look like this.

Output1

The code and its comments should be self-explanatory, but there are a couple of things to explain just in case.

The memoir class already loads several packages and have many in-build functions that won’t work in other classes. It is possible to do this outside memoir, but since the question pointed to memoir, I thought that this was a requirement.

The only extra package required is xcolor, and it’s only there to make the chapter number grey. This can be achieved too using plain old graphicx, so this is not strictly necessary.

Line 5 uses a TeX primitive to define a “new font”, which is a reliable way to increment the chapter number size without depending on other packages. The “scaled 3500” means that the text is magnified 3.5 times from the used font base. The font family “cmbx” represents Computer Modern Roman Bold. If you’d need, let’s say, Computer Modern Sans, you can change this to “cmss”. A comprehensive list the fonts TeX has in-build may be found at page 350 of Knuth’s TeXBook. This page serves as a good reference as well.

Line 8 is necessary because by default, each chapter name includes “Chapter” as a preamble, this just gets rid of it.

Line 10 allows to align the number with the chapter name, just modify the “-1.6cm” to tune it as you please. Line 11 defines a horizontal indentation of 10pt, just to push the number a little bit to the left if you need it, otherwise you can change it or simply delete it.

Line 27 value gives some extra space vertically on top of the already defined base line skips.

Line 36 is just to showcase two chapters in one page. Deleting it reverts to print only one chapter per page.

Needless to say, this works because the font size of the document is the default one. In case you need to modify it or use another font that is not the TeX originals via fontspec or similar, you may need to tune the numbers to fit the chapter title as you please, but with a bit of trial and error, that shouldn’t be too difficult.

Hopefully this helps you!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .