答案1
这是一个非常简单的设置示例tcolorbox
:
原则上,tcolorbox
可以“征服”图形环境并融入其中,这意味着标题位于顶部并显示为框的标题。
\documentclass{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage[most]{tcolorbox}
\newtcolorbox{annotatedbox}[1][]{%
enhanced jigsaw,
sharp corners,
colback=white,
float=htb,
boxsep=0pt,
#1%
}
\usepackage{blindtext}
\begin{document}
\blindtext[5]
\begin{annotatedbox}
Some text before
\begin{center}
\includegraphics[scale=0.2]{ente}
\captionof{figure}{A beautiful duck}
\end{center}
\hfill Some other text right
\end{annotatedbox}
\blindtext[6]
\begin{annotatedbox}[colframe={red!40!brown},boxrule=5pt]
Some text before
\begin{center}
\includegraphics[scale=0.2]{ente}
\captionof{figure}{Another beautiful duck}
\end{center}
\hfill Some other text right
\end{annotatedbox}
\end{document}
答案2
我想说你正在寻找包裹上图,但由于 TeX.SX 中已经有很多这个包的例子,所以只需要一个不同的穷人解决方案:重叠两个小页面。
\documentclass{article}
\usepackage{graphicx,capt-of,lipsum,xcolor}
\parskip1em\fboxsep1em
\begin{document}
\lipsum[2]
\hfil\fbox{
\rlap{\begin{minipage}[c][5cm][c]{5cm}
\centering
\includegraphics[width=5cm]{cow}
\end{minipage}}%
\begin{minipage}[c][5cm][c]{6.5cm}
\textcolor{orange!50!red}{head}\hfill\vfill
\hfill \textcolor{orange!50!black}{\parbox{1.4cm}{$\leftarrow$ global warming}}\vfill
\hfill \textcolor{orange!50}{tail~~~~~~~}\vfill
\hfil\vspace{-5mm}\textcolor{green}{\bfseries milk}\vfill
\textcolor{orange}{forelegs} \hfill \textcolor{red}{hind legs}
\captionof{figure}{Milky way approximation risks.}
\end{minipage}}
\lipsum[3]
\end{document}