Let's say I am producing a book (using \documentclass{book}
) where instead of displaying the chapter name textually, I am inserting an image that includes the chapter text. How can I still start a new chapter and set the chapter name (for headings and TOC) without actually displaying that it's a new chapter?
The code I have right now is:
\chapter{My Chapter Title}
\AddToShipoutPicture*{\centering \includegraphics[width=\paperwidth]{chapter-1.png}}
\phantom{asdf}
where chapter-1.png
is of course my full-page image, and the \phantom{asdf}
is apparently necessary for \AddToShipoutPicture
to work right.
Based on "How to format the chapter heading" I tried both of these in my preamble, and neither one worked:
% Generated "LaTeX error: Missing \begin{document}"
\renewcommand{\@makechapterhead}[1]{
\vfill
}
% Had no effect
\def\@makeschapterhead#1{
\vfill
}
Is there something else I can do to change the \chapter template, or even an internal variable that it can set? I'm pretty new to customizing TeX layouts, and have previously only used the predefined styles for thesis et al, so I'm a bit lost.
Best Answer
I would define a new command
\picturechapter
that does it all.Pre Solution step only for demonstration
Only to have a complete minimal working example, we first make a PDF with all the chapter page pictures. You don't need this in real world, where you already have the chapter page pictures!
Save this with the name
chapterpages.tex
and dopdflatex chapterpages
to makechapterpages.pdf
. This step has been done only to have a test base for the following suggested solution!Solutions Suggestion
Now let's define a new command
\picturechapter
that loads one pagechapterpages.pdf
to be our chapter picture page, but set up toc entry and running head line like a real\chapter
would:After processing this file with pdflatex you get an example pdf with green chapter starting picture pages, that are shown at the table of contents with the headings "1 This is my first picture page", "2 Heading on level 0 (chapter)", "2 Heading on level 0 (chapter)", "3 Heading on level 0 (chapter)". Even the hyper links from the table of contents to the green pages are working. The running head at the pages following the green chapter pages are set too.
The suggested solution has been testes with
book
andscrbook
(a KOMA-Script class). But is should work also withreport
orscrreprt
or almost every class with\chapter
. To use it with an article class, you have to replacechapter
bysection
and\chaptermark
by\sectionmark
.Alternative 1 to the shown suggestion (one file per picture)
If you want to use not a single file
chapterpages.pdf
with all the pictures, but single fileschapter-1.png
,chapter-2.jpg
,chapter-3.pdf
etc. you simply have to replace\singlepicturesfalse
by\singlepicturestrue
. In this case it would even work with appendix with numbersA
,B
,C
etc. The corresponding file names would bechapter-A.png
,chapter-B.png
etc.Alternative 2 (be independent from chapter counter) NOTE: If you redefine
\thechapter
using\singlepicturesturetrue
, you have to redefine your chapter pictures too. To avoid this, you may use your own counter:In this case the pictures at the appendix would be names
chapter-9.png
,chapter-10.pdf
etc (if the last chapter before the appendix has been 8).Alterative 3: (each picture file has it's own name independent from the number of the chapter)
As an alternative you may define a command with a second argument: the name of the chapter picture (you cannot test this with the example above because
\blinddocument
will not set the second argument):Usage would be:
Advantage of this solution would be, that you don't need to rename chapter picture files, if you move, remove or insert chapters into the document.