当包含单独的部分文件时,编译主 .tex 文件时出错

当包含单独的部分文件时,编译主 .tex 文件时出错

我想使用这个 LaTeX模板撰写论文。我下载了文件并尝试在新机器上使用 Texstudio(带有 MikTex 发行版)运行它,而不修改从网站上获得的原始文件中的任何内容。然而,主要.tex文件编译失败,我收到的错误消息是“pdflatex.exe 没有成功“。

主 .tex 文件包含几个单独编写的部分.tex文件,如以下代码片段所示:

\documentclass[english,singlespacedlisttitles]{umalayathesis}
\usepackage{lipsum}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{graphicx}
\usepackage[dvipsnames,x11names,rgb]{xcolor}


% Useful for including code listings
\usepackage{listings}
\lstset{language=[LaTeX]TeX,columns=fullflexible,
        basicstyle=\ttfamily\SingleSpacing,
        texcsstyle=*\bfseries\color{NavyBlue},
        commentstyle=\itshape\color{PaleVioletRed4},
        frame=single,framesep=6pt,
        framexleftmargin=6pt,framexrightmargin=6pt,
        xleftmargin=12pt,xrightmargin=12pt,
        breaklines=true,breakatwhitespace=true,
%        aboveskip=-1.5\onelineskip
}

\title{The umalayathesis \LaTeX{} Document Class}

\begin{document}

\input{umalayathesis-howtouse}
\input{sample-chap-intro}
\input{sample-chap-dummy}

\end{document}

我认为问题出在\输入{...}目前主要.tex文件。我注释掉以下几行:

%\input{umalayathesis-howtouse}
%\input{sample-chap-intro}
\input{sample-chap-dummy}

主要的.tex文件已成功编译,没有任何错误。

请注意子文件示例-chap-dummy.tex写法如下:

%!TEX ROOT = thesis.tex
\chapter{Dummy Chapter}

Hello!!\index{furball}

\begin{figure}[hbt!]
\centering Test 3
\caption{Let's see. What have we got here?}
\end{figure}

但是,当我尝试在上面的子文件中插入一些内联公式($...$)时,主文件再次编译失败,例如:

%!TEX ROOT = thesis.tex
\chapter{Dummy Chapter}

Hello!!\index{furball}

\begin{figure}[hbt!]
\centering Test 3
\caption{Let's see. What have we got here?}
\end{figure}

%The main file fails to compile when I added the following line:
$a=bc$

我相信主要问题出在我当前的机器上,因为我在旧机器上编译文件没有任何问题。

在我当前的机器上,我可以毫无问题地编译大多数 .tex 文件,除非主 .tex 文件包含一些在单独的 tex 文件中编写的部分。希望有人能帮助我!非常感谢您的帮助!

相关内容