要求:创建一个包含团队成员网格的完整页面。每个团队成员都应有一张图像和一段简短的描述。类似于我们在团队成员页面中看到的内容。
方法: 在图形环境中使用子图。我已删除所有标题。请参阅下面的代码:
代码:
\begin{figure*}%
%\captionsetup{font=small,labelfont=bf, width=.9\textwidth}
%% first three subfigures
\subfigure[Num/01]{%
%\captionsetup{font=small,labelfont=bf, width=.5\textwidth}
\includegraphics[width =1.5in,angle=-90,origin=c]{graphics/PXL_20211215_102014392.jpg}%
}%
}
\hspace*{\fill}
\subfigure[Num/02]{%
\includegraphics[width =1.5in,angle=-90,origin=c]{graphics/PXL_20211215_102014392.jpg}%
}%
\hspace*{\fill}
\subfigure[Num/03]{%
\includegraphics[width =1.5in,angle=-90,origin=c]{graphics/PXL_20211215_102014392.jpg}%
}
%% second group of subfigures
\subfigure[Num/01]{%
\includegraphics[width =1.5in,angle=-90,origin=c]{graphics/PXL_20211215_102014392.jpg}%
}%
\hspace*{\fill}
\subfigure[Num/02]{%
\includegraphics[width =1.5in,angle=-90,origin=c]{graphics/PXL_20211215_102014392.jpg}%
}%
\hspace*{\fill}
\subfigure[Num/03]{%
\includegraphics[width =1.5in,angle=-90,origin=c]{graphics/PXL_20211215_102014392.jpg}%
%\caption{Scatter plots of 6 pics.}\label{fig:Scatter}
\end{figure*}
有效方法: 我得到了一个 3X2 的图像网格,每个图像旁边都有文字“Num/01”、“Num/02”......
问题: 无法弄清楚如何为与每个子图相关的文本设置固定宽度。如何在此文本中插入换行符?例如,如果我使用较长的文本(如“Dr. XYZ,技术创新教授,PQR 大学”)而不是“Num/01”,我该如何将其放在三行而不是一行连续的行中?此外,我是否可以为此文本设置固定宽度,以便它在同一宽度内换行?
感谢您的帮助!!
答案1
使用 minipages 是对齐标题和图形的简单方法。标题的宽度及其位置由 minipage 参数(此处使用)控制[c]
。其格式使用\captionsetup
如果您不希望(子)标题出现在 LoF 中,请使用,或者在小页面中根本\caption*
不使用:\caption
\begin{minipage}[c]{0.12\textwidth}
Dr. XYZ\\ Prof. of Tech. Innovation\\ PQR University
\end{minipage}
\begin{minipage}[c]{0.20\textwidth}
\includegraphics[angle=-90]{example-image-a}
\end{minipage}
\hfill
\begin{minipage}[c]{0.12\textwidth}
\footnotesize\RaggedRight Dr. XYZ\\ Prof. of Tech. Innovation\\ PQR University
\end{minipage}
....
\documentclass[12pt,a4paper]{article}
\usepackage[left=2.00cm, right=2.00cm, top=4.00cm, bottom=3.00cm, showframe]{geometry}
\usepackage{graphicx}
\usepackage{caption}
\captionsetup[figure]{labelformat=empty, textfont=footnotesize, margin=4pt, justification=RaggedRight}
\begin{document}
\begin{figure}[htb!]
\setkeys{Gin}{width=1.5in} % width of all images
\begin{minipage}[c]{0.12\textwidth}
\caption{Dr. XYZ\\ Prof. of Tech. Innovation\\ PQR University}
\end{minipage}
\begin{minipage}[c]{0.20\textwidth}
\includegraphics[angle=-90]{example-image-a}
\end{minipage}
\hfill
\begin{minipage}[c]{0.12\textwidth}
\caption{Dr. XYZ\\ Prof. of Tech. Innovation\\ PQR University}
\end{minipage}
\begin{minipage}[c]{0.2\textwidth}
\includegraphics[angle=-90]{example-image-a}
\end{minipage}\hfill
\begin{minipage}[c]{0.12\textwidth}
\caption{Dr. XYZ\\ Prof. of Tech. Innovation\\ PQR University}
\end{minipage}
\begin{minipage}[c]{0.2\textwidth}
\includegraphics[angle=-90]{example-image-a}
\end{minipage}
\bigskip
\begin{minipage}[c]{0.12\textwidth}
\caption{Dr. XYZ\\ Prof. of Tech. Innovation\\ PQR University}
\end{minipage}
\begin{minipage}[c]{0.20\textwidth}
\includegraphics[angle=-90]{example-image-b}
\end{minipage}
\hfill
\begin{minipage}[c]{0.12\textwidth}
\caption{Dr. XYZ\\ Prof. of Tech. Innovation\\ PQR University}
\end{minipage}
\begin{minipage}[c]{0.2\textwidth}
\includegraphics[angle=-90]{example-image-b}
\end{minipage}\hfill
\begin{minipage}[c]{0.12\textwidth}
\caption{Dr. XYZ\\ Prof. of Tech. Innovation\\ PQR University}
\end{minipage}
\begin{minipage}[c]{0.2\textwidth}
\includegraphics[angle=-90]{example-image-b}
\end{minipage}
\end{figure}
\end{document}
答案2
我不完全理解你的问题。我认为其他人会给出一些很好的答案,但首先给你一个提示。它可以解决你的问题或帮助你让你的 MWE 更容易理解。
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfigure}
\usepackage{mwe}
\begin{document}
\begin{figure*}
\begin{minipage}{0.2\linewidth}
\caption[caption]{A very long long \\\hspace{\textwidth}long long caption}
\end{minipage}%
\subfigure{%
\includegraphics[width =1.5in,angle=-90,origin=c]{example-image-a}}
\begin{minipage}{0.2\linewidth}
\caption[caption]{A very long long \\\hspace{\textwidth}long long caption}
\end{minipage}%
\subfigure{%
\includegraphics[width =1.5in,angle=-90,origin=c]{example-image-b}}
\end{figure*}
\end{document}
答案3
此代码基于@Simon Despa 提供的解决方案。谢谢!以下是代码和相应的输出。
\begin{figure*}[htb!]
\setkeys{Gin}{width=1.5in} % width of all images
\begin{minipage}[t]{0.20\textwidth}
\includegraphics[]{graphics/Face-Deer.png} Dr. Animal \\Awesome
\end{minipage}
\hfill
\begin{minipage}[t]{0.2\textwidth}
\includegraphics[]{graphics/Face-Deer.png} Dr. Pulkit \\Awesome
\end{minipage}
\hfill
\begin{minipage}[t]{0.2\textwidth}
\includegraphics[]{graphics/Face-Owl.png} Dr. Animal \\Awesome
\end{minipage}
\hfill
\begin{minipage}[t]{0.2\textwidth}
\includegraphics[]{graphics/Face-Racoon.png} Dr. Animal \\Awesome
\end{minipage}
\bigskip
\begin{minipage}[t]{0.20\textwidth}
\includegraphics[]{graphics/Face-Lemur.png} Dr. Animal \\Awesome
\end{minipage}
\hfill
\begin{minipage}[t]{0.2\textwidth}
\includegraphics[]{graphics/Face-Lemur.png} Dr. Animal \\Awesome
\end{minipage}\hfill
\begin{minipage}[t]{0.2\textwidth}
\includegraphics[]{graphics/Face-Racoon.png} Dr. Animal \\Awesome
\end{minipage}
\hfill
\begin{minipage}[t]{0.2\textwidth}
\includegraphics[]{graphics/Face-Racoon.png} Dr. Animal \\Awesome
\end{minipage}
\bigskip
\begin{minipage}[t]{0.20\textwidth}
\includegraphics[]{graphics/Face-Lemur.png} Dr. Animal \\Awesome
\end{minipage}
\hfill
\begin{minipage}[t]{0.2\textwidth}
\includegraphics[]{graphics/Face-Lemur.png} Dr. Animal \\Awesome
\end{minipage}\hfill
\begin{minipage}[t]{0.2\textwidth}
\includegraphics[]{graphics/Face-Racoon.png} Dr. Animal \\Awesome
\end{minipage}
\hfill
\begin{minipage}[t]{0.2\textwidth}
\includegraphics[]{graphics/Face-Racoon.png} Dr. Animal \\Awesome
\end{minipage}
\end{figure*}