www.xbdev.net
xbdev - software development
Sunday May 28, 2023
home | about | contact | Donations

     
 

LaTeX

Beautiful, Powerful and Fun Document Tools (but requires a little extra work)

 


Chapter Image

There might be occasions when you want to customize the your report/book chapters (e.g., modify the font, layout or add extra graphics).
One particularly nice adjustment you can make is adding an image header to your chapters. The example here makes use of the 'makechapterhead' define.




\documentclass[12pt]{book}
\usepackage{graphicx}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{lmodern}
\usetikzlibrary{calc}

\parindent=0pt

\title{Custom Chapter Title Images}
\author{Kenwright}


\def\chapimg{}

\makeatletter
\newcommand\chapimage[2]{
  \def\chapimg{#1}
}

\def\@makechapterhead#1{%
  \tikz[remember picture,overlay]\node[inner sep=0pt] at ($(current page.north) +
      (-0.0cm,-2.0in)$) {\includegraphics[width=1.8\textwidth]{\chapimg}}; \par
  \vspace{220pt} \par
  {\Huge Chapter \thechapter} \par
  \vspace{20pt} \par
  {\fontsize{50}{60}\selectfont \bfseries #1} \par
  \vspace{50pt} 
}
\makeatother

\begin{document}

\tableofcontents

\chapimage{./images/cht1.jpg}{The Tree}
\chapter[hello world]{Hello World}
\lipsum[1-5]

\chapimage{./images/cht7.jpg}{The Flowerpot}
\chapter[hello plants]{Hello Plants}
\lipsum[10-12]

\end{document}











 

 
 Visitor:
Copyright (c) 2002-2023 xbdev.net - All rights reserved.
Designated articles, tutorials and software are the property of their respective owners.