Graphics, Figures & TablesWrapfigure with side caption (fcapside) ?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sdaau
Posts: 26
Joined: Fri Feb 19, 2010 2:08 pm

Wrapfigure with side caption (fcapside) ?

Post by sdaau »

Hi all,

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:
fwraptest_plain.png
fwraptest_plain.png (108.69 KiB) Viewed 6069 times
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:
fwraptest_plainvspace.png
fwraptest_plainvspace.png (111.88 KiB) Viewed 6069 times
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:
fwraptest_morebefore.png
fwraptest_morebefore.png (216.71 KiB) Viewed 6069 times
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:
Image
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}

Last edited by sdaau on Sun Feb 21, 2010 6:47 pm, edited 2 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

sdaau
Posts: 26
Joined: Fri Feb 19, 2010 2:08 pm

Re: Wrapfigure with side caption (fcapside) ?

Post by sdaau »

( Just adding a fourth image for the original post. )
Attachments
fwraptest_moreafter.jpg
fwraptest_moreafter.jpg (253.79 KiB) Viewed 6067 times
Post Reply