![如何在图形底部和文本左侧显示标题](https://linux22.com/image/344993/%E5%A6%82%E4%BD%95%E5%9C%A8%E5%9B%BE%E5%BD%A2%E5%BA%95%E9%83%A8%E5%92%8C%E6%96%87%E6%9C%AC%E5%B7%A6%E4%BE%A7%E6%98%BE%E7%A4%BA%E6%A0%87%E9%A2%98.png)
我在将标题放在图片底部和正文左侧时遇到了问题。请参阅附件中的图片文件。我使用的代码:
\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}
答案1
您可以使用 实现该布局floatrow
。下面的代码大部分取自frsample05.tex
。这个想法是在单列布局中floatrow
使用环境并自定义。重要的部分是在 中设置标题。figure*
widefigure
\DeclareCaptionFormat{marginpars}
\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}