I would like to place a figure on an even page, then the caption on the following page.
The reason for that is that the figure + caption is too big to fit in one page, but I want the reader to be able to see both image and caption.
Here is a MWE to compile with xelatex:
\documentclass[12pt,english]{extbook}
\usepackage{fontspec}
\usepackage{xunicode}
\usepackage[a4paper]{geometry}
\usepackage[english]{babel}
\usepackage{caption}
\usepackage{afterpage}
\usepackage{ifoddpage}
\usepackage{blindtext}
% Create big picture
\renewcommand{\includegraphics}[2][]{%
\setlength{\fboxsep}{-\fboxrule}%
\framebox{\rule{0pt}{15cm}\rule{10cm}{0pt}}%
}
% Add figure on even page and caption on odd page, plus a ruler to separate caption from text
\newcommand{\doublesidefigurewithruler}[5][1]{%
\afterpage{
\newpage
\checkoddpage
\ifoddpage
\doublesidefigurewithruler[#1]{#2}{#3}{#4}{#5}
\else
\doublesidefigurecontent{#1}{#2}{#3}{#4}{#5}{1}
\fi
}
}%
% Add the figure and the caption
\newcommand{\doublesidefigurecontent}[6]{%
\begin{center}
\vspace*{\fill}
\includegraphics[width=#1\textwidth]{#2}
\captionof{figure}[]{#4}
\label{#3}
\vspace*{\fill}
\end{center}
\newpage
\addtocounter{figure}{-1}
\captionof{figure}[#4]{#4 #5}
\ifnum \numexpr#6=1
\noindent\rule{\textwidth}{0.2pt}
\fi
}%
\begin{document}
\Blindtext
\doublesidefigurewithruler[1]{%
bigfigure}{%
mylabel}{%
Mytitle}{%
\blindtext
\blindtext
}
\Blindtext
\Blindtext
\Blindtext
\end{document}
It does work, but there is probably a better way to do it, right?
In addition, figure numbering is sometimes wrong if I mix this with regular figure environment, and I have to add \clearpage
between two \doublesidefigurewithruler...
.
Besides, I would prefer to place the caption at the bottom of the next page if possible, and I would rather prefer to have an environment:
\begin{doublesidefigure}
\centering
\includegraphics...
\caption[for the toc]{My content}
\label{mylabel}
\end{doublesidefigure}
What I did work, but it is not very robust. How can I do it properly?