# import citations into large document

I am writing a thesis. I want to have chapters as separate files that are compiled into one large (TotalCompile.tex) document. My main file looks like:

\documentclass[12pt,openright, twoside]{report}
\usepackage[subpreambles=true]{standalone}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{import}
\usepackage{fullpage}
\usepackage{fancyhdr}
\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}


My Literature_Review.tex looks like this:

\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}


The document compiles but it says that all of the citations are undefined! I want to include a bibliography at the end of each chapter in my main document and be able to separately compile each chapter including all citations. How can this be done?

EDIT: Thanks for your replies @marmot and @Mico. I have added the \bibliography{LitReviewBib} line to the literature review document that I forgot to put into the example above! The literature review compiles fine with all refs. The Total Compile does not! I get the following error:

! LaTeX Error: \NAT@idxtxt undefined.See the LaTeX manual or LaTeX
Companion for explanation.Type H for immediate help....
\AtBeginDocument{\NAT@set@cites}


and

! 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}

• Welcome to TeX.SE. Did you run BibTeX, followed by two more LaTeX runs? – Mico May 21 '18 at 14:44
• @marmot - I'd say that \bibliographystyle{unsrtnat} is a dead give-away. :-) The fact that the natbib package is loaded also pretty much also allows only one kind of conclusion. You're right, though, that the absence of a \bibliography command is going to be fatal to the effort to create a bibliography. – Mico May 21 '18 at 15:34
• @Mico Yup, that's probably the reason that there are no references in. So the OP needs to do both, add an appropriate \bibliography command, and follow your instructions on the bibtex and latex runs. – user121799 May 21 '18 at 15:38

You get the error ! LaTeX Error: \NAT@idxtxt undefined. if \usepackage{natbib} is missing from the main document. standalone then tries to load it with \AtBeginDocument and this doesn't work with natbib.
 \usepackage{natbib}