![Overleaf、LaTeX:缺失数字,视为零](https://linux22.com/image/438260/Overleaf%E3%80%81LaTeX%EF%BC%9A%E7%BC%BA%E5%A4%B1%E6%95%B0%E5%AD%97%EF%BC%8C%E8%A7%86%E4%B8%BA%E9%9B%B6.png)
我正在写报告。我想把图片并排摆放,所以我遵循了这个教程。我收到以下错误:
\begin{figure}[h]
\begin{subfigure}{0.5\textwidth} % this line generates the error!!
\includegraphics[width=0.9\linewidth, height=6cm]{images/konectom_tests/spiral.png}
\caption{Caption1}
\label{fig:subim1}
\end{subfigure}
\begin{subfigure}{0.5\textwidth}
\includegraphics[width=0.9\linewidth, height=6cm]{images/konectom_tests/spiral.png}
\caption{Caption 2}
\label{fig:subim2}
\end{subfigure}
\caption{Caption for this figure with two images}
\label{fig:image2}
\end{figure}
产生的错误:
% ----> Missing number, treated as zero.
<to be read again>
}
l.408 \begin{subfigure}{0.5\textwidth}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
看来 0.5\textwidth 解释不正确!
这些是所有导入的:
% Liste de paquets potentiellement utiles pour votre rédaction
\documentclass[a4paper, oneside]{report}
\usepackage[english]{babel} % fonctionnalités en !français (anglais)
\usepackage[utf8x]{inputenc} % support de l'encodage utf8
\usepackage{listings, listings-rust} % permet d'insérer du code
\usepackage{hyperref} % liens
\usepackage{subfigure} % schémas
\usepackage{amsmath} % pour ajouter des équations
\usepackage{graphicx,wrapfig} % pour \includegraphics
\usepackage{appendix} % pour ajouter des appendices à votre rapport
\usepackage[T1]{fontenc}
\usepackage{caption}
\usepackage{subcaption}
\usepackage[a4paper,top=2cm,bottom=2cm,left=2cm,right=2cm,marginparwidth=2cm]{geometry}
```