How to put a figure on the facing page of a chapter page with correct numbering?
You can (and should) define a command doing the work, rather than explicitly set all those commands for each chapter.
My idea is to define a \chapterfigure
command that has one optional argument and two mandatory ones; the optional argument and the first mandatory one are used for \includegraphics
, while the final argument contains the caption.
The command steps the chapter
counter, so the number for the figure will be correct; after the figure the counter is stepped back, so when \chapter
is processed, the chapter number will be right; then we patch \memendofchapterhook
so that it steps the figure
counter (that would have been reset to zero by \chapter
) and redefines itself to its previous value (usually nothing, but one never knows). Similarly, we issue \insertchapterspace
, then redefine it to simply redefine itself to its previous value, so when the command is called by \chapter
it does nothing else than putting us back to the original situation.
For a chapter without a facing figure, just issue \chapter
by itself. A label for \chapterfigure
should be in a trailing optional argument, to reflect the syntax of sidecaption
; so
\chapterfigure[<options for includegraphics>] % optional
{<graphic file name>} % mandatory
{<caption>} % mandatory
[<label>] % optional
Here's a complete example
\documentclass{memoir}
\usepackage{xparse}
\usepackage[demo]{graphicx}
\NewDocumentCommand{\chapterfigure}{O{} m m o}{%
\insertchapterspace
\cleartoevenpage{\thispagestyle{empty}}
\stepcounter{chapter}
\begin{figure}[p]
\IfNoValueTF{#4}
{\begin{sidecaption}{#3}}
{\begin{sidecaption}{#3}[#4]}
\includegraphics[#1]{#2}
\end{sidecaption}
\end{figure}
\addtocounter{chapter}{-1}
\let\keptmemendofchapterhook\memendofchapterhook
\renewcommand{\memendofchapterhook}{%
\stepcounter{figure}%
\keptmemendofchapterhook
\let\memendofchapterhook\keptmemendofchapterhook}%
\let\keptinsertchapterspace\insertchapterspace
\renewcommand\insertchapterspace{%
\let\insertchapterspace\keptinsertchapterspace}%
}
\begin{document}
\frontmatter
\tableofcontents
\listoffigures
\mainmatter
\chapterfigure[width=5cm,height=3cm]{somepic}
{A caption for this figure}
% Here's how to call it if there's a label
%\chapterfigure[width=5cm,height=3cm]{somepic}
% {A caption for this figure}[chapfig:one]
\chapter{A title for this chapter}
Some text
\begin{figure}[htp]
\centering
\includegraphics{xyz}
\caption{A caption to see it has the correct number}
\end{figure}
Some text
\end{document}