我在 latex 文件中添加了图形,但不知为何,图形显示在右侧而不是中间。我该如何修复?
\begin{figure}
\centering
\subcaptionbox{A Constant Rectangle\label{fig:2a}}[.4\linewidth]{\includegraphics[width=1.6in]{rectangle_graph.png}}
\hspace{1em}
\vspace{0.3em}
\subcaptionbox{A Moving Square\label{fig:2b}}[.4\linewidth]{\includegraphics[width=1.6in]{moving_block_graph.png}}
\vspace{0.3em}
\subcaptionbox{Green Lines\label{fig:2c}}[.4\linewidth]{\includegraphics[width=1.6in]{green_lines_graph.png}}\hspace{1em}
\subcaptionbox{Diagonals\label{fig:2d}}[.4\linewidth]{\includegraphics[width=1.6in]{diagonals_graph.png}}
\caption{caption.}
\label{figure2}
\end{figure}
答案1
不要对图像的宽度使用绝对值!两张图片的宽度为 3.2 英寸,比列宽还宽!
\begin{figure}
\centering
\subcaptionbox{A Constant Rectangle\label{fig:2a}}[.45\linewidth]{%
\includegraphics[width=\linewidth]{rectangle_graph.png}}
\quad
\subcaptionbox{A Moving Square\label{fig:2b}}[.45\linewidth]{%
\includegraphics[width=\linewidth]{moving_block_graph.png}}
\subcaptionbox{Green Lines\label{fig:2c}}[.45\linewidth]{%
\includegraphics[width=\linewidth]{green_lines_graph.png}}
\quad
\subcaptionbox{Diagonals\label{fig:2d}}[.45\linewidth]{%
\includegraphics[width=\linewidth]{diagonals_graph.png}}
\caption{caption.}
\label{figure2}
\end{figure}