我想将几张共享一个标题的图片插入“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
命令仅用于构建图像,因为我没有您的图像。