![围绕图像+文本的框架/框(并在其下方但在框架之外添加标题)](https://linux22.com/image/415774/%E5%9B%B4%E7%BB%95%E5%9B%BE%E5%83%8F%2B%E6%96%87%E6%9C%AC%E7%9A%84%E6%A1%86%E6%9E%B6%2F%E6%A1%86%EF%BC%88%E5%B9%B6%E5%9C%A8%E5%85%B6%E4%B8%8B%E6%96%B9%E4%BD%86%E5%9C%A8%E6%A1%86%E6%9E%B6%E4%B9%8B%E5%A4%96%E6%B7%BB%E5%8A%A0%E6%A0%87%E9%A2%98%EF%BC%89.png)
我想在图像周围放置一个框架/框,包括其下方的一些文本。此外,我希望能够在之后添加标题。
到目前为止,我设法在图像周围放置一个框,但我希望它也能封装文本。
我想实现这个目标:
但我只做到了这一点(将文本放在我想要的位置并在图像周围放置一个框架):
\documentclass[11pt, a4paper, oneside]{report}
\usepackage[left=4cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{graphicx}
\usepackage{setspace}
\usepackage{ragged2e}
\begin{document}
\begin{figure}[!htb]
\centering
\fbox{\includegraphics[width=\textwidth]{example.jpg}}
\justify \setstretch{0.75}{
\vspace{-1ex}\footnotesize Something long about the image which should be "part" of the image and bla-bla-bla. Maybe some more text so that it breaks the line sometime.}
\caption{This is a caption of a Figure which includes an image and some text below it.}
\label{fig:employment}
\end{figure}
\end{document}
我读到过,由于图像是浮动的而文本不是,所以做这样的事情有点棘手。有什么办法可以做到这一点吗?对我来说,这似乎不是一件很奇怪的事情。
答案1
您可以简单地使用表格。
\documentclass[11pt, a4paper, oneside]{report}
\usepackage[left=4cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
\usepackage{graphicx}
\begin{document}
\begin{figure}[!htb]
\centering
\fbox{%
\begin{tabular}{p{0.8\textwidth}}
\includegraphics[width=0.8\textwidth]{example-image}\\
\footnotesize Something long about the image which should be "part" of the image and bla-bla-bla. Maybe some more text so that it breaks the line sometime.
\end{tabular}}
\caption{This is a caption of a Figure which includes an image and some text below it.}
\label{fig:employment}
\end{figure}
\end{document}