我尝试在图片上方添加一些说明。但是,它们看起来很奇怪。可能是因为我使用了居中,但如果我去掉居中,我的图片将无法正确放置。请帮助我。谢谢!
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[h!]
\caption{Police}
This figure plots the survey respondents' attitudes to contacting police officers for four categories of cybercrime from 2012 to 2014. Panel from (a) to (d) plots police contact relating to online identity theft, and consumer fraud. hated speech, and denial of service, respectively.\break
\\
\\
\label{Police}
\centering
\begin{subfigure}{0.485\textwidth}
\includegraphics[width=\textwidth]{dentity_Theft_police}
\caption{Identity Theft}
\label{fig1:police}
\end{subfigure}
\hfill
\begin{subfigure}{0.485\textwidth}
\includegraphics[width=\textwidth]{ConsumerFraud_police}
\caption{Consumer Fraud}
\label{fig2:police}
\end{subfigure}
\medskip
\begin{subfigure}{0.485\textwidth}
\includegraphics[width=\textwidth]{RHR_police}
\caption{Hated Speech}
\label{fig3:police}
\end{subfigure}
\hfill
\begin{subfigure}{0.485\textwidth}
\includegraphics[width=\textwidth]{DOS_police}
\caption{Denial of Service}
\label{fig4:police}
\end{subfigure}
\end{figure}
\end{document}
答案1
您可以简单地将文本换行到 中\parbox
。
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[h!]
\caption{Police}
\parbox{\linewidth}{This figure plots the survey respondents' attitudes to contacting police officers for four categories of cybercrime from 2012 to 2014. Panel from (a) to (d) plots police contact relating to online identity theft, and consumer fraud. hated speech, and denial of service, respectively.}
\medskip
\label{Police}
\centering%
\begin{subfigure}{0.5\textwidth}
\includegraphics[width=\textwidth]{example-image-a}
\caption{Identity Theft}
\label{fig1:police}
\end{subfigure}%
\begin{subfigure}{0.5\textwidth}
\includegraphics[width=\textwidth]{example-image-b}
\caption{Consumer Fraud}
\label{fig2:police}
\end{subfigure}
\medskip
\begin{subfigure}{0.5\textwidth}
\includegraphics[width=\textwidth]{example-image-c}
\caption{Hated Speech}
\label{fig3:police}
\end{subfigure}%
\begin{subfigure}{0.5\textwidth}
\includegraphics[width=\textwidth]{example-image-duck}
\caption{Denial of Service}
\label{fig4:police}
\end{subfigure}
\end{figure}
\end{document}
请注意,我还更改了子图的宽度,0.5\linewidth
并通过换行符删除了难看的“格式”。此外,我还用我可用的图像替换了您的图像。
编辑
或者简单地按照 David Carlisle 的建议去做,这也有效;-)
答案2
命令
\break
\\
\\
\centering
问题是:\centering
也会影响它所在的段落,并且\\
不会结束段落。避免\\
在普通文本中使用。
\medskip
还请仔细观察(空白行之间)和的位置\hfill
。
不要只使用[h!]
。如果没有可用空间,它将阻塞队列。
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\begin{document}
\begin{figure}[!htp]
\caption{Police}\label{Police}
This figure plots the survey respondents' attitudes to contacting
police officers for four categories of cybercrime from 2012 to 2014.
Panel from (a) to (d) plots police contact relating to online identity
theft, and consumer fraud. hated speech, and denial of service,
respectively.
\bigskip
\centering
\begin{subfigure}{0.485\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Identity Theft}
\label{fig1:police}
\end{subfigure}\hfill
\begin{subfigure}{0.485\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Consumer Fraud}
\label{fig2:police}
\end{subfigure}
\medskip
\begin{subfigure}{0.485\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Hated Speech}
\label{fig3:police}
\end{subfigure}\hfill
\begin{subfigure}{0.485\textwidth}
\includegraphics[width=\textwidth]{example-image}
\caption{Denial of Service}
\label{fig4:police}
\end{subfigure}
\end{figure}
\end{document}