输入和独立时编译/引用错误

输入和独立时编译/引用错误

我正在尝试将一个大型项目分成几个章节,并将所有章节包含在一个文件中,最后我可以编译该文件,使用该文件standalone.sty来剥离各个文件的序言。我处理单个章节,同时取消注释书目命令(见下文),一切正常。但是当我尝试编译时,main.tex我得到了

File ended while scanning use of \sa@gobble. \input{preamble}

在我的项目中,尽管出现错误,但实际上我得到了 PDF,但是所有参考资料都丢失了。

这是一个 MWE,它根本不会输出 PDF。

preamble.tex

\documentclass[a4paper,twoside,11pt]{article}

% BASIC FUNCTIONALITY

\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[utf8x]{inputenc} %try and remove if possible
\usepackage{accents}
\usepackage{mathtools}
\usepackage{amsthm}
\usepackage[english]{babel}
\usepackage{newpxtext}
\usepackage[euler-digits]{eulervm}


\DeclareFontFamily{U}{mathx}{\hyphenchar\font45}
\DeclareFontShape{U}{mathx}{m}{n}{
      <5> <6> <7> <8> <9> <10>
      <10.95> <12> <14.4> <17.28> <20.74> <24.88>
      mathx10
      }{}
\DeclareSymbolFont{mathx}{U}{mathx}{m}{n}
\DeclareFontSubstitution{U}{mathx}{m}{n}
\DeclareMathAccent{\widecheck}{0}{mathx}{"71}
\DeclareMathAccent{\wideparen}{0}{mathx}{"75}

\def\cs#1{\texttt{\char`\\#1}}




% PAGE FORMATTING

\usepackage{fullpage}
\usepackage{fancyhdr}



% FONTS AND TEXT FORMATTING

\usepackage[dvipsnames,svgnames,x11names,hyperref]{xcolor}
\usepackage{letltxmacro}
\usepackage{xparse}
\usepackage{relsize}
\usepackage{mathrsfs}
\usepackage[bbgreekl]{mathbbol}
\DeclareSymbolFontAlphabet{\mathbbm}{bbold}
\DeclareSymbolFontAlphabet{\mathbb}{AMSb}%
\usepackage{euscript} %to use this font type \EuScript{}, mathcal is left unchanged
\usepackage{mleftright}
\usepackage{dirtytalk}
\usepackage{scalerel} % T_{X_{t_{\scaleto{0}{3pt}}}}M
\usepackage{comment}
\usepackage{soul}
\usepackage{todonotes}
\setuptodonotes{linecolor=orange, backgroundcolor=white,
bordercolor=orange, textcolor=black, size=\tiny}
\setlength{\marginparwidth}{2cm}

\setul{0pt}{0.4pt} 

\AtBeginDocument{%
  \LetLtxMacro\autoreforig\autoref
  \RenewDocumentCommand{\autoref}{som}{%
    \IfValueT{#2}{[}%
    \IfBooleanTF{#1}{%
      \autoreforig*{#3}% 
    }{%
      \autoreforig{#3}%
    }%
    \IfValueT{#2}{,\space#2]}%
  }
}

%This is for matrix spacing
\makeatletter
\renewcommand*\env@matrix[1][\arraystretch]{%
  \edef\arraystretch{#1}%
  \hskip -\arraycolsep
  \let\@ifnextchar\new@ifnextchar
  \array{*\c@MaxMatrixCols c}}
\makeatother

% SYMBOLS

\usepackage{commath}
\usepackage{xfrac}
\usepackage{array}
\usepackage{enumitem}
\usepackage{stmaryrd}
\usepackage{tensor}
\usepackage{wasysym}

\newcommand\independent{\protect\mathpalette{\protect\independenT}{\perp}}
\def\independenT#1#2{\mathrel{\rlap{$#1#2$}\mkern2mu{#1#2}}}

\newcommand{\scriptbbtau}{\tau \mspace{-9mu} \tau}


\newcommand{\g}{\mathfrak{g}}
\newcommand{\h}{\mathfrak{h}}
\newcommand{\glap}{{^\g}\!\triangle}
\newcommand{\hlap}{{^\h}\!\triangle}
\newcommand{\gnabla}{{^\g}\nabla}
\newcommand{\hnabla}{{^\h}\nabla}
\usepackage[scr=boondoxo]{mathalfa}
\newcommand{\mathnew}[1]{\mathcal{#1}}
\newcommand{\trace}{\operatorname{tr}}
\newcommand{\ddif}{\mathbf{d}}
\newcommand{\edif}{\emph{\dif}}
\newcommand{\bbT}{\mathbb T}
\newcommand{\bbF}{\mathbb F}
\newcommand{\bftau}{\boldsymbol{\tau}}
\newcommand{\bfT}{\boldsymbol T}

\newcommand{\bbP}{\mathbb P}
\newcommand{\bbE}{\mathbb E}
\newcommand{\bbR}{\mathbb R}
\newcommand{\bbX}{\mathbb X}
\newcommand{\bbY}{\mathbb Y}
\usepackage[euler]{textgreek}
\newcommand{\td}{\text{\textdelta}}
\newcommand{\etd}{\emph{\textdelta}}
\newcommand{\bd}{\reflectbox{\text{d}}}
\newcommand{\Var}{\operatorname{\mathbb{V}ar}}
\newcommand{\Cov}{\operatorname{\mathbb{C}ov}}
\newcommand{\scrS}{\mathscr S}
\newcommand{\bddif}{\text{\reflectbox{$\ddif$}}}
\newcommand{\adif}{{\displaystyle{^{{\raisebox{1pt}{$\scriptstyle \mathscr{a}$}}}}\mspace{-7mu} \dif}}
\newcommand{\difb}{{\displaystyle{^{{\raisebox{1pt}{$\scriptstyle \mathscr{b}$}}}}\mspace{-7mu} \dif}}
\newcommand{\aedif}{{\displaystyle{^{{\raisebox{1pt}{$\scriptstyle \mathscr{a}$}}}}\mspace{-7mu} \emph{\dif}}}
\newcommand{\addif}{{\displaystyle{^{{\raisebox{1pt}{$\scriptstyle \mathscr{a}$}}}}\mspace{-7mu} \ddif}}
\newcommand{\ddifb}{{\displaystyle{^{{\raisebox{1pt}{$\scriptstyle \mathscr{b}$}}}}\mspace{-7mu} \ddif}}
\newcommand{\scra}{\mathscr a}
\newcommand{\scrg}{\mathscr g}
\newcommand{\scrb}{\mathscr b}
\newcommand{\calC}{\mathcal C}
\newcommand{\abbF}{{^\scra\!}\boldsymbol{F}}
\newcommand{\bbbF}{{^\scrb\!}\boldsymbol{F}}



\newcommand{\Xphi}{{^\varphi} \! X}
\newcommand{\Xpsi}{{^\psi} \! X}
\newcommand{\Xth}{{^\vartheta} \! X}
\newcommand{\HFi}{{^{\mathscr F}} \! H}
\newcommand{\HFiv}{{^{\mathscr F} _\text{v}} \! H}
\newcommand{\HFih}{{^{\mathscr F} _\text{h}} \! H}
\newcommand{\HT}{{^{\mathscr T}} \! H}
\newcommand{\HTv}{{^{\mathscr T} _\text{v}} \! H}
\newcommand{\HTh}{{^{\mathscr T} _\text{h}} \! H}


\newcommand{\bfH}{\boldsymbol{H}}
\newcommand{\bfK}{\boldsymbol{K}}
\newcommand{\oH}{\bfH}
\newcommand{\obH}{\overline{\boldsymbol H}}
\newcommand{\bfX}{\mathbf{X}}
\newcommand{\bfY}{\mathbf{Y}}
\newcommand{\bfZ}{\mathbf{Z}}
\newcommand{\gbfX}{{_\text{g} \! }\bfX}
\newcommand{\gbfY}{{_\text{g} \! }\bfY}
\newcommand{\gbbX}{{_\text{g} \! }\mathbb{X}}
\newcommand{\gbbY}{{_\text{g} \! }\mathbb{Y}}

\newcommand{\bfXla}{{^\lambda \!}\mathbf{X}}
\newcommand{\bfXnu}{{^\nu \!}\mathbf{X}}
\newcommand{\bfXmu}{{^\mu \!}\mathbf{X}}

\newcommand{\uX}{\bfX}
\newcommand{\uY}{\bfY}

\newcommand{\Ptr}{/\hspace{-2.5pt}/}
\newcommand{\Aptr}{\setminus\hspace{-2.5pt}\setminus}
\newcommand{\Dev}{\text{\setul{2.35pt}{0.45pt}\ul{$\bigcirc$}}}
\newcommand{\Adev}{\text{\setul{-8.275pt}{0.45pt}\ul{$\bigcirc$}}}


\newcommand{\ptr}[4]{\Ptr^{#2}_{#3} \hspace{-1.5pt}(#1)_{#4}}
\newcommand{\aptr}[4]{{\Aptr^{#2}_{#3}} \hspace{-1.5pt}(#1)_{#4}}
\newcommand{\dev}[4]{\Dev^{#2}_{#3} \hspace{-1.5pt}(#1)_{#4}}
\newcommand{\adev}[4]{\Adev^{#2}_{#3} \hspace{-1.5pt}(#1)_{#4}}


\newsavebox{\overlongequation}
\newenvironment{longequation}
 {\\ \begin{equation*} \begin{lrbox}{\overlongequation}$\displaystyle}
 {$\end{lrbox}\makebox[0pt]{\usebox{\overlongequation}} \end{equation*} \\ }


\usepackage{graphicx}
\makeatletter
\newcommand*\bigcdot{\mathpalette\bigcdot@{.5}}
\newcommand*\bigcdot@[2]{\mathbin{\vcenter{\hbox{\scalebox{#2}{$\m@th#1\bullet$}}}}}
\makeatother
\newcommand{\bcd}{{\bigcdot}}

\newenvironment{talign}
 {\let\displaystyle\textstyle\align}
 {\endalign}
\newenvironment{talign*}
 {\let\displaystyle\textstyle\csname align*\endcsname}
 {\endalign}

% GRAPHICS

\usepackage{tikz}
\usepackage{graphicx}
\usepackage{wrapfig}
\usepackage{caption}
\usepackage[percent]{overpic}
\usepackage{tikz-cd}


% REFERENCING

\usepackage{aliascnt}
\usepackage[pdftex, ocgcolorlinks, colorlinks = true,
linkcolor = ProcessBlue,
citecolor = LimeGreen,
urlcolor = WildStrawberry
]{hyperref}

\numberwithin{equation}{section}

%\newcommand{\ppageref}[1]{\hyperref[#1]{Page \pageref*{#1}}
%FOR SOME STRANGE REASON THIS MESSES UP THE PAGE-CODE SYNCING... SO WE WILL USE \pageref FOR NOW AND THEN DO A GLOBAL SEARCH AND REPLACE

\addto\extrasenglish{
  \renewcommand{\chapterautorefname}{Chapter}
} % This makes Chapter appear with a capital when referenced

\addto\extrasenglish{
  \renewcommand{\sectionautorefname}{Section}
} % This makes Section appear with a capital when referenced

\usepackage[refpage, intoc]{nomencl}
\def\pagedeclaration#1{\hyperlink{page.#1}{page\nobreakspace#1}}
\makenomenclature




% THEOREMING

% Declare theorem-style environments with \mynewtheorem to maintain just one
% counter for numbering, and make them work with \autoref.
\newtheorem{dummy}{***}[section]
% add [section] for numbering within sections
\newcommand{\mynewtheorem}[2]{
  \newaliascnt{#1}{dummy}
  \newtheorem{#1}[#1]{#2}
  \aliascntresetthe{#1}
  % maybe we will squish some autoref defaults, but who cares?
  \expandafter\def\csname #1autorefname\endcsname{#2}
}

\theoremstyle{plain}
  \mynewtheorem{thm}{Theorem}
  \mynewtheorem{thmdef}{Theorem/Definition}
  \mynewtheorem{prop}{Proposition}
  \mynewtheorem{cor}{Corollary}
  \mynewtheorem{lem}{Lemma}
  \mynewtheorem{conj}{Conjecture}
\theoremstyle{definition}
  \mynewtheorem{defn}{Definition}
  \mynewtheorem{expl}{Example}
  \mynewtheorem{prob}{Problem}
  \mynewtheorem{ques}{Question}
  \mynewtheorem{cond}{Condition}
  \mynewtheorem{conv}{Convention}
  \mynewtheorem{defthm}{Definition/Theorem}
\theoremstyle{remark}
  \mynewtheorem{rem}{Remark}

% COMMANDS

% instead of \defeq and \eqdef use \coloneqq and \eqqcolon (contained in mathtools)

\renewcommand{\dif}{\text{d}}
\newcommand{\diff}[2][{}]{\frac{\dif #1}{\dif #2 }}

\renewcommand{\qedsymbol}{$\blacksquare$}
\renewcommand{\qed}{\leavevmode\unskip\nobreak\quad\qedsymbol}

\let\amsamp=& % use \amsamp instead of & (e.g. in matrices) inside tikz-cd environment

\mathchardef\mhyphen="2D

\binoppenalty=10000
\relpenalty=10000
\sloppy


% Creates colored box with \cfbox{color}
\newcommand{\cfbox}[2]{%
    \colorlet{currentcolor}{.}%
    {\color{#1}%
    \fbox{\color{currentcolor}#2}}%
}


% The following are macros for parentheses which adjust to size

\mleftright


\newcommand{\T}{\left(}
\newcommand{\TT}{\right)}
\newcommand{\tonde}[1]{\T#1\TT}

\newcommand{\Q}{\left[}
\newcommand{\QQ}{\right]}
\newcommand{\quadre}[1]{\Q#1\QQ}

\newcommand{\G}{\left\{}
\newcommand{\GG}{\right\}}
\newcommand{\graffe}[1]{\G#1\GG}

\newcommand{\A}{\left\lvert}
\renewcommand{\AA}{\right\rvert} %overrides command about accents, watch out!
\newcommand{\assoluto}[1]{\A#1\AA}


\newcommand{\D}{\left\langle}
\newcommand{\DD}{\right\rangle}
\newcommand{\duale}[1]{\D#1\DD}

% TITLE

\title{My title}
\author{My name}
\date{\today}

Ch1.tex

\input{preamble}

\begin{document}
This is chapter 1, and here is another reference \cite{FH14}.

%\bibliographystyle{alpha} \addcontentsline{toc}{section}{References}
%\bibliography{mainRefs}

\end{document}

Ch2.tex

\input{preamble}

\begin{document}
This is chapter 2, and here is another reference \cite{FV10}.

%\bibliographystyle{alpha} \addcontentsline{toc}{section}{References}
%\bibliography{mainRefs}

\end{document}

mainRefs.bib

@book {FH14,
    AUTHOR = {Friz, Peter K. and Hairer, Martin},
     TITLE = {A course on rough paths},
    SERIES = {Universitext},
      NOTE = {With an introduction to regularity structures},
 PUBLISHER = {Springer, Cham},
      YEAR = {2014},
     PAGES = {xiv+251},
      ISBN = {978-3-319-08331-5; 978-3-319-08332-2},
   MRCLASS = {60-02 (34F05 35R60 60H07 60H10 60H15)},
  MRNUMBER = {3289027},
MRREVIEWER = {Fabrice Baudoin},
       URL = {https://doi.org/10.1007/978-3-319-08332-2},
}

@book {FV10,
    AUTHOR = {Friz, Peter K. and Victoir, Nicolas B.},
     TITLE = {Multidimensional stochastic processes as rough paths},
    SERIES = {Cambridge Studies in Advanced Mathematics},
    VOLUME = {120},
      NOTE = {Theory and applications},
 PUBLISHER = {Cambridge University Press, Cambridge},
      YEAR = {2010},
     PAGES = {xiv+656},
      ISBN = {978-0-521-87607-0},
   MRCLASS = {60-02 (34F05 46N30 60F10 60G17 60H07 60H10 60H30)},
  MRNUMBER = {2604669},
MRREVIEWER = {Ren\'{e} L. Schilling},
       DOI = {10.1017/CBO9780511845079},
       URL = {https://doi.org/10.1017/CBO9780511845079},
}

main.tex

\input{preamble}
\usepackage{standalone}


\begin{document}

\maketitle

\input{Ch1}
\input{Ch2}

\bibliographystyle{alpha} \addcontentsline{toc}{section}{References}
\bibliography{mainRefs}

\end{document}

我尝试用谷歌搜索错误并进行调试,但无法找到问题所在,如果能提供任何帮助我将不胜感激。谢谢。

相关内容