结合进口

结合进口

以下程序出错,也就是说它无法运行。我还没找到问题所在。如果你能找到问题所在或者运行以下程序,请在这里写出新的程序。谢谢。

\documentclass[twosided]{combine} 

\usepackage{fancyhdr}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}

%%%%%Head and Foot%%%%%
\pagestyle{fancy}
\fancyhead[L]{}
\fancyhead[C]{The preview}
\fancyhead[R]{}
\fancyfoot[L]{PREVIEW}
\fancyfoot[R]{City}
\fancyfoot[C]{\thepage}
%%%%%%%%%%

\begin{document}
\title{Abtract}
\author{PREVIEW}
\maketitle
\tableofcontents
\newpage
\section{chap1}
\begin{papers}
\import{article}
\end{papers}
\end{document}

文章内容如下:

%%%%%article%%%%%
\documentclass {article}
\begin{document}

\date{}
\title{Article}
\author{The author}
\maketitle

\begin{abstract}
$A$=$B$ and \cite{1}.
\end{abstract}

\begin{thebibliography}{9}
\bibitem{1} The author, \textit{Article}, Journal (2018), 1-5.
\end{thebibliography}
\end{document}
%%%%%%

> %%%%%%%%%%%DOC.log%%%%%%%%%%%%%%%% This is pdfTeX, Version
> 3.14159265-2.6-1.40.17 (MiKTeX 2.9.6210 64-bit) (preloaded format=pdflatex 2018.10.16)  17 OCT 2018 16:39 entering extended mode
> **./Doc.tex (Doc.tex LaTeX2e <2017/01/01> patch level 1 Babel <3.9r> and hyphenation patterns for 75 language(s) loaded. ("C:\Program
> Files\MiKTeX 2.9\tex\latex\combine\combine.cls" Document Class:
> combine 2010/07/10 v0.7a collection of documents  ("C:\Program
> Files\MiKTeX 2.9\tex\latex\graphics\keyval.sty" Package: keyval
> 2014/10/28 v1.15 key=value parser (DPC) \KV@toks@=\toks14 )
> ("C:\Program Files\MiKTeX 2.9\tex\latex\base\article.cls" Document
> Class: article 2014/09/29 v1.4h Standard LaTeX document class
> ("C:\Program Files\MiKTeX 2.9\tex\latex\base\size10.clo" File:
> size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option) )
> \c@part=\count79 \c@section=\count80 \c@subsection=\count81
> \c@subsubsection=\count82 \c@paragraph=\count83
> \c@subparagraph=\count84 \c@figure=\count85 \c@table=\count86
> \abovecaptionskip=\skip41 \belowcaptionskip=\skip42
> \bibindent=\dimen102 ) \c@colpage=\count87 \c@c@lctr=\count88
> \c@ltocfnum=\write3 \c@lloffnum=\write4 \c@llotfnum=\write5
> \c@bodytitle=\count89 \toctitleindent=\skip43 \tocauthorindent=\skip44
> \tocpubindent=\skip45 \toctocindent=\skip46 ) ("C:\Program
> Files\MiKTeX 2.9\tex\latex\fancyhdr\fancyhdr.sty" Package: fancyhdr
> 2017/06/30 v3.9a Extensive control of page headers and footer s
> \f@nch@headwidth=\skip47 \f@nch@O@elh=\skip48 \f@nch@O@erh=\skip49
> \f@nch@O@olh=\skip50 \f@nch@O@orh=\skip51 \f@nch@O@elf=\skip52
> \f@nch@O@erf=\skip53 \f@nch@O@olf=\skip54 \f@nch@O@orf=\skip55 )
> ("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\amsfonts.sty"
> Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
> \@emptytoks=\toks15 \symAMSa=\mathgroup4 \symAMSb=\mathgroup5 LaTeX
> Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'
> (Font)                  U/euf/m/n --> U/euf/b/n on input line 106. )
> ("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsmath.sty" Package:
> amsmath 2016/11/05 v2.16a AMS math features \@mathmargin=\skip56
> 
> For additional information on amsmath, use the `?' option.
> ("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amstext.sty" Package:
> amstext 2000/06/29 v2.01 AMS text
> 
> ("C:\Program Files\MiKTeX 2.9\tex\latex\amsmath\amsgen.sty" File:
> amsgen.sty 1999/11/30 v2.0 generic functions \@emptytoks=\toks16
> \ex@=\dimen103 )) ("C:\Program Files\MiKTeX
> 2.9\tex\latex\amsmath\amsbsy.sty" Package: amsbsy 1999/11/29 v1.2d Bold Symbols \pmbraise@=\dimen104 ) ("C:\Program Files\MiKTeX
> 2.9\tex\latex\amsmath\amsopn.sty" Package: amsopn 2016/03/08 v2.02 operator names ) \inf@bad=\count90 LaTeX Info: Redefining \frac on
> input line 213. \uproot@=\count91 \leftroot@=\count92 LaTeX Info:
> Redefining \overline on input line 375. \classnum@=\count93
> \DOTSCASE@=\count94 LaTeX Info: Redefining \ldots on input line 472.
> LaTeX Info: Redefining \dots on input line 475. LaTeX Info: Redefining
> \cdots on input line 596. \Mathstrutbox@=\box26 \strutbox@=\box27
> \big@size=\dimen105 LaTeX Font Info:    Redeclaring font encoding OML
> on input line 712. LaTeX Font Info:    Redeclaring font encoding OMS
> on input line 713. \macc@depth=\count95 \c@MaxMatrixCols=\count96
> \dotsspace@=\muskip10 \c@parentequation=\count97 \dspbrk@lvl=\count98
> \tag@help=\toks17 \row@=\count99 \column@=\count100
> \maxfields@=\count101 \andhelp@=\toks18 \eqnshift@=\dimen106
> \alignsep@=\dimen107 \tagshift@=\dimen108 \tagwidth@=\dimen109
> \totwidth@=\dimen110 \lineht@=\dimen111 \@envbody=\toks19
> \multlinegap=\skip57 \multlinetaggap=\skip58
> \mathdisplay@stack=\toks20 LaTeX Info: Redefining \[ on input line
> 2817. LaTeX Info: Redefining \] on input line 2818. ) ("C:\Program Files\MiKTeX 2.9\tex\latex\amsfonts\amssymb.sty" Package: amssymb
> 2013/01/14 v3.01 AMS font symbols )
> 
> LaTeX Warning: Unused global option(s):
>     [twosided].
> 
> (Doc.aux) \openout1 = `Doc.aux'.
> 
> LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line
> 20. LaTeX Font Info:    ... okay on input line 20. LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 20. LaTeX Font Info:   
> ... okay o

答案1

正如其名称所示,“组合函数”将文件合并在一起,因此只有一个主 \begin{document} 和 \end{document},并且当命令错误处理包含文件中的其他文件时,它似乎会出错。我在 mwe 导入文件中注释掉了这些文件,TeXworks 编译了一个 .pdf,但正如 Ian Thompson 指出的那样,这与软件包文档相矛盾,文档中写道

“命令 \import{ <texfile>} 是 \input 和 \include 命令的结合,只能在论文环境中使用。<texfile>是没有 .tex 扩展名的 LATEX 文件的名称。例如,\import{fred} 将尝试读取名为 fred.tex 的文件。<texfile>应该是从 \documentclass 到 \end{document} 的完整 LATEX 文件”

因此看起来必须满足其他先决条件才能适合这个方案。

这个花哨的标题似乎是问题的根源,当注释掉它时,包含的文件再次被接受并编译为 .pdf,但并不像预期的那样。在搜索该组合以查找常见问题时,我们得到了 David Carlisle 在由 fancyheader 破坏的合并

    \documentclass[twosided]{combine} 

\usepackage{fancyhdr}
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}

%%%%%Head and Foot%%%%%
\pagestyle{fancy}
\fancyhead[L]{}
\fancyhead[C]{The preview}
\fancyhead[R]{}
\fancyfoot[L]{PREVIEW}
\fancyfoot[R]{City}
\fancyfoot[C]{\thepage}
%%%%%%%%%%

\begin{document}
\title{Abtract}
\author{PREVIEW}
\maketitle
\tableofcontents
\newpage
\section{chap1}
\begin{papers}

% solution as recommended by David Carlisle
\makeatletter\let\@makecol\latex@makecol\makeatother

\import{article}
\end{papers}
\end{document}

答案2

如果您想手动写入参考文献,则应写入 \input{article} 而不是 \import{article}。使用“input”时,主文档中的参考文献将看起来像 [?]。此外,在文档中使用 \input 时,应删除 \begin{document} 和 \end{document}。使用 \input 时,我们会遇到另一个问题。这个问题是无法自动写入参考文献。正如 @sigur 所说,当文档中使用的某些包更新时,这个问题可能会解决,但我不知道应该更新哪些包。

相关内容