25

I'm reading a document created with TeX, and it has rather nice chapter headings. Does anyone know how this was done? Fancy Chapter Headings

Update

Ok, I've got quite far using TikZ, the only thing I haven't got is the number extending into the margin:

\usepackage{titlesec}
\usepackage{tikz}
\usetikzlibrary{calc} 

\titleformat{\chapter}[display]
{}
{\hfill \tikz[remember picture] \node[] (nr) {\fontsize{20}{70}\selectfont\color{black}\textsc{Chapter~~} \fontsize{60}{70}\selectfont\color{black}\thechapter};
\begin{tikzpicture}[overlay,remember picture]
\coordinate (rightborder) at ($(nr)+(100,0)$);
\coordinate (right) at ($(nr.east) + (0.5,0)$);
\draw[line width=4.5em] (right) -- (rightborder);
\end{tikzpicture}}
{-1ex}
{\filleft\fontsize{30}{50}\selectfont}
[\vspace{-1ex}]
2

2 Answers 2

18

It's the Veelo chapterstyle from the memoir class.

1
  • Well spotted! Thanks Martin, but this is still technically the correct answer.
    – fredley
    Mar 26, 2011 at 17:44
13

You can create this effect using a \rlap{} box in a ragged-left chapter line. The huge number could be zoomed using graphics and the black box can be simply created using \rule.

You can use the titlesec package to adjust the \chapter style to use this code (I adapted Stefan Kottwitz's solution of Center aligning chapters).

\documentclass{book}
\usepackage{graphics}

\usepackage{titlesec}
\titleformat{\chapter}[display]
  {\normalfont\Large\raggedleft}
  {\MakeUppercase{\chaptertitlename}%
    \rlap{ \resizebox{!}{1.5cm}{\thechapter} \rule{5cm}{1.5cm}}}
  {10pt}{\Huge}
\titlespacing*{\chapter}{0pt}{30pt}{20pt}

\usepackage{lipsum}
\setcounter{chapter}{2}
\begin{document}

\chapter{Implementation}
\lipsum
\end{document}

The rule width of 5cm is just a guess. You could calculate the exact value but simply using a large enough value works as well. Any overhang over the page is not shown anyway.

Result

4
  • I've used this, with a ~ after Chapter and another after the numeral for a slightly nicer layout. Otherwise great, thank you very much!
    – fredley
    Mar 26, 2011 at 16:59
  • Thanks so much for this nice solution, however I have problem with this one if the margin is mall and the chapter numbers are having two digits. Is there a way establish consitency also in these cases?
    – bonanza
    Feb 6, 2019 at 12:51
  • 1
    @bonanza: (1) You could move the "CHAPTER" text to the left to leave more space for the number and the rule. For this add \hspace{2cm} after \rlap{...}. However, this makes the number be misaligned with the margin, which might not look good. (2) Alternatively, keep the number in the normal text area and only put the rule into the margin. For this simply move ` \resizebox{!}{1.5cm}{\thechapter}` from inside \rlap{..} to infront of it. Feb 6, 2019 at 13:02
  • Dear martin, How can I remove the chapter before the chapter number? I did \renewcommand{\chaptername}{\hfill} for now
    – MrPajeet
    May 7, 2020 at 1:00

You must log in to answer this question.

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