\input pictures
%\listfiles
\documentclass{book}
\advance\textwidth-1in
\advance\oddsidemargin.5in
\advance\marginparwidth-.75in
%\advance\evensidemargin.5in
\usepackage{calc,listpen}
\usepackage{tabularx,array}
\usepackage{floatpagestyle}

\usepackage{graphicx}

\usepackage{color}
\definecolor{gray}{gray}{.5}
\definecolor{emphblue}{rgb}{0,0,0.5}
%light
%\definecolor{lyellow}{cmyk}{0,0,0.24,0}
%\definecolor{lred}{cmyk}{0,0.05,0.3,0}
%saturated
%\definecolor{lyellow}{cmyk}{0,0,1,0}
\definecolor{lyellow}{rgb}{1,1,.6}
%\definecolor{lred}{cmyk}{0,0.24,0.84,0}
\definecolor{lred}{rgb}{1,.94,.62}
\definecolor{lredblack}{cmyk}{0,0.36,0.6,1}
\def\emphcolor{\color{emphblue}}

\usepackage{fancyhdr}\pagestyle{fancy}\fancyfoot{} \fancyhead[LE]{\leavevmode\hspace*{-\marginparwidth}\hskip-\marginparsep
  \def\arraystretch{1,2}\begin{tabular}{@{}l@{}}
  \smash{\rlap{\bfseries \large \thepage}}\hskip\marginparwidth\hskip\marginparsep
  \vrule\hbox to\textwidth{\slshape\leftmark\hfill}\vrule
 \hskip\marginparwidth\hskip\marginparsep\smash{\llap{\bfseries \large \thepage}}
  \\ \hline
  \end{tabular}\hskip-\marginparsep\hspace*{-\marginparwidth}}
\fancyhead[LO]{\leavevmode\hspace*{-\marginparwidth}\hskip-\marginparsep
  \def\arraystretch{1,2}\begin{tabular}{@{}l@{}}
  \smash{\rlap{\bfseries \large \thepage}}\hskip\marginparwidth\hskip\marginparsep
  \vrule\hbox to\textwidth{\hfill\slshape\rightmark}\vrule
 \hskip\marginparwidth\hskip\marginparsep\smash{\llap{\bfseries \large \thepage}}
 \\ \hline
 \end{tabular}\hskip-\marginparsep\hspace*{-\marginparwidth}}
\fancyhead[RE]{}\fancyhead[CE]{}
\fancyhead[RO]{}\fancyhead[CO]{}
\renewcommand\headrulewidth{0pt}
\fancyheadoffset[LE,RO]{0pt}
\fancyheadoffset[RE,LO]{0pt}
\fancyheadoffset{0pt}

\usepackage[font={small,color=lredblack},labelfont=bf,labelsep=period,
   singlelinecheck=no]{caption}[2004/11/28]
\captionsetup[floatfoot]{font={color=lredblack}}

\usepackage[font=small,captionskip=5pt,
   footskip=.5\skip\footins,footnoterule=fullsize,
   floatrowsep=qquad,capbesidesep=quad,capbesideposition=inside,
   facing=yes,floatHaslist=yes,doublefloataswide=yes]{floatrow}
\usepackage{fr-fancy}

\DeclareNewFloatType{textbox}{fileext=lor,name=Text,placement=tp}

\newfloatcommand{ttextbox}{textbox}

\newcommand\TEXTBOX[1][]{%
Here goes first line of text \text\par
There goes second line of text#1\par
Thence goes third line of text \text\par
Hence goes fourth line of text}

\DeclareObjectSet{indent}{\raggedright\parindent15pt\parskip2pt\color{lredblack}}

\floatsetup[textbox]{style=plain,heightadjust=all,
%  frameset={\fboxrule=1pt\fboxsep=12pt},
  font={color=lredblack},margins=centering,captionskip=7pt,
  capposition=bottom,objectset=indent,
  %capbesideframe=yes,
  capbesideposition=outside,
  capbesidewidth=\marginparwidth,valign=t}

%\floatsetup[widetextbox]{margins=hanginside,facing=yes,rowfill={\fill,\fill},
%  floatwidth=\textwidth}

\DeclareMarginSet{hanginside}{\setfloatmargins*
{\strut\hskip-\marginparwidth\hskip-\marginparsep}{}%\hfill
  }
\DeclareMarginSet{hangoutside}{\setfloatmargins*
{}{\hskip-\marginparwidth\hskip-\marginparsep\strut}%\hfill
  }

\DeclareColorBox{framedfigure}{\fcolorbox{gray}{white}}
\DeclareColorBox{yellowplate}{\fcolorbox{lyellow}{lyellow}}
\DeclareColorBox{redplate}{\fcolorbox{lred}{lred}}
\DeclareColorBox{Redplate}{\colorbox{lred}}

\DeclareCBoxCorners{Redplate}
   {\floatfacing{}{{\color{red}
      \linethickness{.5pt}\put(-.5pt,-.5pt)
      {{\put(0pt,0pt){\line(0,1){\FRcolorboxht}}}%
       {\put(0pt,0pt){\line(1,0){\FRcolorboxwd}}}%
       {\linethickness{.24pt}\put(-2pt,-2pt){\line(0,1){2cm}}}%
       {\linethickness{.24pt}\put(-2pt,-2pt){\line(1,0){3cm}}}}%
   }}}
   {\floatfacing{{\color{red}
      \linethickness{.5pt}\put(.5pt,-.5pt)
      {{\put(0pt,0pt){\line(0,1){\FRcolorboxht}}}%
       {\put(0pt,0pt){\line(-1,0){\FRcolorboxwd}}}%
       {\linethickness{.24pt}\put(2pt,-2pt){\line(0,1){2cm}}}%
       {\linethickness{.24pt}\put(2pt,-2pt){\line(-1,0){3cm}}}}%
   }}{}}
   {}
   {}

\providecommand*{\pkg}[1]{\texttt{#1}}
\providecommand*{\com}[1]{\texttt{\char`\\#1}}
\providecommand*{\Lopt}[1]{\textsf{#1}}
\providecommand*{\file}[1]{\texttt{#1}}
\providecommand*{\env}[1]{\texttt{#1}}
\providecommand*{\meta}[1]{$\langle$\textit{#1}$\rangle$}

\def\text{{\mdseries And more text and some more text and a bit more text and
a little more text and a little peace of text to fill space}}

\def\Text{text%{\mdseries \text. \text. \text.  \text.}
}

\unitlength1.44pt

   \floatsetup[widefloat]{style=plain,margins=hangleft,objectset=centering,framearound=row,
       colorframeset=yellowplate,framestyle=colorbox,framefit=yes,heightadjust=object,valign=c}

\begin{document}
\providecommand\RaggedRight{\raggedright}


\Text

\Text

   \begin{figure*}[H]%
   \begin{floatrow}[4]
   \ffigbox
   {\caption{Figure~I in the row (\texttt{floatrow}), ``column'' width}%
   \label{fig:row:Dog:rowbox}}
   {\setlength\unitlength{\hsize/72}\input{TheDog.picture}}
   \ffigbox[\FBwidth]
   {\caption{Figure~II in the row (\texttt{floatrow}), graphics width}%
    \label{fig:row:WcatI:rowbox}}
   {\unitlength1.08\unitlength\input{TheCat.picture}}
   \ffigbox[\Xhsize/2]
   {\caption{Figure~III in the row, float's width box has the
     half of the rest space of row}%
    \label{fig:row:mouse:rowbox}}
   {{\setlength\unitlength{\hsize/58}%^^A
   {\input{Mouse.picture}}}}
   \ffigbox[\Xhsize]
   {\caption{Figure~IV in the row,
     occupies the rest space of row}%
   \label{fig:row:cheese:rowbox}}
   {\setlength\unitlength{\hsize/80}\input{Cheese.picture}}
   \end{floatrow}
   \end{figure*}%
   The result you see in the row of
   figures~\ref{fig:row:Dog:rowbox}--\ref{fig:row:cheese:rowbox}.

\Text

\Text
\clearpage

   \begin{figure*}[H]
    \begin{floatrow}
   \ffigbox[\FBwidth+2cm]
   {\unitlength.9\unitlength\input{BlackCat.picture}}
   {\caption{The left beside figure uses settings for vertical top alignment}%
    \label{leftfig:BOXED:valigned:widerowbox}}%
   \ffigbox[\FBwidth+2.4cm]
   {\caption{The beside figure at the right side in float row uses settings for vertical top alignment too}%^^A
    \label{rightfig:BOXED:valigned:widerowbox}}
   {\unitlength1.25\unitlength\input{Cat.picture}}
    \end{floatrow}
   \end{figure*}%^^A

\Text

\Text
\clearpage

   \begin{figure*}[H]
   \ffigbox%^^A[\FBwidth+2cm]
   {\unitlength.9\unitlength\input{BlackCat.picture}}
   {\caption{The left beside figure uses settings for vertical top alignment}%
    \label{leftfig:BOXED:valigned:outrowbox}}%
   \end{figure*}%^^A

\Text

\Text
\clearpage

   \begin{figure*}[H]
   \ffigbox[\FBwidth+2cm]
   {\unitlength.9\unitlength\input{BlackCat.picture}}
   {\caption{The left beside figure uses settings for vertical top alignment}%
    \label{leftfig:BOXED:valigned:outrowbox}}%
   \end{figure*}%^^A

\Text

\Text
\clearpage

   \floatsetup[widefloat]{style=plain,margins=hangleft,objectset=centering,framearound=row,
       colorframeset=yellowplate,framestyle=colorbox,framefit=yes,heightadjust=object,valign=t}

   \thisfloatsetup{rowfill=yes,facing=yes}
   \begin{figure*}[H]
    \begin{floatrow}
   \ffigbox[\FBwidth+2cm]
   {\unitlength.9\unitlength\input{BlackCat.picture}}
   {\caption{hangLEFT: The left beside figure uses settings for vertical top alignment}%
    \label{leftfig:BOXED:valigned:widerowbox2}}%
   \ffigbox[\FBwidth+2.4cm]
   {\caption{hangLEFT: The beside figure at the right side in float row uses settings
       for vertical top alignment too}%^^A
    \label{rightfig:BOXED:valigned:widerowbox2}}
   {\unitlength1.25\unitlength\input{Cat.picture}}
    \end{floatrow}
   \end{figure*}%^^A

\Text

\Text
\clearpage

   \floatsetup[widefloat]{style=plain,margins=hanginside,rowfill=yes,
        objectset=centering,framearound=row,
        colorframeset=redplate,framestyle=colorbox,framefit=yes,heightadjust=object,valign=t}

   \begin{figure*}[H]
    \begin{floatrow}
   \ffigbox[\FBwidth+2cm]
   {\unitlength.9\unitlength\input{BlackCat.picture}}
   {\caption{hangINside: The left beside figure uses settings for vertical top alignment}%
    \label{leftfig:BOXED:valigned:widerowbox2}}%
   \ffigbox[\FBwidth+2.4cm]
   {\caption{hangINside: The beside figure at the right side in float row uses settings
       for vertical top alignment too}%^^A
    \label{rightfig:BOXED:valigned:widerowbox2}}
   {\unitlength1.25\unitlength\input{Cat.picture}}
    \end{floatrow}
   \end{figure*}%^^A

\Text

\Text
\clearpage


   \begin{figure*}[H]
    \begin{floatrow}
   \ffigbox[\FBwidth+2cm]
   {\unitlength.9\unitlength\input{BlackCat.picture}}
   {\caption{hangINside: The left beside figure uses settings for vertical top alignment}%
    \label{leftfig:BOXED:valigned:widerowbox2}}%
   \ffigbox[\FBwidth+2.4cm]
   {\caption{hangINside: The beside figure at the right side in float row uses settings
       for vertical top alignment too}%^^A
    \label{rightfig:BOXED:valigned:widerowbox2}}
   {\unitlength1.25\unitlength\input{Cat.picture}}
    \end{floatrow}
   \end{figure*}%^^A

\Text

\Text
\clearpage

   \floatsetup[widefloat]{style=plain,margins=hangoutside,
        rowfill=yes,objectset=centering,framearound=row,
        colorframeset=redplate,framestyle=colorbox,framefit=yes,heightadjust=object,valign=t}

   \begin{figure*}[H]
    \begin{floatrow}
   \ffigbox[\FBwidth+2cm]
   {\unitlength.9\unitlength\input{BlackCat.picture}}
   {\caption{hangOUTside: The left beside figure uses settings for vertical top alignment}%
    \label{leftfig:BOXED:valigned:widerowbox2}}%
   \ffigbox[\FBwidth+2.4cm]
   {\caption{hangOUTside: The beside figure at the right side in float row uses settings
       for vertical top alignment too}%^^A
    \label{rightfig:BOXED:valigned:widerowbox2}}
   {\unitlength1.25\unitlength\input{Cat.picture}}
    \end{floatrow}
   \end{figure*}%^^A

\Text

\Text
\clearpage


   \begin{figure*}[H]
    \begin{floatrow}
   \ffigbox[\FBwidth+2cm]
   {\unitlength.9\unitlength\input{BlackCat.picture}}
   {\caption{hangOUTside: The left beside figure uses settings for vertical top alignment}%
    \label{leftfig:BOXED:valigned:widerowbox2}}%
   \ffigbox[\FBwidth+2.4cm]
   {\caption{hangOUTside: The beside figure at the right side in float row uses settings
       for vertical top alignment too}%^^A
    \label{rightfig:BOXED:valigned:widerowbox2}}
   {\unitlength1.25\unitlength\input{Cat.picture}}
    \end{floatrow}
   \end{figure*}%^^A

\Text

\Text
\clearpage

   \begin{figure*}[H]
   \fcapside[\FBwidth+2cm]
   {\unitlength.9\unitlength\input{BlackCat.picture}}
   {\caption{The left beside figure uses settings for vertical top alignment}%
    \label{leftfig:BOXED:valigned:besoutrowbox}}%
   \end{figure*}%^^A
   The result you see in the row of
   figures~\ref{leftfig:BOXED:valigned:rowbox}--\ref{rightfig:BOXED:valigned:rowbox}.

\Text

\Text
\clearpage

\makeatletter
%\newcommand\flrow@nullpic[2][cc]{{\let\unitlength\relax
%    \picture(\z@,\z@)(\z@,\z@)\put(\z@,\z@){\makebox(\z@,\z@)[#1]{#2}}\endpicture}}
%\newcommand\flrow@ll@col@put{\floatfacing{}{{\color{red}%
%   \put(-\@wholewidth,-\@wholewidth)
%   {{\put(\z@,\z@){\line(0,1){\TeXr@ruleht}}}%
%    {\put(\z@,\z@){\line(1,0){\TeXr@rulewd}}}%
%    {\linethickness{.24\p@}\put(-2\p@,-2\p@){\line(0,1){2cm}}}%
%    {\linethickness{.24\p@}\put(-2\p@,-2\p@){\line(1,0){3cm}}}}%
%}}}
%\newcommand\flrow@ul@col@put{}
%\newcommand\flrow@lr@col@put{\floatfacing{{\color{red}
%   \put(\@wholewidth,-\@wholewidth)
%   {{\put(\z@,\z@){\line(0,1){\TeXr@ruleht}}}%
%    {\put(\z@,\z@){\line(-1,0){\TeXr@rulewd}}}%
%    {\linethickness{.24\p@}\put(2\p@,-2\p@){\line(0,1){2cm}}}%
%    {\linethickness{.24\p@}\put(2\p@,-2\p@){\line(-1,0){3cm}}}}%
%}}{}}
%\newcommand\flrow@ur@col@put{}
%\newcommand\flrow@l@color@side[2]{{\let\unitlength\relax
%    \picture(\z@,\z@)(\z@,\z@)
%    \put(\z@,#1){{\flrow@ll@col@put}}
%    \put(\z@,#2){{\flrow@ul@col@put}}
%    \endpicture}}
%\newcommand\flrow@r@color@side[2]{{\let\unitlength\relax
%    \picture(\z@,\z@)(\z@,\z@)
%    \put(\z@,#1){{\flrow@lr@col@put}}
%    \put(\z@,#1){{\flrow@ur@col@put}}
%    \endpicture}}
%
%\def\FRcolor@block#1#2#3{%
%  {\set@color\rlap{\edef\TeXr@rulewd{#1}\@tempdima#2\advance\@tempdima#3%
%  \edef\TeXr@ruleht{\the\@tempdima}%
%  \flrow@l@color@side{-#3}{#2}\ifcolors@
%    \vrule\@width#1\@height#2\@depth#3\fi
%    \flrow@r@color@side{-#3}{#2}}}}

%\def\fcolorbox#1#{\color@fbox{#1}}
%\def\color@fbox#1#2#3{%
%  \color@b@x{\fboxsep\z@\color#1{#2}\fbox}{\color#1{#3}}}

%\def\colorbox#1#{\color@box{#1}}
%\def\color@box#1#2{\color@b@x\relax{\color#1{#2}}}
%
%\long\def\color@b@x#1#2#3{%
% \leavevmode
% \setbox\z@\hbox{\kern\fboxsep{\set@color#3}\kern\fboxsep}%
% \dimen@\ht\z@\advance\dimen@\fboxsep\ht\z@\dimen@
% \dimen@\dp\z@\advance\dimen@\fboxsep\dp\z@\dimen@
% {#1{#2\color@block{\wd\z@}{\ht\z@}{\dp\z@}%
%      \box\z@}}}

\makeatother

Example of row with two textboxes
(boxes~\ref{row:text:I}--\ref{row:text:II}).

\floatsetup[widetextbox]{margins=hangoutside,facing=yes,rowfill=yes,
  framestyle=FRcolorbox,colorframeset=Redplate,colorframecorners=Redplate,
  frameset={\fboxrule=0pt\fboxsep=12pt}}


\begin{textbox*}
\begin{floatrow}
\ttextbox
{hangOUTside: \TEXTBOX\footnote{Text of footnote. \text}}
{\caption{Beside text~I in float row. \text}%
\label{row:text:I}}%

\floatbox{textbox}
{hangOUTside: \TEXTBOX. \text.

\floatfoot{Text of float foot. \text}}%
{\caption{Beside text~II in float row}%
\label{row:text:II}}%
\end{floatrow}
\end{textbox*}

\Text
\clearpage

\begin{textbox*}
\begin{floatrow}
\ttextbox
{hangINside: \TEXTBOX\footnote{Text of footnote. \text}}
{\caption{Beside text~I in float row. \text}%
\label{row:text:I}}%

\floatbox{textbox}
{hangINside: \TEXTBOX. \text.

\floatfoot{\color{lredblack}Text of float foot. \text}}%
{\caption{Beside text~II in float row}%
\label{row:text:II}}%
\end{floatrow}
\end{textbox*}

\Text

\floatsetup[widefigure]{margins=hangoutside,facing=yes,rowfill=yes,
  framestyle=FRcolorbox,colorframeset=Redplate,colorframecorners=Redplate,framefit=no,
  frameset={\fboxrule=0pt\fboxsep=8pt}}
\begin{figure*}[H]%
\CommonHeightRow{\begin{floatrow}[3]%
\ffigbox[\FBwidth]{\resizebox!\CommonHeight
{\vrule width 70pt height 2cm}}{\caption{}}
\ffigbox[\FBwidth]{\resizebox!\CommonHeight
{\vrule width 81pt height 1.2cm}}{\caption{}}
\ffigbox[\FBwidth]{\resizebox!\CommonHeight
{\vrule width 50pt height 2cm}}{\caption{}}
\end{floatrow}}%
\end{figure*}


\end{document}
