这个 \begin{document} 错误是什么意思?

这个 \begin{document} 错误是什么意思?

代码

\documentclass{article}   
\usepackage{caption}; 
\usepackage{longtable}; 
\usepackage{booktabs}
\begin{document}
Discussion.

\begin{longtable}[c]{@{}ll@{}}
\caption{People and their roles in the lab.}\tabularnewline
\toprule
\begin{minipage}[b]{0.37\columnwidth}\raggedright\strut
People in lab
\strut\end{minipage} &
\begin{minipage}[b]{0.30\columnwidth}\raggedright\strut
Roles
\strut\end{minipage}\tabularnewline
\midrule
\endfirsthead
\toprule
\begin{minipage}[b]{0.37\columnwidth}\raggedright\strut
People in lab
\strut\end{minipage} &
\begin{minipage}[b]{0.30\columnwidth}\raggedright\strut
Roles
\strut\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.37\columnwidth}\raggedright\strut
Masi wk 1.
\strut\end{minipage} &
\begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
Gems
\strut\end{minipage}\tabularnewline
\begin{minipage}[t]{0.37\columnwidth}\raggedright\strut
Henri
\strut\end{minipage} &
\begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
 present
\strut\end{minipage}\tabularnewline
\begin{minipage}[t]{0.37\columnwidth}\raggedright\strut
Pena
\strut\end{minipage} &
\begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
construction
\strut\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\end{document}

这给出了有关缺失的错误\begin{document},这对我来说没有意义。

在此处输入图片描述

Pandoc 表格中第一行有相同的缺陷

在此处输入图片描述

日志

This is XeTeX, Version 3.14159265-2.6-0.99991 (TeX Live 2014) (preloaded format=xelatex 2014.11.23)  23 MAY 2015 12:07
entering extended mode
 restricted \write18 enabled.
 file:line:error style messages enabled.
 %&-line parsing enabled.
**test.tex
(./test.tex
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 79 languages loaded.
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/article.cls
Document Class: article 2014/09/29 v1.4h Standard LaTeX document class
(/usr/local/texlive/2014/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
)
\c@part=\count80
\c@section=\count81
\c@subsection=\count82
\c@subsubsection=\count83
\c@paragraph=\count84
\c@subparagraph=\count85
\c@figure=\count86
\c@table=\count87
\abovecaptionskip=\skip41
\belowcaptionskip=\skip42
\bibindent=\dimen102
)
(/usr/local/texlive/2014/texmf-dist/tex/latex/caption/caption.sty
Package: caption 2013/05/02 v3.3-89 Customizing captions (AR)

(/usr/local/texlive/2014/texmf-dist/tex/latex/caption/caption3.sty
Package: caption3 2013/05/02 v1.6-88 caption3 kernel (AR)
Package caption3 Info: TeX engine: e-TeX on input line 57.

(/usr/local/texlive/2014/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)
\captionmargin=\dimen103
\captionmargin@=\dimen104
\captionwidth=\dimen105
\caption@tempdima=\dimen106
\caption@indent=\dimen107
\caption@parindent=\dimen108
\caption@hangindent=\dimen109
)
\c@ContinuedFloat=\count88
)

./test.tex:3: LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.3 \usepackage{caption};

You're in trouble here.  Try typing  <return>  to proceed.
If that doesn't work, type  X <return>  to quit.

(/usr/local/texlive/2014/texmf-dist/tex/latex/tools/longtable.sty
Package: longtable 2014/10/28 v4.11 Multi-page Table package (DPC)
\LTleft=\skip43
\LTright=\skip44
\LTpre=\skip45
\LTpost=\skip46
\LTchunksize=\count89
\LTcapwidth=\dimen110
\LT@head=\box26
\LT@firsthead=\box27
\LT@foot=\box28
\LT@lastfoot=\box29
\LT@cols=\count90
\LT@rows=\count91
\c@LT@tables=\count92
\c@LT@chunks=\count93
\LT@p@ftn=\toks15
)
(/usr/local/texlive/2014/texmf-dist/tex/latex/booktabs/booktabs.sty
Package: booktabs 2005/04/14 v1.61803 publication quality tables
\heavyrulewidth=\dimen111
\lightrulewidth=\dimen112
\cmidrulewidth=\dimen113
\belowrulesep=\dimen114
\belowbottomsep=\dimen115
\aboverulesep=\dimen116
\abovetopsep=\dimen117
\cmidrulesep=\dimen118
\cmidrulekern=\dimen119
\defaultaddspace=\dimen120
\@cmidla=\count94
\@cmidlb=\count95
\@aboverulesep=\dimen121
\@belowrulesep=\dimen122
\@thisruleclass=\count96
\@lastruleclass=\count97
\@thisrulewidth=\dimen123
)
(./test.aux)
\openout1 = `test.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
Package caption Info: Begin \AtBeginDocument code.
Package caption Info: longtable package is loaded.

(/usr/local/texlive/2014/texmf-dist/tex/latex/caption/ltcaption.sty
Package: ltcaption 2013/02/03 v1.3-62 longtable captions (AR)
)
Package caption Info: End \AtBeginDocument code.
 [1

]
(./test.aux) ) 
Here is how much of TeX's memory you used:
 1455 strings out of 493724
 23935 string characters out of 6145898
 84695 words of memory out of 5000000
 4848 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 1328 hyphenation exceptions out of 8191
 36i,9n,44p,206b,324s stack positions out of 5000i,500n,10000p,200000b,80000s

Output written on test.pdf (1 page).

这里缺失的错误是什么\begin{document}意思?

为什么第一行就会出现缺陷?

答案1

错误发生;在语句之后\usepackage{...},但我不知道pandoc如果有自动生成,如何才能防止这种情况发生

如果 LaTeX 在序言中遇到排版材料(例如文本、标点符号),它将发出错误消息missing document,因为序言中不允许出现此类内容。

\documentclass{article}   
\usepackage{caption}  % Removed the ; here
\usepackage{longtable} % and removed ; here
\usepackage{booktabs}
\begin{document}
Discussion.

\begin{longtable}[c]{@{}ll@{}}
\caption{People and their roles in the lab.}\tabularnewline
\toprule
\begin{minipage}[b]{0.37\columnwidth}\raggedright\strut
People in lab
\strut\end{minipage} &
\begin{minipage}[b]{0.30\columnwidth}\raggedright\strut
Roles
\strut\end{minipage}\tabularnewline
\midrule
\endfirsthead
\toprule
\begin{minipage}[b]{0.37\columnwidth}\raggedright\strut
People in lab
\strut\end{minipage} &
\begin{minipage}[b]{0.30\columnwidth}\raggedright\strut
Roles
\strut\end{minipage}\tabularnewline
\midrule
\endhead
\begin{minipage}[t]{0.37\columnwidth}\raggedright\strut
Masi wk 1.
\strut\end{minipage} &
\begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
Gems
\strut\end{minipage}\tabularnewline
\begin{minipage}[t]{0.37\columnwidth}\raggedright\strut
Henri
\strut\end{minipage} &
\begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
 present
\strut\end{minipage}\tabularnewline
\begin{minipage}[t]{0.37\columnwidth}\raggedright\strut
Pena
\strut\end{minipage} &
\begin{minipage}[t]{0.30\columnwidth}\raggedright\strut
construction
\strut\end{minipage}\tabularnewline
\bottomrule
\end{longtable}

\end{document}

相关内容