我正在使用 ociamthesis.cls (https://www.maths.ox.ac.uk/system/files/legacy/2894/ociamthesis.cls)来写我的论文。ociamthesismain.tex 代码如下所示:
\documentclass[12pt]{ociamthesis}
\let\olddegree\degree % Store \degree in \olddegree
\let\degree\relax % Remove definition of \degree
\usepackage{cite}
\usepackage{amsmath,amssymb,amsfonts}
\usepackage{subfigure}
\usepackage{graphicx}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{algpseudocode}
\usepackage{textcomp}
\usepackage{gensymb}
\let\degreesymb\degree % Store new \degree in \degreesymb
\let\degree\olddegree % Restore \degree to its old definition \olddegree
\usepackage{caption}
\usepackage[ruled,linesnumbered]{algorithm2e}
\newenvironment{program}[1][htb]
{\renewcommand{\algorithmcfname}{Program}% Update algorithm name
\begin{algorithm}[#1]%
}{\end{algorithm}}
\usepackage{commath}
\usepackage{fourier}
\usepackage{array}
\usepackage{makecell}
\usepackage{tikz} % this package is for tick marks
\def\checkmark{\tikz\fill[scale=0.4](0,.35) -- (.25,0) -- (1,.7) -- (.25,.15) -- cycle;}
\def\scalecheck{\resizebox{\widthof{\checkmark}*\ratio{\widthof{x}}{\widthof{\normalsize x}}}{!}{\checkmark}}% definition for bigger checkmark
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}% % check
\newcommand{\xmark}{\ding{55}}% % cross
%for fixed width table-->
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
%<-- for fixed width table array
\renewcommand\theadalign{bc}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}
\hyphenation{op-tical net-works semi-conduc-tor}
\usepackage{xr}
\usepackage{hyperref}
%\externaldocument{chapter1}
\title{Thesis title goes here}
\author{Somdip Dey} %your name
\college{School of Computer Science and Electronic Engineering} %your college
%\renewcommand{\submittedtext}{change the default text here if needed}
\degree{Doctor of Philosophy} %the degree
\degreedate{December, 2020} %the degree date
%end the preamble and start the document
\begin{document}
%this baselineskip gives sufficient line spacing for an examiner to easily
%markup the thesis with comments
\baselineskip=18pt plus1pt
%set the number of sectioning levels that get number and appear in the contents
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\maketitle % create a title page from the preamble info
%\include{dedication} % include a dedication.tex file % Commented by SOmdip Dey
%\include{acknowlegements} % include an acknowledgements.tex file % Commented by SOmdip Dey
\include{abstract} % include the abstract
\begin{romanpages} % start roman page numbering
\tableofcontents % generate and include a table of contents
\listoffigures % generate and include a list of figures
\end{romanpages} % end roman page numbering
%now include the files of latex for each of the chapters etc
\include{intro}
\include{background}
\include{prologue1}
\include{chapter1}
\include{prologue2}
\include{chapter2}
\include{prologue3}
\include{chapter3}
\include{chapter4}
%\include{conclusions}
%now enable appendix numbering format and include any appendices%Commented by SOmdip
%\appendix
%\include{appendix1}
%\include{appendix2}
%next line adds the Bibliography to the contents page
\addcontentsline{toc}{chapter}{Bibliography}
%uncomment next line to change bibliography name to references
%\renewcommand{\bibname}{References}
\bibliography{research} %use a bibtex bibliography file refs.bib
\bibliographystyle{plain} %use the plain bibliography style
\end{document}
当我尝试使用 TexStudio 构建 Latex 时出现以下错误:
文件、类型、行、错误
ociamthesismain.tex,错误,第 301 行,未定义控制序列。\removelatexerror
ociamthesismain.tex,错误,第 319 行,未定义控制序列。\removelatexerror
ociamthesismain.tex,错误,第 347 行,未定义控制序列。\removelatexerror
ociamthesismain.tex,错误,第 374 行,未定义控制序列。\removelatexerror
在TeXstudio的日志文件中,具体的错误如下:
[40] ! 未定义的控制序列。l.301 \removelatexerror 错误消息顶行末尾的控制序列从未被 \def'ed。如果您拼错了它(例如,
\hobx'), type
I' 和正确的拼写(例如,`I\hbox')。否则继续,我会忘记未定义的内容。
通常,当您双击错误时,它会将您带到文件中的错误。但是,对于上述错误,当我单击它时,它不会将我引导到确切的错误位置。此外,ociamthesismain.tex 文件没有那么多代码行,因此第 301、319、347、374 行中发生的错误并不在实际的 ociamthesismain.tex 文件中。此外,由于这些错误(我猜),参考书目也不会重新生成,并且在所有引用中仅显示 [?]。
因此,我的问题如下:
- 如何调试错误以找出问题发生的位置?
- 如何修复错误?
- 如何建立参考书目(我猜是在错误解决之后)?
答案1
我调试和解决问题所采取的步骤:
- 在显示行号的编辑器中打开主 tex 文件 (ociamthesismain.tex) 中的每个章节/tex 文件。由于 TeXstudio 不显示行号,因此我使用了 Atom 文本编辑器,因为它显示每个 .tex 文件中的行号。
- 转到发生错误的行号,如在 TeXstudio 中构建 tex 文件时 log/Log 文件中所示。对我来说,有错误的行号是:301、319、347、374。
- 尝试找出这些行号中的错误/不同之处并纠正错误。
对我来说,问题是,其中一章 (.tex) 主要复制自我发表的一篇文章,该文章使用了命令 \removelatexerror。但是,在这篇论文中,我不需要该命令来消除/抑制错误(如果有)。一旦我从上述行中删除 \removelatexerror 并进行编译,所有内容以及参考书目都可以正常构建。