LaTeX 错误:在主文本文件中定义时缺少 \begin{document}

LaTeX 错误:在主文本文件中定义时缺少 \begin{document}

我对 Latex 还不熟悉,使用的是 cleanthesis 格式,现在出现错误,提示缺少 \begin{document},但在主文档中明确定义了这一点,并且知道错误来自哪里。有人能帮帮我吗?

这是我的主文件代码:

\documentclass[%
    paper=A4,                   % paper size --> A4 is default in Germany
    twoside=true,               % onesite or twoside printing
    %openright,                 % doublepage cleaning ends up right side
    parskip=full,               % spacing value / method for paragraphs
    chapterprefix=true,         % prefix for chapter marks
    11pt,                       % font size
    headings=normal,            % size of headings
    bibliography=totoc,         % include bib in toc
    listof=totoc,               % include listof entries in toc
    titlepage=on,               % own page for each title page
    captions=tableabove,        % display table captions above the float env
    draft=false,                % value for draft version
    table{xcolor}               % added this
]{scrreprt}%

% **************************************************
% Debug LaTeX Information
% **************************************************
%\listfiles


% **************************************************
% Load and Configure Packages
% **************************************************
\usepackage[utf8]{inputenc}     % defines file's character encoding
\usepackage[english]{babel} % babel system, adjust the language of the content
\usepackage{enumitem}

\usepackage[                    % clean thesis style
    figuresep=colon,%
    sansserif=false,%
    hangfigurecaption=false,%
    hangsection=true,%
    hangsubsection=true,%
    colorize=full,%
    colortheme=bluemagenta,%
% LLT: Use biber if using UTF8 encoding
%   bibsys=bibtex,%
    bibsys=biber,%
    bibfile=bib-refs,%
    bibstyle=alphabetic,%
]{cleanthesis}

\hypersetup{                    % setup the hyperref-package options
    pdftitle={\thesisTitle},    %   - title (PDF meta)
    pdfsubject={\thesisSubject},%   - subject (PDF meta)
    pdfauthor={\thesisName},    %   - author (PDF meta)
    plainpages=false,           %   -
    colorlinks=false,           %   - colorize links?
    pdfborder={0 0 0},          %   -
    breaklinks=true,            %   - allow line break inside links
    bookmarksnumbered=true,     %
    bookmarksopen=true          %
}

% **************************************************
% Document CONTENT
% **************************************************



% --------------------------
% rename document parts
% --------------------------
\renewcaptionname{english}{\figurename}{Fig.}
\renewcaptionname{english}{\tablename}{Tab.}

% --------------------------
% Front matter
% --------------------------
\pagenumbering{roman}           % roman page numbing (invisible for empty page style)
\pagestyle{empty}               % no header or footers


\begin{document}
...
\end{document

答案1

如果你把它缩减到显示错误所需的最小值,你会得到

\documentclass[table{xcolor}]{scrreprt}
\begin{document}
...
\end{document}

这里的问题是table{xcolor}选项无效。你大概只想使用table,例如

\documentclass[table]{scrreprt}
\begin{document}
...
\end{document}

这样,如果该选项稍后在序言中加载,它将table被传递给包。xcolor

相关内容