围绕图像+文本的框架/框(并在其下方但在框架之外添加标题)

围绕图像+文本的框架/框(并在其下方但在框架之外添加标题)

我想在图像周围放置一个框架/框,包括其下方的一些文本。此外,我希望能够在之后添加标题。

到目前为止,我设法在图像周围放置一个框,但我希望它也能封装文本。

我想实现这个目标:

图像 + 文本,用框架封装,并在其下方添加标题

但我只做到了这一点(将文本放在我想要的位置并在图像周围放置一个框架):

\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}

在此处输入图片描述

相关内容