4

I am writing a book using the book document class. I have used a template I found online to make my chapter headings look like this:

My book

I would prefer to add an image to my chapter heading and achieve an effect similar to this:

Operating System Concepts - Introduction

Is there a particular package that allows me to modify the chapter heading in such a way? I have no idea how to go about it, any help will be much appreciated.

6
  • 1
    Titlesec allows you to do about what you want, but the problem is LaTeX can't simply produce such an image. Is it for a comic book?
    – Bernard
    Mar 8, 2016 at 22:36
  • @Bernard Can I import my own image using Titlesec? Mar 9, 2016 at 20:28
  • Via \includegraphics, yes (if it's in one of the formats known to pdflatex).
    – Bernard
    Mar 9, 2016 at 20:39
  • @Bernard Could you give me an example of how the syntax would look? Especially to overlay the chapter number over the image. I've been reading through the documentation but I haven't managed to grasp it. Mar 12, 2016 at 9:52
  • I tagged this tikz-pgf. Maybe it attracts some users.
    – Johannes_B
    Jul 21, 2016 at 14:06

1 Answer 1

5

To give you something to start with:

\documentclass{book}
\usepackage{xcolor}
\usepackage{titlesec}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage[percent]{overpic}
\usepackage{fix-cm}    
\usepackage{lipsum}

% formats: \chapter
\newcommand\ctformatchapter[1]{%
    \parbox[b][6cm][b]{\dimexpr.5\textwidth\relax}{%
        \raggedright%
        \textcolor{cyan!50!blue}{\textsf{#1}}%
    }%
}


\titleformat{\chapter}[display]%
{\fontsize{20pt}{20pt}\bfseries\selectfont}%
{%
    \raggedleft{%
        \begin{overpic}[width=0.5\textwidth]{ctan-lion}
            \put (30,42) {\rotatebox{-20}{\fontsize{60pt}{60pt}\selectfont\textsf{\Roman{chapter}}}}
            \put (20,50) {\textcolor{cyan!50!blue}{\textsf{Chapter}}}
        \end{overpic}               
    }%
}%
{-6.5cm}%
{\ctformatchapter}%
[\phantomsection]   

\begin{document}
    \chapter{Introduction}
    \lipsum
\end{document}

enter image description here

0

You must log in to answer this question.

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