在 %包括章节时使用主文件中的部分时出现问题

在 %包括章节时使用主文件中的部分时出现问题

我在 Windows 机器上使用 MikTex 和 WinEdt。

我正在写一本书,现在我已经将其结构化为章节、节等。我想添加部分。这是我的主文件

    \documentclass[12pt,reqno]{book}      % Sets 12pt font, equation numbers on right
\usepackage{amsmath,amssymb,amsfonts} % Typical maths resource packages
\usepackage{graphics}                 % Packages to allow inclusion of graphics
\usepackage{color}                    % For creating coloured text and background

\usepackage{listings}
\usepackage[english]{SASnRdisplay}

\lstloadlanguages{SAS, R}

\lstdefinestyle{base}{
  language=SAS,
  %emptylines=1,
  %breaklines=true,
  %basicstyle=\ttfamily\color{black},
  moredelim=**[is][\color{red}]{@}{@},
}


\lstset{emph={%
    PROC, QUANTREG, proc, quantreg, data,class,model% add SAS keywords here
    },emphstyle={\bfseries}%
}%

\usepackage[colorlinks,citecolor=blue,linkcolor=blue]{hyperref}                 % For creating hyperlinks in cross references. It should be after the color package. The option colorlinks produces colored entries without boxes. The option citecolor=blue changes the default green citations to blue.

\usepackage{fancyvrb}%Verbatim
\usepackage[acronym]{glossaries}
\usepackage{natbib}
\usepackage{latexsym}
\usepackage[dvipdf]{graphicx}
\usepackage{mathptmx}
\usepackage{alltt}
\usepackage{float}
\usepackage[toc,page]{appendix}

\usepackage{fancyhdr}
\usepackage[final]{showlabels}
\usepackage{comment}


\DeclareGraphicsExtensions{.png}
\parindent 1cm
\parskip 0.2cm
\topmargin 0.2cm
\oddsidemargin 1cm
\evensidemargin  0.5cm
\textwidth 15cm %12cm %use 15 in final
\textheight 21cm
\newtheorem{theorem}{Theorem}[section]
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{definition}[theorem]{Definition}


\def\R{\mathbb{ R}}
\def\S{\mathbb{ S}}
\def\I{\mathbb{ I}}
\makeindex

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LE,LO]{Chapter \thechapter}
\fancyhead[RE,RO]{\thesection}
\fancyfoot[CE,CO]{\thepage}

\pagestyle{headings}

\title{The General Linear Model: Assumptions, violations and remedies or What to do when your dependent variable won't behave}
\author{\htmladdnormallink           % Puts a hyperlink on to the author's name
{Peter Flom}{http://www.statisticalanalysisconsulting.com}\\
{\small\em \copyright 2019 }}

 \date{ }


\makeglossaries
\loadglsentries{glossary.tex}


\begin{document}
\maketitle
 \addcontentsline{toc}{chapter}{Contents}
%\pagenumbering{roman}
\frontmatter
        \input{titlepage}% that contains    \begin{titlepage}...\end{titlepage}  THIS ISN'T WORKING RIGHTT
        %\input{copyright}% that contains copyright, ISBN, etc.
     %   \input{dedication}% saying "this book is created for my parents..."
     %   \input{author}% about the author
        \tableofcontents
       \listoffigures
        \listoftables
         %\listoflistings
        \include{Preface}
\mainmatter

% Do not put an {\tt end{document}} command at the end of chapter files;
% just one such command is needed at the end of the book.

% I AM NOT SURE ABOUT THE PART STRUCTURE
%\part{Introductory material}
   \include{Intro}
   \include{General_thoughts} %on modeling
%\part{Problems with independent variables
   \include{Outliers} %and influential points
   \include{Collinearity}
%\part{Problems with dependent variables
   \include{BetaReg}
  \include{Dependent_errors}
%\part{Nonlinear relationships}
    \include{Nonlinear_relationships}  %Break this into several chapters

  \include{Nonnormal_errors} %quantile regression
  \include{Measurement_Error}
 \include{Summary}
   \begin{appendices}
   %\include{app1} %ANOVA is linear reggression
   %\include{app2} %Matrix notation
   \end{appendices}


%\clearpage
%\pagestyle{headings}
\backmatter
   \printglossary[type=\acronymtype]
   \printglossary
   \bibliographystyle{plainnat}
   \bibliography{c:/writing/references}


%\begin{thebibliography}{99}
%\end{thebibliography}

%\include{index}
 \addcontentsline{toc}{chapter}{Index}
\end{document}

这很好。但是,当我取消注释 \part 命令时,结果完全相同。我是否需要 \include 部分,然后在部分中包含章节?这会破坏 \include 的很多实用性。

答案1

编译您的示例(注释掉我没有的文件的引用),我收到错误:

Runaway argument?
{Problems with independent variables \chapter {Outliers} \chapter {Co\ETC.
! File ended while scanning use of \@xdblarg.
<inserted text> 
                \par 

在您的示例中搜索“独立变量的问题”表明您已经关闭了\part{Problems with independent variables该论证,但并未关闭该论证(因此称为“失控论证”)。此外,下一个\part命令未关闭。

相关内容