我想在“subfloat”中插入幾張共享一個標題的圖像,但出現錯誤,有人可以幫我解決這個問題嗎?這是我的程式碼:
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure}
\centering
% Requires \usepackage{graphicx}
\begin{minipage}[t]{0.45\textwidth}
\centering
\subfloat[~$2\%$~lifetime sparsity]{
\includegraphics[width=0.05\textwidth]{figures/second/0_02/001.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/002.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/003.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/004.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/005.pdf}\\
\includegraphics[width=0.05\textwidth]{figures/second/0_02/006.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/007.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/008.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/009.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/010.pdf}\\
\includegraphics[width=0.05\textwidth]{figures/second/0_02/011.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/012.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/013.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/014.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/015.pdf}\\
\includegraphics[width=0.05\textwidth]{figures/second/0_02/016.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/017.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/018.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/019.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_02/020.pdf}
}
% \vspace{0.15in}
%\caption{~$2\%$~lifetime sparsity}\label{fig:ROI:fig2}
\end{minipage}
\begin{minipage}[t]{0.45\textwidth}
\centering
\subfloat[~$5\%$~lifetime sparsity]{
\includegraphics[width=0.05\textwidth]{figures/second/0_05/001.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/002.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/003.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/004.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/005.pdf}\\
\includegraphics[width=0.05\textwidth]{figures/second/0_05/006.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/007.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/008.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/009.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/010.pdf}\\
\includegraphics[width=0.05\textwidth]{figures/second/0_05/011.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/012.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/013.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/014.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/015.pdf}\\
\includegraphics[width=0.05\textwidth]{figures/second/0_05/016.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/017.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/018.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/019.pdf}\hspace{0.1in}
\includegraphics[width=0.05\textwidth]{figures/second/0_05/020.pdf}
}
%\vspace{0.15in}
%\caption{~$5\%$~lifetime sparsity}\label{fig:ROI:fig3}
\end{minipage}
\end{figure}
\end{document}
答案1
你應該有迷你頁裡面 \subfloat
:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure}
\setkeys{Gin}{height=0.1\textwidth}% just for the example, remove
\centering
\subfloat[$2\%$~lifetime sparsity\label{fig:ROI:fig2}]{%
\begin{minipage}[t]{0.45\textwidth}
\centering
\includegraphics[width=0.1\textwidth]{figures/second/0_02/001.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/002.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/003.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/004.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/005.pdf}\\
\includegraphics[width=0.1\textwidth]{figures/second/0_02/006.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/007.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/008.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/009.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/010.pdf}\\
\includegraphics[width=0.1\textwidth]{figures/second/0_02/011.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/012.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/013.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/014.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/015.pdf}\\
\includegraphics[width=0.1\textwidth]{figures/second/0_02/016.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/017.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/018.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/019.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_02/020.pdf}
\end{minipage}%
}\hfil
\subfloat[~$5\%$~lifetime sparsity\label{fig:ROI:fig3}]{%
\begin{minipage}[t]{0.45\textwidth}
\centering
\includegraphics[width=0.1\textwidth]{figures/second/0_05/001.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/002.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/003.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/004.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/005.pdf}\\
\includegraphics[width=0.1\textwidth]{figures/second/0_05/006.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/007.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/008.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/009.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/010.pdf}\\
\includegraphics[width=0.1\textwidth]{figures/second/0_05/011.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/012.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/013.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/014.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/015.pdf}\\
\includegraphics[width=0.1\textwidth]{figures/second/0_05/016.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/017.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/018.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/019.pdf}
\includegraphics[width=0.1\textwidth]{figures/second/0_05/020.pdf}
\end{minipage}%
}
\caption{Global caption\label{fig:ROI}}
\end{figure}
\end{document}
該demo
選項和\setkeys
命令僅用於建立圖像,因為我沒有您的圖像。