我正在写一篇论文。我想将各章作为单独的文件,编译成一个大文件 (TotalCompile.tex)。我的主要文件如下所示:
\documentclass[12pt,openright, twoside]{report}
\usepackage[subpreambles=true]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{import}
\usepackage{fullpage}
\usepackage{fancyhdr}
\setlength{\headsep}{15mm}
\usepackage{natbib}
\pagenumbering{gobble}% Remove page numbers (and reset to 1)
\title{A Physical and Numerical Study of an Interconnected Wave Energy Array}
\author{Ben Howey}
\date{\today}
\begin{document}
\maketitle
\newpage
\chapter{Literature Review}
\pagenumbering{arabic}% Arabic page numbers (and reset to 1)
\import{Literature_Review_Dir/}{Litterature_Review.tex}
\end{document}
我的 Literature_Review.tex 如下所示:
\documentclass[float=false, crop=false]{standalone}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}
\usepackage{fullpage}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{natbib}
\bibliographystyle{unsrtnat}
\begin{document}
This section will review will give a broad overview of the potential resource and why wave energy is a commodity worthy of focused research \cite{greg10}
\bibliography{LitReviewBib}
\end{document}
文档编译成功,但显示所有引用均未定义!我想在主文档中每章末尾添加参考书目,并能够单独编译包含所有引用的每章。该怎么做?
\bibliography{LitReviewBib}
编辑:感谢 @marmot 和 @Mico 的回复。我已将忘记放入上述示例中的行添加到文献综述文档中!文献综述与所有参考文献都编译良好。但 Total Compile 却不行!我收到以下错误:
! LaTeX Error: \NAT@idxtxt undefined.See the LaTeX manual or LaTeX Companion for explanation.Type H for immediate help.... \AtBeginDocument{\NAT@set@cites}
和
! LaTeX Error: Command \NAT@idxtxt already defined.Or name \end... illegal, see p.192 of the manual.See the LaTeX manual or LaTeX Companion for explanation.Type H for immediate help.... ...AT@spacechar\NAT@open\NAT@date\NAT@close}
答案1
! LaTeX Error: \NAT@idxtxt undefined.
如果主文档中缺少,则会出现错误\usepackage{natbib}
。然后独立程序会尝试加载它\AtBeginDocument
,但这不适用于 natbib。
因此添加
\usepackage{natbib}
也始终位于主文件的前言部分。