这个问题是之前发布的问题的延续这里。如何为如下所示的图形添加标题?
答案1
下面所采用的技术建立在将两个图表放在一个段落中:
\documentclass{article}
\usepackage{graphicx,caption}
% https://tex.stackexchange.com/a/133660/5764
\makeatletter
\def\newparshape{\parshape\@npshape0{}}
\def\@npshape#1#2#3{\ifx\\#3\expandafter\@@@npshape\else\expandafter\@@npshape\fi
{#1}{#2}{#3}}
\def\@@npshape#1#2#3#4#5{%
\ifnum#3>\z@\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
{\expandafter\@@npshape\expandafter{\the\numexpr#1+1\relax}{#2 #4 #5}{\numexpr#3-1\relax}{#4}{#5}}%
{\@npshape{#1}{#2}}}
\def\@@@npshape#1#2#3{#1 #2 }
\makeatother
\begin{document}
\sloppy
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec vitae mauris risus. Sed
varius dui diam, sit amet volutpat risus euismod in. Ut ac dui fermentum, laoreet arcu
volutpat, vestibulum urna. Integer vitae odio at neque imperdiet sollicitudin vel vel enim.
Nullam sodales facilisis magna sit amet tempor. Morbi ut nulla sem. Aliquam sagittis,
lacus auctor tincidunt semper, odio dui lacinia lectus, quis tempus quam leo sed mi.
Maecenas eu mauris dolor.
\newparshape
{9}{\dimexpr6cm+\tabcolsep}{\dimexpr\textwidth-6cm-\tabcolsep}% Unique to top-left image
{2}{\dimexpr6cm+\tabcolsep}{\dimexpr\textwidth-9cm-2\tabcolsep}% Between top-left and bottom-right image
{6}{0pt}{\dimexpr\textwidth-3cm-\tabcolsep}\\% Unique to bottom-right image
\noindent\leavevmode
\llap{%
\raisebox{\dimexpr-\height+\ht\strutbox}[0pt][0pt]{%
\begin{minipage}{6cm}
\centering
\includegraphics[width=6cm,height=9\baselineskip]{example-image-a} \\
\captionof{figure}{A caption}
\end{minipage}%
}%
\hspace*{\tabcolsep}%
}%
Pellentesque porta pharetra leo, ut accumsan diam feugiat sit amet. Ut mattis nulla sed
sapien suscipit, eu sodales elit cursus. Vestibulum sit amet sollicitudin nisl. Aenean
vestibulum purus sed tincidunt convallis. Aliquam ut sodales risus. Mauris in mauris a
ante venenatis faucibus. Ut nunc ante, cursus sit amet iaculis eget, imperdiet quis libero.
Pellentesque laoreet dolor eget consectetur vehicula. Maecenas ultrices vehicula ultricies.
Morbi cursus risus ut eros placerat condimentum. Mauris nec varius lectus. Nulla adipiscing
porttitor tellus vitae congue. Aliquam commodo gravida erat, lacinia vehicula enim mollis
nec. Nulla sed metus gravida, faucibus neque eu, rutrum purus. Integer ornare nunc vel
dolor lacinia, sit amet venenatis turpis porttitor. Fusce lobortis magna eget odio iaculis,
sed blandit urna dictum.
\hfill\rlap{\hspace*{\tabcolsep}%
\raisebox{\dimexpr-\height+8\baselineskip+\ht\strutbox}[0pt][0pt]{%
\includegraphics[width=3cm,height=9\baselineskip]{example-image-b}}}
Morbi id dolor vulputate, euismod sapien nec, condimentum tellus. Fusce tincidunt sem non
turpis ultricies, eu egestas lorem posuere. Integer risus lectus, gravida vel tincidunt sit
amet, vestibulum eget leo. Curabitur vitae enim sem. Vivamus rutrum velit eget justo
condimentum egestas. Phasellus sit amet lacus mauris. Sed quis aliquet tellus. In mauris
ante, porttitor sit amet rhoncus et, ultrices quis elit. Proin sed aliquet eros.
\end{document}
图像被放置在minipage
预定义宽度的内(这应该不是问题,因为\newparshape
具有预定义的线宽)。caption
提供允许一个人在组内\captionof{<float>}[<ToC caption>]{<caption>}
设置浮点数,即使你不在里面。<caption>
<float>