\begin{figure}[h]
\begin{subfigure}
\includegraphics[scale=0.2]{section7task4_1}
\caption{low frequency noise}
\end{subfigure}
\begin{subfigure}
\includegraphics[scale=0.2]{section7task4_2}
\caption{spectrally narrow noise}
\end{subfigure}
\end{figure}
有人知道我为什么会犯这个错误吗?
答案1
与minipage
环境类似,您必须指定subfigure
环境的宽度,即\begin{subfigure}{<width>}
。例如:
\documentclass{article}
\usepackage{subcaption}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}[h]
\begin{subfigure}{0.45\linewidth}
\centering
\includegraphics[scale=0.2]{section7task4_1}
\caption{low frequency noise}
\end{subfigure}\hfill
\begin{subfigure}{0.45\linewidth}
\centering
\includegraphics[scale=0.2]{section7task4_2}
\caption{spectrally narrow noise}
\end{subfigure}
\end{figure}
\end{document}