I am trying to get an image at the right, with a side caption at bottom to the left - and text wrapping all of that (meaning both caption and image).
When I use the minimal example as given below, I get: That is, image that is to wrap is pushed to the bottom, and wrapping thus doesn't occur.
Then I uncomment "\vspace{-0.8\imgh}", and I get closest to what I want to achieve: The text before the "wrapfigure" seems to wrap correctly, but not the text after the "wrapfigure".
Then, to test if this approach truly works, I also uncomment the "more text before" section, and I get: That is - the "before" text is indeed wrapped, but it also "pushes" the image down, and keeps on being wrapped when it doesn't need to.
Finally, for testing, I uncomment the "more text after" part, and I get:
and this "after" text completely ignores any wrapping.
I'm also noting that the side caption itself doesn't wrap the text in any of these examples (maybe this particular mix makes either 'floatrow' or 'wrapfig' choke?)
Can I please get some help on this - is what I want to do impossible with wrapfigure and fcapside, or am I just using them wrong?
Thanks,
Cheers!
Code: Select all
% fwraptest.tex
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc} %support unicode chars direct without crashing :)
\usepackage{graphicx}
\usepackage{hyperref}
\usepackage[font=footnotesize,labelfont=bf,textfont=it]{caption} %many ways to customise the captions - text justification
\usepackage{subcaption} % so we can modify subcaptions - understands subfloat command
%\usepackage{float} %floating latex objects % "! Package floatrow Error: Do not use float package with floatrow."
%\usepackage{sidecap} % side captions to images - use floatrow instead
\usepackage{floatrow} % side captions to images - instead of sidecap
\usepackage{wrapfig} % for wrapping images
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%\footnotesize
What I want to get, is an image at the right, with a side
caption at bottom to the left - and text wrapping all of that.
\bigskip
% some length variables:
\newlength{\imgh} \setlength{\imgh}{2.0236in} % image height
\newlength{\imgw} \setlength{\imgw}{3.5339in} % image width
\newlength{\capw} \setlength{\capw}{1.5in} % caption width
% I am trying to group the text and image below using curly braces {}, to
% sort of "ask" the compiler to think of them as the same unit.
{
In this space, I'd like the wrapping to start - so, this is some text before the wrapfigure...
% uncomment below for more text before
% More BEFORE... More BEFORE... More BEFORE... More BEFORE... More BEFORE...
% More BEFORE... More BEFORE... More BEFORE... More BEFORE... More BEFORE...
% More BEFORE... More BEFORE... More BEFORE... More BEFORE... More BEFORE...
% More BEFORE... More BEFORE... More BEFORE... More BEFORE... More BEFORE...
% More BEFORE... More BEFORE... More BEFORE... More BEFORE... More BEFORE...
% % do not leave space here! comment the line, even if all you need is space
%\begin{wrapfigure}[12]{r}[-2in]{3.5339in}
\begin{wrapfigure}{r}{\imgw} %\fcapside will crash without {r}{3.5339in} args !
%\vspace{-0.8\imgh}
\fcapside{
\captionsetup{justification=centerlast,width=\capw}
\caption[]{A generic image, for testing wrap.}
\label{fig:XX}
} % fcapside
{\includegraphics[height=\imgh,viewport=0 0 400 400,clip]{imgtest.png}}
\end{wrapfigure}
% % do not leave space here! comment the line, even if all you need is space
Here is some more text after the wrapfigure, to test for wrapping; but quite
possibly the text after the wrapfigure does not count in the wrap.
% uncomment below for more text after
% More AFTER... More AFTER... More AFTER... More AFTER... More AFTER...
% More AFTER... More AFTER... More AFTER... More AFTER... More AFTER...
% More AFTER... More AFTER... More AFTER... More AFTER... More AFTER...
% More AFTER... More AFTER... More AFTER... More AFTER... More AFTER...
% More AFTER... More AFTER... More AFTER... More AFTER... More AFTER...
% More AFTER... More AFTER...
}
\end{document}