我的主 .tex 文件不断收到此错误消息。内容如下:
缺少}.\subfield{2chaptertwo.tex}。
我为每一章都准备了一个单独的 .tex 文件(包括一个名为2chaptertwo.tex
.
这是主 tex 文件的代码。
%DOCUMENT SET UP
\documentclass[11pt,oneside]{book}
\usepackage[margin=1.5in]{geometry}
\setlength\parindent{32pt}
%FONT
\usepackage[english]{babel}
\usepackage[osf, sc]{mathpazo}
\usepackage[T1]{fontenc}
\usepackage{CJKutf8} % Chinese
%GRAPHICS
\usepackage{graphicx}
%MATH PACKAGES
\usepackage{amsthm, amsmath, amsfonts, mathtools, amssymb}
\usepackage{sgame, tikz}
\usetikzlibrary{trees, calc}
%DUMMY TEXT
\usepackage{lipsum}
%FOOTNOTE FORMATTING
\usepackage[hang]{footmisc}
\setlength{\footnotemargin}{4mm}
%SUBFILES
\usepackage{subfiles}
%SPACING
\usepackage[]{setspace}
%QUOTES
\usepackage{etoolbox}
\AtBeginEnvironment{quote}{\singlespacing\small}
%REFERENCE FORMATTING
\usepackage{hyperref}
\usepackage{xcolor}
\definecolor{bleudefrance}{rgb}{0.19, 0.55, 0.91}
\definecolor{blue}{rgb}{0.21, 0.37, 0.23}
\hypersetup{
colorlinks,
linkcolor=bleudefrance,
urlcolor=blue,
citecolor=huntergreen}
%BIBLIOGRAPHY
%Currently set to APA style
\usepackage[nosectionbib]{apacite}
\usepackage[nottoc,notbib]{tocbibind}
%TABLE OF CONTENTS FORMATTING
\usepackage[titles]{tocloft}
\renewcommand{\cftchapfont}{\normalfont\scshape}
\renewcommand{\cftchappagefont}{\normalfont}
\usepackage{csquotes}
%CHAPTER, SECTION, AND SUBSECTION TITLES
\usepackage{titlesec}
\titleformat{\chapter}{\scshape}{\chaptertitlename}{0pt}{\vskip 0pt}
\titlespacing{\chapter}{0pt}{0pt}{0pt}
\titleformat{\section}
{\scshape}{\thesection}{1em}{}
\renewcommand\thesection{\arabic{section}}
\titleformat{\subsection}
{\normalfont}{\thesection .\thesubsection{}}{1em}{}
\renewcommand\thesubsection{\arabic{subsection}}
\titleformat{\subsubsection}
{\normalfont}{\thesection ..\thesubsection{}}{1em}{}
\renewcommand\thesubsubsection{\arabic{subsubsection}}
%HEADERS
%Change headers based on section titles
\usepackage{fancyhdr}
\setlength{\headheight}{12.6pt}
\renewcommand{\headrulewidth}{0pt}
\fancypagestyle{chapterone}{
\rhead{\sc\small{Chapter One} \big| \thepage}
\lhead{}
\cfoot{}
}
\fancypagestyle{chaptertwo}{
\rhead{\sc\small{Chapter Two} \big| \thepage}
\lhead{}
\cfoot{}
}
\fancypagestyle{chapterthree}{
\rhead{\sc\small{Chapter Three} \big| \thepage}
\lhead{}
\cfoot{}
}
\fancypagestyle{conclusion}{
\rhead{\sc\small{Conclusion} \big| \thepage}
\lhead{}
\cfoot{}
}
\fancypagestyle{references}{
\rhead{\sc\small{References} \big| \thepage}
\lhead{}
\cfoot{}
}
%------------------------------
\begin{document}
%TITLE PAGE
\subfile{0title.tex}
\thispagestyle{empty}
%COPYRIGHT PAGE
\newpage
\subfile{0copyright.tex}
\thispagestyle{empty}
%DEDICATION AND ACKNOWLEDGEMENTS
\newpage
\pagestyle{plain}
\pagenumbering{roman}
\setcounter{page}{2}
\subfile{0dedicationacknowledgments.tex}
%ABSTRACT
\newpage
\subfile{0abstract.tex}
%TABLE OF CONTENTS
\newpage
\subfile{0tableofcontents.tex}
\clearpage
\pagenumbering{arabic}
%CHAPTER ONE
\newpage
\pagestyle{chapterone}
\setcounter{section}{0}
\subfile{1chapterone.tex}
\singlespacing
\clearpage
%CHAPTER TWO
\newpage
\pagestyle{chaptertwo}
\setcounter{section}{0}
\subfile{2chaptertwo.tex}
\clearpage
%CHAPTER 3
\newpage
\pagestyle{chapterthree}
\setcounter{section}{0}
\subfile{3chapterthree.tex}
\clearpage
%REFERENCES
\newpage
\pagestyle{references}
\singlespacing
\bibliographystyle{apacite}
\bibliography{dissertation.bib}
\nocite{*}
\end{document}
答案1
此错误可能非常烦人。对我来说,实际上有一个额外的 { 不知何故潜入了子文件中。奇怪的是,子文件在单独编译时没有任何错误。错误仅在编译主文件时发生。我通过剪切子文件的全部内容并一次粘贴一个段落,保存子文件并编译主文件来确定问题。在此迭代过程中,段落中出现了错误。我通过逐行注释掉该段落的行并编译主文件来确定缺少的 {。希望这能有所帮助。