I am trying to inset a single small image over the top of two larger figures separately on the same page, within a floatrow
\ffigbox
environment, but it seems as though floatrow
has a problem with doing this kind of thing (overpic
, which was a bit easier to use, had the same issue - most people seem to use tikz
though?).
I was able to add my inset image within the floatrow environment ok, the problem is that the figure on the following page is now being replaced by the smaller inset figure.
I did find this answer to another question which seems like it is probably related, but the answer there looks pretty complicated.
I would avoid using floatrow, but it is included inside another package I am using elsewhere in the document. Commenting out the auto-pst-pdf package also fixes the problem, but this is also something I want to use. Is there a way I can make all of these things work together?
MWE:
\documentclass[11 pt]{report}
\usepackage[runs=2]{auto-pst-pdf}
\usepackage{graphicx}
\usepackage{floatrow}
\usepackage{tikz}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{floatrow}
\ffigbox[\FBwidth]{%
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.9\textwidth]{images/bigimage1}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\node[anchor=south west,inner sep=0] (image) at (0.05,0.65){\includegraphics[scale=0.8]{images/smallinset1}};
\end{scope}
\end{tikzpicture}
}%
{\caption{caption1}}
\end{floatrow}
\begin{floatrow}
\ffigbox[\FBwidth]{%
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.9\textwidth]{images/bigimage2}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\node[anchor=south west,inner sep=0] (image) at (0.05,0.65) {\includegraphics[scale=0.8] {images/smallinset1}};
\end{scope}
\end{tikzpicture}
}%
{\caption{caption2}}
\end{floatrow}
\end{figure}
\clearpage
\begin{figure}[ht]
\centering
\includegraphics[scale=0.8]{second large figure}
\caption{wrong image appears here}
\end{figure}
\end{document}
This is what I am getting currently:
The first page is fine, the images have overlaid correctly, but for some reason figure 3 is being replaced by the first inset figure.
edit: When compiling I get this error -
Package pst-pdf Warning: `untitled-2-pics.pdf' contains 7 pages but 3 pages are requested: File `untitled-2-pics.pdf' is no more valid! Recreate it .
Looking at this file, the first inset figure (small inset) appears 6 times, and the figure that I want to be in figure 3 is on the last page. so I think it is something to do with floatrow calling that image too many times?
floatrow
doesn't has anything with images positions. can you provide a sketch which show what you like to obtain?