颜色包导致文档中每个表环境实例出现 3 个错误

颜色包导致文档中每个表环境实例出现 3 个错误

因此,每当我尝试使用color/xcolor包时,整个文档都会针对每个table环境实例抛出以下三个错误,我不知道为什么。

如果我注释掉加载xcolor包的行,它就可以正常工作。下面的代码是一个简化的示例,仍然会触发错误。

请注意有两个表。第一个表table未使用环境,因此它不会跳闸,但第二个表使用table环境并导致系统跳闸。

\documentclass{report}
\usepackage[dvipsnames]{xcolor}
\usepackage{cuthesis}

\begin{document}
    \chapter{Sample}

        \section{Section}

            \begin{center}
                \begin{tabular}{ |c|c|c|c| } 
                    \hline
                    col1 & col2 & col3 \\
                    \hline
                    & cell5 & cell6 \\ 
                    & cell8 & cell9 \\ 
                    \hline
                \end{tabular}
            \end{center}

            \begin{table}[h!]
            \centering
                \begin{tabular}{||c c c c||} 
                    \hline
                    Col1 & Col2 & Col2 & Col3 \\ [0.5ex] 
                    \hline\hline
                    1 & 6 & 87837 & 787 \\ 
                    2 & 7 & 78 & 5415 \\
                    \hline
                \end{tabular}
            \end{table}

\end{document}

我认为自定义包cuthesis可能是造成这种情况的原因。不幸的是,我无法简化 sty 文件,因此我将在此处提供完整的代码。请注意,我不是该文件的作者/所有者,我只是按照大学的要求使用它 -

\ProvidesPackage{cuthesis}[2019/10/23 Concordia University Thesis Style Package]

\everyjob{\typeout{Concordia University Thesis Style, Steve Malowany <10 Jan 1992>}}
\everyjob{\typeout{\space\space\space\space\space\space\space\space\space\space
\space\space\space\space\space\space\space\space\space\space\space
\space\space\space\space\space revised by Stan Swiercz <28 Mar 1995>}}
\everyjob{\typeout{\space\space\space\space\space\space\space\space\space\space
\space\space\space\space\space\space\space\space\space\space\space
\space\space\space revised by Patrice Chalin <12 Sep 1995>}}
\everyjob{\typeout{\space\space\space\space\space\space\space\space\space\space
\space\space\space\space\space\space\space\space\space\space\space
\space\space\space\space\space revised by Stan Swiercz <24 Sep 1996>}}

\immediate\write10{Concordia University Thesis Style, Steve Malowany <10 Jan 1992>}
\immediate\write10{\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space revised by Stan Swiercz <28 Mar 1995>}
\immediate\write10{\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space revised by Patrice Chalin <12 Sep 1995>}
\immediate\write10{\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space\space revised by Stan Swiercz <24 Sep 1996>}
%
\makeatletter
\oddsidemargin 0.5in \evensidemargin 0.5in
\marginparwidth 40pt \marginparsep 10pt
%\topmargin 0pt \headsep .5in         % no longer acceptable
%\textheight 8.1in \textwidth 6in     % no longer acceptable
\topmargin 0in \headsep 0in %-0.1 topmargin
\textheight 8.75in \textwidth 6in %9in textheight
\brokenpenalty=10000
\renewcommand{\baselinestretch}{1.3}

% for continous numbering of figures & tables across chapters use the following:
\def\cl@chapter{\@elt{section}\@elt{footnote}}
\def\thefigure{\@arabic\c@figure}
\def\thetable{\@arabic\c@table}

% for figures  & tables numbered in the conventional 
% report style (chapter.number)
% comment the above 3 lines and uncomment the following line:
\def\cl@chapter{\@elt{section}\@elt{footnote}\@elt{figure}\@elt{table}}

\def\theequation{\arabic{equation}}

\def\@xfloat#1[#2]{\ifhmode \@bsphack\@floatpenalty -\@Mii\else
   \@floatpenalty-\@Miii\fi\def\@captype{#1}\ifinner
      \@parmoderr\@floatpenalty\z@
    \else\@next\@currbox\@freelist{\@tempcnta\csname ftype@#1\endcsname
       \multiply\@tempcnta\@xxxii\advance\@tempcnta\sixt@@n
       \@tfor \@tempa :=#2\do
                        {\if\@tempa h\advance\@tempcnta \@ne\fi
                         \if\@tempa t\advance\@tempcnta \tw@\fi
                         \if\@tempa b\advance\@tempcnta 4\relax\fi
                         \if\@tempa p\advance\@tempcnta 8\relax\fi
         }\global\count\@currbox\@tempcnta}\@fltovf\fi
    \global\setbox\@currbox\vbox\bgroup 
    \def\baselinestretch{1}\@normalsize
    \boxmaxdepth\z@
    \hsize\columnwidth \@parboxrestore}
\long\def\@footnotetext#1{\insert\footins{\def\baselinestretch{1}\footnotesize
    \interlinepenalty\interfootnotelinepenalty 
    \splittopskip\footnotesep
    \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
    \hsize\columnwidth \@parboxrestore
   \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
    {\rule{\z@}{\footnotesep}\ignorespaces
      #1\strut}}}

\def\degree#1{\gdef\@Degree{#1}}
\def\dept#1{\gdef\@dept{#1}}
\def\principaladviser#1{\gdef\@principaladviser{#1}}
\def\advis@r{Adviser}
\def\principaladvisor#1{\gdef\@principaladviser{#1}\gdef\advis@r{Advisor}}
\def\firstreader#1{\gdef\@firstreader{#1}}
\def\secondreader#1{\gdef\@secondreader{#1}}
\def\submitdate#1{\gdef\@submitdate{#1}}
\def\copyrightyear#1{\gdef\@copyrightyear{#1}} % \author, \title in report
%
% If your name contains accents then you must use for example
%   \a'{a} instead of \'{a}
%
\def\@title{}\def\@author{}\def\@Degree{}\def\@dept{Computer Science}
\def\@principaladviser{}\def\@firstreader{}\def\@secondreader{}
\def\@submitdate{\ifcase\the\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space \number\the\year}
\ifnum\month=12
    \@tempcnta=\year \advance\@tempcnta by 1
    \edef\@copyrightyear{\number\the\@tempcnta}
\else
    \def\@copyrightyear{\number\the\year}
\fi
\newif\ifcopyright \newif\iffigurespage \newif\iftablespage
\copyrighttrue \figurespagetrue \tablespagetrue

% \titeOfPhDAuthor is to be set to Mr. or Mrs., etc.
\def\titleOfPhDAuthor#1{\gdef\@titleOfPhDAuthor{#1}}
\newif\ifphd % if not PhD then Masters
\def\PhDDegree{Doctor of Philosophy}
\def\PhD{\phdtrue}
\let\phd\PhD
\def\Masters{\phdfalse}
\let\masters\Masters
\let\Master\Masters
\let\master\Masters
\Masters % by default
\newif\ifcosupervisor
\let\cosupervisor\cosupervisortrue
\cosupervisorfalse

\def\titlep{%
        \thispagestyle{empty}%
        \null\vskip1in%
        \begin{center}
% The following line added extra vertical spacing in titles with more
% than 2 lines. Changed September 24, 1996.
%                {\Large\uppercase\expandafter{\@title}}
                \Large\uppercase\expandafter{\@title}
        \end{center}
        \vfill
        \begin{center}
                \sc \@author
        \end{center}
        \vskip.5in
        \begin{center}
            \sc A thesis\\
            in\\
            The Department\\
            of\\
            \expandafter{\@dept}\\
        \end{center}
        \vskip.5in
        \begin{center}
                \sc Presented in Partial Fulfillment of the Requirements\\
                For the Degree of \ifphd\PhDDegree\else\@Degree\fi\\
                Concordia University\\
                Montr\'{e}al, Qu\'{e}bec, Canada
        \end{center}
        \vfill
        \begin{center}
                \sc \@submitdate\\
                \copyright \ {\@author}, \@copyrightyear
        \end{center}\vskip.5in\newpage}

\long\def\phdsignature#1{%
\begin{center}
\begin{minipage}{4in}
\parindent=0pt
I certify that I have read this thesis and that in my opinion
it is fully adequate, in scope and in quality, as a dissertation for the degree
of Doctor of Philosophy.
\par
\vspace{.5in}
\hbox to 4in{\hfil\shortstack{\vrule width 3in height 0.4pt\\#1}}
\end{minipage}
\end{center}}

\def\signaturepage{%
    \begin{center}
        {\Large \sc Concordia University}\\
        {\large School of Graduate Studies}
    \end{center}
    \vspace{.5in}
    This is to certify that the thesis prepared
    \begin{tabbing}
        \hspace*{1.2in} \= \kill
        By:           \> \bf \ifphd\@titleOfPhDAuthor~\fi\@author \\
        Entitled:     \> \parbox[t]{4.6in}{ \bf \@title}
    \end{tabbing}
    and submitted in partial fulfillment of the requirements for the degree of
    \begin{center}
        \bf \ifphd\PhDDegree~(\@Degree)\else\@Degree\fi
    \end{center}
    complies with the regulations of this University and meets the
    accepted standards with respect to originality and quality.\\
    \ \\
    Signed by the final examining commitee:\\
    \ \\
    \hspace*{1cm} \hrulefill \makebox[3cm][l]{ Chair} \\
    \ifphd%
    \hspace*{1cm} \hrulefill \makebox[3cm][l]{ External Examiner} \\
    \fi%
    \hspace*{1cm} \hrulefill \makebox[3cm][l]{ Examiner} \\
    \hspace*{1cm} \hrulefill \makebox[3cm][l]{ Examiner} \\
    \hspace*{1cm} \hrulefill \makebox[3cm][l]{ Examiner} \\
    \hspace*{1cm} \hrulefill \makebox[3cm][l]{ Supervisor}\\
    \ifcosupervisor%
    \hspace*{1cm} \hrulefill \makebox[3cm][l]{ Co-supervisor}\\
    \fi%
    \ \\
    Approved \hrulefill\\
    \hspace*{1.3in} \raisebox{.2cm}{
        \mbox{Chair of Department or Graduate Program Director}}
    \ \\ \ \\
    \makebox[1.2in]{\hrulefill} \ 20 \makebox[.5in]{\hrulefill} \ \hrulefill \\
    \hspace*{2.6in} \parbox[t]{4in}{Rama Bhat, Ph.D.,ing., FEIC, FCSME, FASME, Interim Dean \\
                      Faculty of Engineering and Computer Science}
}

\def\beforepreface{
        \pagenumbering{roman}
        \pagestyle{plain}
        \thispagestyle{empty}
        \titlep
        \thispagestyle{empty}
        \signaturepage}

\def\mastersabstract{%
        \thispagestyle{empty}
        \newpage
        \null\vskip.25in%
        \begin{center}
                {\LARGE\bf{Abstract}}
        \end{center}
        \begin{center}
% The following line added extra vertical spacing in titles with more
% than 2 lines. Changed September 24, 1996.
%              {\large\expandafter{\@title}}
                \large\expandafter{\@title}
        \end{center}
        \begin{center}  
                \@author\\ \null
        \end{center}
%       \addcontentsline{toc}{chapter}{Abstract}
}


\def\phdabstract{%
        \newpage
        \null\vskip.25in%
        \begin{center}
                {\LARGE\bf{Abstract}}
        \end{center}
        \begin{center}
                {\large\expandafter{\@title}}
        \end{center}
        \@author, Ph.D. \\ Concordia University, \@copyrightyear\\ \null \\
%       \addcontentsline{toc}{chapter}{Abstract}
} 

\def\prefacesection#1{%
        \chapter*{#1}
%       \addcontentsline{toc}{chapter}{#1}
}

\def\afterpreface{\newpage
 %%       \tableofcontents       TOC, extra blank page are Commented off by Dr Bergler until final thesis file.
 %%       \newpage
 %%       \iffigurespage
  %%      \addcontentsline{toc}{chapter}{List of Figures} % list of figures
 %%               {\addvspace{10pt}
 %%               \let\saveaddvspace=\addvspace
  %%              \def\addvspace##1{}
 %%               \listoffigures
 %%               \let\addvspace=\saveaddvspace}
 %%               \newpage
 %%       \fi
 %%       \iftablespage
 %%       \addcontentsline{toc}{chapter}{List of Tables}   % list of tables
 %%               {\addvspace{10pt}
 %%               \let\saveaddvspace=\addvspace
 %%               \def\addvspace##1{}
 %%               \listoftables
 %%               \let\addvspace=\saveaddvspace}
 %%               \newpage
 %%       \fi
        \pagenumbering{arabic}
%       \pagestyle{headings}}     % no longer acceptable
}
% Start with pagestyle{headings} in case front matter isn't processed
%\pagestyle{headings}             % no longer acceptable

\renewenvironment{abstract}
       {\beforepreface
        \ifphd\phdabstract\else\mastersabstract\fi}
       {}
\newenvironment{acknowledgments}
       {\prefacesection{Acknowledgments}}
       {\afterpreface}

\makeatother

文档中每个表实例都会触发以下错误 -

  1. } 太多。
    \color@endbox ->\color@endgroup \egroup
    l.250 \end{table*}
    您关闭的群组比您打开的群组多。这样的失误通常无伤大雅,所以请继续。

  2. LaTeX 错误:\begin{document} 由 \end{table*} 结束。
    请参阅 LaTeX 手册或 LaTeX Companion 了解说明。
    输入 H 可立即获得帮助。...
    l.250
    \end{table*}
    您的命令已被忽略。键入 I 以将其替换为其他命令,或继续执行而不执行该命令。

  3. 额外的 \endgroup。
    \endgroup
    l.250 \end{table*}
    情况很混乱,但我认为最糟糕的时期已经过去了。

我正在使用 Overleaf 来处理 LaTex 文档和pdfLatex编译器。如果我可以提供更多信息,请告诉我。如果您能提供任何有关如何修复此错误的线索,我将不胜感激。

太感谢了。

附件 - 错误快照如下 -

附加错误图片

相关内容