
有五個數字。基本上,我希望它們顯示如下:
|figure 1|figure 2|
|figure 3|figure 4|figure 5|
前兩個數字位於第一行,最後三個數字位於第二行。第一行應該位於第二行的中間。
答案1
(已更新以包括 @Mico 的建議\bigskip
。)
這是使用\parbox
es 的一種可能性。我認為,如果您希望所有圖形的圖形編號都增加,則此解決方案是有意義的。
如果您希望頂部兩個數字較小且不跨越整個環境的整個寬度,則可以變更前兩個 es 的長度\parbox
和前兩個命令的長度。\includegraphics
figure
\documentclass{article}
\usepackage{graphicx}
\usepackage{mwe}
\begin{document}
\begin{figure}
\parbox{.48\textwidth}{\includegraphics[width=.48\textwidth]{example-image-a}\caption{}}
\hfill
\parbox{.48\textwidth}{\includegraphics[width=.48\textwidth]{example-image-a}\caption{}}
\bigskip
\parbox{.32\textwidth}{\includegraphics[width=.32\textwidth]{example-image-a}\caption{}}
\hfill
\parbox{.32\textwidth}{\includegraphics[width=.32\textwidth]{example-image-a}\caption{}}
\hfill
\parbox{.32\textwidth}{\includegraphics[width=.32\textwidth]{example-image-a}\caption{}}
\end{figure}
\end{document}
還有subfig
和subcaption
軟體包允許您擁有子圖(例如,標籤將類似圖 1(a)、圖 1(b)、ETC。;首先看,subcaption 與 subfig:引用子圖的最佳包並且傑西的回答舉一個具體的例子)。
答案2
另一種選擇是使用subfigure
帶有命令的套件subfigure
。
編輯:亞當提醒,subfigure
已棄用,因此此處的新更新subfig
與命令一起使用subfloat
。
程式碼
\documentclass[]{article}
\usepackage[margin=1cm]{geometry}
\usepackage{subfig}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure*}[htbp]
\centering
\subfloat[~subcaption1]{\includegraphics[scale=.95]{figure}}\,
\subfloat[~subcaption2]{\includegraphics[scale=.95]{figure}}
\\
\subfloat[~subcaption1]{\includegraphics[scale=.95]{figure}}\,
\subfloat[~subcaption2]{\includegraphics[scale=.95]{figure}}\,
\subfloat[~subcaption2]{\includegraphics[scale=.95]{figure}}
\vspace{-0.6 cm} % can be changed to suit one's need.
\caption{Caption}
\label{}
\end{figure*}
\end{document}
答案3
您可以將圖形放置在minipage
環境中(每個環境都與一個\caption
命令相關聯),所有這些都位於同一個figure
環境中。
\documentclass{article}
\usepackage[demo]{graphicx} % omit 'demo' option in real document
\begin{document}
\begin{figure}
\centering
% first group of figures
\begin{minipage}{0.31\textwidth}
\includegraphics[width=\linewidth]{pic1.pdf}
\caption{First of five} \label{fig:1}
\end{minipage}
\hspace{3mm} % choose horizontal spacing to suit your needs
\begin{minipage}{0.31\textwidth}
\includegraphics[width=\linewidth]{pic2.pdf}
\caption{Second of five} \label{fig:2}
\end{minipage}
% second group of figures
\bigskip
\begin{minipage}{0.31\textwidth}
\includegraphics[width=\linewidth]{pic3.pdf}
\caption{Third of five} \label{fig:3}
\end{minipage}
\hspace*{\fill}
\begin{minipage}{0.31\textwidth}
\includegraphics[width=\linewidth]{pic4.pdf}
\caption{Fourth of five} \label{fig:4}
\end{minipage}
\hspace*{\fill}
\begin{minipage}{0.31\textwidth}
\includegraphics[width=\linewidth]{pic5.pdf}
\caption{Last of five} \label{fig:5}
\end{minipage}
\end{figure}
\hrule % just to illustrate width of text block
\end{document}