[Tex/LaTex] How to display caption at the bottom of a figure and left side of a text

captions

I have a problem of placing caption at the bottom of figure and same time left side of main text. Please see attached image file.
I use code:

\documentclass[a4paper,10pt,twoside]{book}

\usepackage[draft]{graphicx}
\usepackage{epstopdf}

\usepackage{lipsum}

\usepackage[font=small,font=sf,labelfont=bf,labelsep=period,
justification=raggedright,singlelinecheck=false,width=2.5cm]{caption}
\DeclareCaptionLabelFormat{myformat}{\rule{1.6cm}{1pt}\\ #1 \textbf{#2}}
\captionsetup{labelformat=myformat}
\usepackage{floatrow}

\usepackage[layoutheight=232mm,layoutwidth=187mm,
    layoutvoffset= 32mm,layouthoffset= 11mm,
    showframe=true, 
%   showcrop=true
    ]{geometry}

\setlength{\oddsidemargin}{21mm}
\setlength{\evensidemargin}{16mm}
\setlength{\textheight}{196mm}
\setlength{\textwidth}{150mm}
\setlength{\headsep}{6mm}
\setlength{\headheight}{5mm}
\setlength{\topmargin}{10mm}
\setlength{\marginparsep}{0mm}
\setlength{\topmargin}{10mm}

\setlength{\leftskip}{3cm}

\begin{document}

\chapter{Introduction}
\lipsum[1]

\section{Caption location}
\lipsum[1]

\begin{figure}[!ht]
\floatbox[{\capbeside\thisfloatsetup{capbesideposition={left,bottom}}}]{figure}[0.8\textwidth]
{\caption{Caption beside left, bottom of Small-Figure }\label{fig:01_400}}
{\includegraphics[width=10cm]{fg01_00400.eps}}
\end{figure}

\lipsum[1]

\begin{figure}[!ht]
\RawFloats
\begin{center}
{\includegraphics[width=13cm]{fg01_00500.eps}}
\end{center}\vspace{-0.8cm}
\begin{minipage}[t]{0.1\linewidth}
    \caption{Caption left, bottom of Wide-Figure}
\end{minipage}
\end{figure}

\lipsum[1]
\end{document}

Main text move up

Best Answer

You can achieve that layout with floatrow. The code below is mostly taken from frsample05.tex distributed with floatrow. The idea is to use figure* environment in a one-column layout and customizing widefigure. The important part is in \DeclareCaptionFormat{marginpars}, where the caption is set.

\documentclass{book}

\usepackage{lipsum,ragged2e}

\usepackage{geometry}
\geometry{a4paper,includemp}

\usepackage{floatrow}

\floatsetup[figure]{%
  style        = Boxed                        ,
  heightadjust = all                          ,
  frameset     = {\fboxrule=1pt\fboxsep=12pt} ,
  captionskip  = 7pt ,
}

\floatsetup[widefigure]{%
  margins           = hangoutside     ,
  capbesideposition = bottom          ,
  capbesidewidth    = \marginparwidth ,
  facing            = yes             ,
  floatwidth        = \textwidth
}

\usepackage{caption}

\DeclareCaptionFormat{marginpars}{%
  \vbox to 0pt{%
    \RaggedRight\FBifcaptop\vss\relax
    \floatfacing{%
      \addtolength\leftskip{\dimexpr \textwidth+\marginparsep\relax}%
    }{%
      \addtolength\rightskip{\dimexpr \textwidth+\marginparsep\relax}%
    }%
    #1#2\par#3%
    \FBifcaptop\relax\vss
  }%
}

\DeclareCaptionLabelFormat{myformat}{\rule{1.6cm}{1pt}\\ #1 #2}

\captionsetup{%
  font            = small  ,
  labelfont       = bf     ,
  font            = sf     ,
  labelsep        = period ,
  singlelinecheck = no}

\captionsetup[widefigure]{
  format      = marginpars ,
  labelformat = myformat
}

\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}}

\pagestyle{plain}

\begin{document}

\chapter{Some Chapter}

\section{Some Section}

\lipsum[1]

\begingroup
\floatsetup[widefigure]{capposition=top}
\begin{figure*}[b]
  \ffigbox
    {\lipsum[2]}
    {\caption{\texttt{widefigure} with \texttt{[b]} placement
      option.: \text }}
\end{figure*}
\endgroup

\lipsum[1]

\begin{figure*}[t]
  \ffigbox
    {\lipsum[2]}
    {\caption{\texttt{widefigure} with \texttt{[t]} placement
      option. \text}}
\end{figure*}

\lipsum[1]

\thisfloatsetup{capposition=top}
\begin{figure*}[b]
  \ffigbox
    {\rule{6cm}{3cm}}
    {\caption{\texttt{widefigure} with \texttt{[b]} placement
        option. \text}}
\end{figure*}

\lipsum[1-3]

\end{document}

enter image description here