子图不工作

子图不工作

我有这个测试文档

\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}

\begin{figure}
\centering
\begin{subfigure}{0.4\textwidth}
    \includegraphics[width=\textwidth]{example-image}
    \caption{Firts subfigure.}
    \label{fig:first}
\end{subfigure}
\vfill
\begin{subfigure}{0.4\textwidth}
    \includegraphics[width=\textwidth]{example-image}
    \caption{Second subfigure.}
    \label{fig:second}
\end{subfigure}
\vfill
\begin{subfigure}{0.4\textwidth}
    \includegraphics[width=\textwidth]{example-image}
    \caption{Third subfigure.}
    \label{fig:third}
\end{subfigure}
\caption{Creating subfigures in \LaTeX.}
\label{fig:figures}
\end{figure}

\end{document}

一切看起来都应该如此

在此处输入图片描述

但如果把它放到我的真实文档中

\documentclass[a4paper,12pt,twoside]{article}
\oddsidemargin 0in
\headheight 0in
\usepackage{graphicx}
\usepackage{fancybox}
\usepackage[utf8]{inputenc}
\usepackage{epsfig}
\usepackage{multicol,pst-plot}
\usepackage{pstricks}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{eucal}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{siunitx}
\pagestyle{empty}
\usepackage{float}
\usepackage[caption = false]{subfig}
\usepackage{makecell}
\usepackage{listings}
\usepackage{color}
\usepackage{outlines}
\usepackage{upgreek}
\usepackage{subcaption}

% new commands
\newcommand{\cm}{\, \si{cm}}
\newcommand{\mm}{\, \si{mm}}
\newcommand{\s}{\, \si{s}}
\newcommand{\kg}{\, \si{kg}}
\newcommand{\g}{\, \si{g}}
\newcommand{\mA}{\, \si{mA}}
\newcommand{\A}{\, \si{A}}
\newcommand{\V}{\, \si{V}}
\newcommand{\Hz}{\, \si{Hz}}
\newcommand{\K}{\, \si{K}}
\newcommand{\kohm}{\, \si{k\ohm}}

\newcommand{\OR}{OpenRocket }

\newcolumntype{?}{!{\vrule width 1pt}}

\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}

\def\shrug{\texttt{\raisebox{0.75em}{\char`\_}\char`\\\char`\_\kern-0.5ex(\kern-0.25ex\raisebox{0.25ex}{\rotatebox{45}{\raisebox{-.75ex}"\kern-1.5ex\rotatebox{-90})}}\kern-0.5ex)\kern-0.5ex\char`\_/\raisebox{0.75em}{\char`\_}}}

\lstdefinestyle{mystyle}{
    backgroundcolor=\color{backcolour},   
    commentstyle=\color{codegreen},
    keywordstyle=\color{magenta},
    numberstyle=\tiny\color{codegray},
    stringstyle=\color{codepurple},
    basicstyle=\footnotesize,
    breakatwhitespace=false,         
    breaklines=true,                 
    captionpos=b,                    
    keepspaces=true,                 
    numbers=left,                    
    numbersep=5pt,                  
    showspaces=false,                
    showstringspaces=false,
    showtabs=false,                  
    tabsize=2
}

\lstset{style=mystyle}

\begin{document}
\pagestyle{plain}

% Header ======================================================================
\begin{flushright}\vspace{-0cm}
\includegraphics[height=2.5cm]{logos/Logo_Print_300dpi_px2044x2044.png}
\end{flushright}

\begin{flushleft}\vspace{-3cm}
\includegraphics[height=2.5cm]{logos/Simulations_icon.png}
\end{flushleft}
 
\begin{center}\vspace{-3cm}
\textbf{\large Simulations Report} 
\\ \vspace{0.5cm}
\large NAME
\\ \vspace{0.5cm}
\large March 2023
\end{center}

\noindent \rule{\linewidth}{0.1mm} % ==========================================
\lstset{language=Python}

\begin{abstract}
In this Report we optimise the fin design for altitude, while also taking in to account the stability as described in \cite{Stability_and_Fin_Design}.
\end{abstract}

\section{Roll Coupling}

\begin{figure}
\centering
\begin{subfigure}{0.4\textwidth}
    \includegraphics[width=\textwidth]{example-image}
    \caption{Firts subfigure.}
    \label{fig:first}
\end{subfigure}
\vfill
\begin{subfigure}{0.4\textwidth}
    \includegraphics[width=\textwidth]{example-image}
    \caption{Second subfigure.}
    \label{fig:second}
\end{subfigure}
\vfill
\begin{subfigure}{0.4\textwidth}
    \includegraphics[width=\textwidth]{example-image}
    \caption{Third subfigure.}
    \label{fig:third}
\end{subfigure}
\caption{Creating subfigures in \LaTeX.}
\label{fig:figures}
\end{figure}


\bibliographystyle{References/plain}
\bibliography{References/References}

\end{document}

它说Environment subfigure undefined 知道为什么吗?我正在使用 Overleaf。

相关内容