我遇到了很多错误,告诉我缺少了一些项目,尽管我找不到任何我未包括的项目。这种情况发生在图片、表格、浮动图以及文档中的所有内容上。我使用包含大部分序言的简单表格展示了这个问题,以防我在那里犯了任何错误。
TexStudio 的错误输出:
line 13: Something's wrong--perhaps a missing \item. \begin{table}
line 13: Something's wrong--perhaps a missing \item. \begin{table}
line 13: Something's wrong--perhaps a missing \item. \begin{table}
line 22: You can't use `\hrule' here except with leaders. \caption{Some caption}
line 22: Missing number, treated as zero. \caption{Some caption}
line 22: Illegal unit of measure (pt inserted). \caption{Some caption}
line 22: Missing \endgroup inserted. \caption{Some caption}
line 22: Missing \endgroup inserted. \caption{Some caption}
line 22: Missing \endgroup inserted. \caption{Some caption}
line 22: Missing } inserted. \caption{Some caption}
line 22: Undefined control sequence. \caption{Some caption}
line 22: Undefined control sequence. \caption{Some caption}
line 22: Undefined control sequence. \caption{Some caption}
line 22: Undefined control sequence. \caption{Some caption}
line 22: Extra \endgroup. \caption{Some caption}
line 24: Something's wrong--perhaps a missing \item. \end{table}
line 24: \begin{document} ended by \end{table}. \end{table}
line 24: Extra \endgroup. \end{table}
line 28: Extra \endgroup. \end{document}
line 28: Too many }'s. \end{document}
: Option "binary-units" has been removed in this(siunitx) release.
line 22: Overfull \hbox (15.0pt too wide) in paragraph
代码:
\documentclass[margin=2cm]{standalone}
\usepackage[x11names,table]{xcolor}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{groupplots,units,}
\usepackage[binary-units = true]{siunitx}
\usepackage{booktabs}
\usepackage{amsmath,caption}
\begin{document}
\begin{table}[h!]
\centering
\begin{tabular}{c c}
\toprule
Col1 & Col2 \\
\midrule
1 & Value of 1 \\
2 & \num{4e10} \\
\end{tabular}
\caption{Some caption}
\label{table:demo_table}
\end{table}
My table \ref{table:demo_table} contains relevant data.
\end{document}
我已经通过使用 TexStudio 和 JetBrains IDEA 编译此网站上另一个问题的 MWE 来确认我的 Latex 安装正在运行。任何帮助都非常感谢。
答案1
只看第一个错误,后面的错误通常是虚假的
! LaTeX Error: Something's wrong--perhaps a missing \item.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.13 \begin{table}
[h!]
?
默认情况下,以水平模式处理内容,以便可以测量宽度,所以这就像在使用选项以允许垂直构造的standalone
图形一样\mbox
varwidth
如果您将第一行更改为
\documentclass[margin=2cm,varwidth]{standalone}