1

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

  • Welcome to TeX SX! Do you mean you'd like to have figure captions in the margin? – Bernard Nov 26 '16 at 13:12
  • Just a comment on your page layout settings: If you use the geometry package already, you can as well let it handle the setting of text width, margins etc. – Michael Palmer Nov 26 '16 at 14:14
  • On an ad-hoc basis, you can just add some negative vertical space at the end of the figure: \end{minipage} \vspace{-6\baselineskip} \end{figure}. A general solution is harder, and if it were to insert some automatically calculated negative white space at the end of the figure, the caption might end up protruding into the bottom margin of the page, or colliding with other margin material. I played with this kind of design a while ago and concluded that it was more trouble than it's worth. – Michael Palmer Nov 26 '16 at 14:45
  • 1
    You can \smash the caption, but again you face the possibility of overlapping the bottom of the page. – John Kormylo Nov 26 '16 at 14:55
1

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.