我每次使用 AMS 包之一时都会遇到一个问题(无论我使用什么文档类或模板),例如amsmath
或amsthm
。在命令后的下一行,\usepackage
LaTeX 识别出一个错误,File ended while scanning use of \@newenv.
它还会显示几个原本不会发生的警告。
我该如何摆脱这个问题?
更新
为了提供示例,我清除了文档中的几行,问题就消失了。然后我将这些行逐行添加回去,并在每一步之后编译文档。问题从未发生过。但是,我可以通过使用这些包中的一个模板简单地让错误再次出现。这是我在 overleaf.com 上找到的:
\documentclass[a4paper,12pt]{article}
%%% Работа с русским языком
\usepackage[english,russian]{babel} %% загружает пакет многоязыковой вёрстки
\usepackage{fontspec} %% подготавливает загрузку шрифтов Open Type, True Type и др.
\defaultfontfeatures{Ligatures={TeX},Renderer=Basic} %% свойства шрифтов по умолчанию
\setmainfont[Ligatures={TeX,Historic}]{Times New Roman} %% задаёт основной шрифт документа
\setsansfont{Comic Sans MS} %% задаёт шрифт без засечек
\setmonofont{Courier New}
\usepackage{indentfirst}
\frenchspacing
%%% Дополнительная работа с математикой
\usepackage{amsmath,amsfonts,amssymb,amsthm,mathtools} % AMS
\usepackage{icomma} % "Умная" запятая: $0,2$ --- число, $0, 2$ --- перечисление
\author{\LaTeX{} в Вышке}
\title{5.2.2. Русский язык в \LaTeX: Xe\LaTeX}
\date{\today}
\begin{document} % конец преамбулы, начало документа
\maketitle
\begin{abstract}
Текст аннотации
\end{abstract}
\end{document} % конец документа
更新 2
抱歉,错误没有消失。我不小心将amsmath
package 与混淆了amsthm
。错误仅发生在后者。
更新 3
AMS 包裹信息:
- amsmath.sty 2013/01/14 v2.14 AMS 数学功能
- amstext.sty 2000/06/29 v2.01
- amsgen.sty 1999/11/30 v2.0
- amsbsy.sty 1999/11/29 v1.2d
- amsopn.sty 1999/12/14 v2.01 运营商名称
- amsthm.sty 2015/03/04 v2.20.2
更新 4
完整的 MWE 日志
\documentclass{article}
\usepackage{amsthm}
\begin{document}
Some text
\end{document}
日志档案:
This is pdfTeX, Version 3.14159265-2.6-1.40.16 (MiKTeX 2.9) (preloaded format=pdflatex 2016.3.17) 27 MAY 2016 20:03
entering extended mode
**./document.tex
(document.tex
LaTeX2e <2015/10/01> patch level 2
Babel <3.9n> and hyphenation patterns for 69 languages loaded.
(D:\Programs\MiKTeX\tex\latex\base\article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(D:\Programs\MiKTeX\tex\latex\base\size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count79
\c@section=\count80
\c@subsection=\count81
\c@subsubsection=\count82
\c@paragraph=\count83
\c@subparagraph=\count84
\c@figure=\count85
\c@table=\count86
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(D:\Programs\MiKTeX\tex\latex\amscls\amsthm.sty
Package: amsthm 2015/03/04 v2.20.2
\thm@style=\toks14
\thm@bodyfont=\toks15
\thm@headfont=\toks16
\thm@notefont=\toks17
\thm@headpunct=\toks18
\thm@preskip=\skip43
\thm@postskip=\skip44
\thm@headsep=\skip45
\dth@everypar=\toks19
)
Runaway argument?
! File ended while scanning use of \@newenv.
<inserted text>
\par
l.3 \begin
{document}
I suspect you have forgotten a `}', causing me
to read past where you wanted me to stop.
I'll try to recover; but if the error is serious,
you'd better type `E' or `X' now and fix your file.
(document.aux)
\openout1 = `document.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 3.
LaTeX Font Info: ... okay on input line 3.
[1
{C:/Users/khizza/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}] (document.
aux) )
Here is how much of TeX's memory you used:
298 strings out of 493634
3140 string characters out of 3147412
52660 words of memory out of 3000000
3765 multiletter control sequences out of 15000+200000
3640 words of font info for 14 fonts, out of 3000000 for 9000
1025 hyphenation exceptions out of 8191
23i,4n,17p,137b,107s stack positions out of 5000i,500n,10000p,200000b,50000s
<D:/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on document.pdf (1 page, 12239 bytes).
PDF statistics:
10 PDF objects out of 1000 (max. 8388607)
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)