![使用子图时出错](https://linux22.com/image/364460/%E4%BD%BF%E7%94%A8%E5%AD%90%E5%9B%BE%E6%97%B6%E5%87%BA%E9%94%99.png)
\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}