%sample file
%all possible combinations of predefined floatrow styles
%caption beside float object
\documentclass{book}

\usepackage{graphicx}
\usepackage[footskip=4pt,objectset=centering,capbesidesep=quad]{floatrow}

%load caption
\usepackage[font=small,labelfont=bf,labelsep=period,
   justification=raggedright,singlelinecheck=no]{caption}

\providecommand*\rightlast{\leftskip0ptplus1fil
  \rightskip0ptplus-1fil\parfillskip0ptplus1fil}
\providecommand*\leftlast{\leftskip0pt\rightskip0pt\parfillskip0ptplus1fil}
\DeclareCaptionJustification{togglelast}
  {\floatfacing*\rightlast\leftlast}
\captionsetup[floatbeside]{justification=togglelast}

\providecommand*{\com}[1]{\texttt{\char`\\#1}}

%%try with fancy shadowbox frame
%%there is the trick: base boxed style changed to use shadowbox frame
%\usepackage{fr-fancy}
%\DeclareFloatStyle{boxed}{capposition=bottom,captionskip=2pt,
%  framestyle=shadowbox,heightadjust=object,framearound=object}
%\DeclareFloatStyle{BOXED}{capposition=bottom,framestyle=shadowbox,
%  framefit=yes,heightadjust=all,framearound=all}

\setlength\textfloatsep{8ptplus2ptminus2pt}
\setlength\intextsep{8ptplus2ptminus2pt}
\advance\textheight2in
\advance\topmargin-.85in
\hbadness5000
\advance\textwidth.5in
\advance\evensidemargin-.25in
\advance\oddsidemargin-.25in

\begin{document}
\chapter{Float Boxes with Beside Captions: Variants of Layout}

In this sample are gathered all possible combinations with beside captions
with all predefined base float styles. You may try to run this document
with \texttt{shadowbox} frame: uncomment line with \verb|\usepackage{fr-fancy}|
at the preamble and lines below.

\emph{Notes}.

1)\enskip All float styles with frames get \verb|frameset={\fboxsep6pt}|
to get more visible differences between fitted and non-fitted frames.

2)\enskip The fancy boxes \texttt{shadowbox} and \texttt{wshadowbox}
do not make differences between \texttt{capbesideframe=yes} and \texttt{capbesideframe=no}.

\raggedright

\newcommand\FIGS[5][]{%
\markboth{\hbox{\small Variant #3}}{\hbox{\small Variant #3}}

\small Variant #3: {\ttfamily\raggedright
style=#2,capposition=beside,\allowbreak capbesideposition=\{#4\},\allowbreak capbesideframe=#5\par}

\clearfloatsetup{figure}
\floatsetup[figure]{style=#2,capposition=beside,capbesideposition=#4,capbesideframe=#5,facing=yes#1}
\begin{figure}[!h]
  {{\fboxsep2pt\fbox{\begin{picture}(128,32)\put(0,0){\line(4,1){128}}\put(0,32){\line(4,-1){128}}\end{picture}}}}%
  \caption{%
   Plain figure in \texttt{#2} style. \texttt{#2} style. Width of column}%
  \label{fig:plain:#3}%
\end{figure}

\begin{figure}[!h]
\fcapside
  {{\fboxsep2pt\fbox{\begin{picture}(128,32)\put(0,0){\line(4,1){128}}\put(0,32){\line(4,-1){128}}\end{picture}}}}%
  {\caption{%
   Figure in \protect\com{ffigbox}. \texttt{#2} style. Width of column}%
  \label{fig:floatbox:#3}}%

\vskip\floatsep
\fcapside[\FBwidth]
  {{\fboxsep2pt\fbox{\begin{picture}(128,32)\put(0,0){\line(4,1){128}}\put(0,32){\line(4,-1){128}}\end{picture}}}}%
  {\caption{%
   Figure in \protect\com{ffigbox}. \texttt{#2} style. Width of graphics}%
   \label{fig:fbwidth:#3}}%
\end{figure}

}

\clearpage
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{1}{{top,inside}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{2}{{center,inside}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{3}{{bottom,inside}}{yes}
\vfill

\clearpage
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{4}{{top,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{5}{{center,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{6}{{bottom,inside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{7}{{top,outside}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{8}{{center,outside}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{9}{{bottom,outside}}{yes}
\vfill

\clearpage
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{10}{{top,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{11}{{center,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{12}{{bottom,outside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{13}{{top,left}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{14}{{center,left}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{15}{{bottom,left}}{yes}
\vfill

\clearpage
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{16}{{top,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{17}{{center,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{18}{{bottom,left}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{19}{{top,right}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{20}{{center,right}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{21}{{bottom,right}}{yes}
\vfill

\clearpage
\FIGS[,frameset={\fboxsep6pt}]{Boxed}{22}{{top,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{23}{{center,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{24}{{bottom,right}}{no}
\vfill

%%%

\clearpage
\floatsetup{capbesidesep=qquad}
\FIGS[,frameset={\fboxsep6pt}]{boxed}{25}{{top,inside}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{26}{{center,inside}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{27}{{bottom,inside}}{yes}
\vfill

\clearpage
\FIGS[,frameset={\fboxsep6pt}]{boxed}{28}{{top,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{29}{{center,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{30}{{bottom,inside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{boxed}{31}{{top,outside}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{32}{{center,outside}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{33}{{bottom,outside}}{yes}
\vfill

\clearpage
\FIGS[,frameset={\fboxsep6pt}]{boxed}{34}{{top,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{35}{{center,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{36}{{bottom,outside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{boxed}{37}{{top,left}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{38}{{center,left}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{39}{{bottom,left}}{yes}
\vfill

\clearpage
\FIGS[,frameset={\fboxsep6pt}]{boxed}{40}{{top,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{41}{{center,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{42}{{bottom,left}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{boxed}{43}{{top,right}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{44}{{center,right}}{yes}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{45}{{bottom,right}}{yes}
\vfill

\clearpage
\FIGS[,frameset={\fboxsep6pt}]{boxed}{46}{{top,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{47}{{center,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{boxed}{48}{{bottom,right}}{no}
\vfill

%%%

\clearpage
\floatsetup{capbesidesep=quad}
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{49}{{top,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{50}{{center,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{51}{{bottom,inside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{52}{{top,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{53}{{center,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{54}{{bottom,outside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{55}{{top,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{56}{{center,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{57}{{bottom,left}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{58}{{top,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{59}{{center,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{BOXED}{60}{{bottom,right}}{no}
\vfill

%%%

\clearpage
\floatsetup{capbesidesep=qquad}
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{61}{{top,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{62}{{center,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{63}{{bottom,inside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{64}{{top,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{65}{{center,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{66}{{bottom,outside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{67}{{top,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{68}{{center,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{69}{{bottom,left}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{70}{{top,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{71}{{center,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt},framefit=no]{BOXED}{72}{{bottom,right}}{no}
\vfill

%%%

\clearpage
\FIGS[,frameset={\fboxsep6pt}]{ruled}{73}{{top,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{ruled}{74}{{center,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{ruled}{75}{{bottom,inside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{ruled}{76}{{top,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{ruled}{77}{{center,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{ruled}{78}{{bottom,outside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{ruled}{79}{{top,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{ruled}{80}{{center,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{ruled}{81}{{bottom,left}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{ruled}{82}{{top,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{ruled}{83}{{center,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{ruled}{84}{{bottom,right}}{no}
\vfill

%%%

\clearpage
\FIGS[,frameset={\fboxsep6pt}]{plain}{85}{{top,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{plain}{86}{{center,inside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{plain}{87}{{bottom,inside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{plain}{88}{{top,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{plain}{89}{{center,outside}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{plain}{90}{{bottom,outside}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{plain}{91}{{top,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{plain}{92}{{center,left}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{plain}{93}{{bottom,left}}{no}
\vfill
%
\clearpage
\FIGS[,frameset={\fboxsep6pt}]{plain}{94}{{top,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{plain}{95}{{center,right}}{no}
\vfill
\FIGS[,frameset={\fboxsep6pt}]{plain}{96}{{bottom,right}}{no}
\vfill


\end{document} 