有趣的是,直到昨天我还可以轻松运行此代码而没有任何错误,但突然它不断发送缺少开始文档的错误。我看到一些类似的问题,有人建议将文件复制为某种特殊格式,但我不知道该怎么做。我的文件有多个章节,我在其他 5 个 latex 文件中输入了我作品的其他部分。你能帮我吗?谢谢 这是我的代码:
\documentclass[pdftex,12pt]{report}
% all required packages
\AtBeginDocument{\addtocontents{toc}{\protect\thispagestyle{empty}}}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[document]{ragged2e}
\renewcommand{\chaptermark}[1]{%
\markboth{#1}{\thechapter\ #1}}
\renewcommand{\sectionmark}[1]{%
\markright{\thesection\ #1}}
\newcommand{\HRule}{\rule{\linewidth}{0.5mm}}
\begin{document}
\pagestyle{fancy}
\setcounter{page}{1}
\pagenumbering{roman}
\cleardoublepage
\pagestyle{fancy}
\setcounter{page}{1}
\pagenumbering{arabic}
\chapter{Introduction}
\input{A-Introduction/Introduction}
\chapter{Preliminaries and Notions}
\input{B-Preliminaries/Preliminaries}
\chapter{Backbone Colouring}
\input{C-Studysofar/Studysofar.tex}
\chapter{Algorithm for Finding Backbone}
\input{D-Mine/Mine.tex}
\chapter{Conclusion}
\input{E-Conclusion/Conclusion.tex}
\doublespacing
\listoffigures
\addcontentsline{toc}{chapter}{Table of Figures}
\end{document}
这是我遇到的错误,我复制并粘贴了其中的一部分:
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.1 +
% Copyright (c) 2012
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
Missing character: There is no + in font nullfont!
Overfull \hbox (20.0pt too wide) in paragraph at lines 1--5
[]
[]
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\report.cls"
Document Class: report 2007/10/19 v1.4h Standard LaTeX document class
("C:\Program Files (x86)\MiKTeX 2.9\tex\latex\base\size12.clo"
File: size12.clo 2007/10/19 v1.4h Standard LaTeX file (size option)
)
答案1
你+
文件的第一行没有注释,所以 TeX 试图在 之前\documentclass
(和 之前\begin{document}
) 排版它。因此出现错误消息。