# Reference list from separate documents in the order of appearance

I'm facing a complex problem. I have 2 separate documents, a main text and a table, both with several citations. I would like to have a bibliography section at the end of the main document containing citations from both the main text and the table. Furthermore the order of references should be in the order of appearance in the two documents in the following manner: First, citations in the main text until the table. When I refer to the table in the main text (eg saying "Table shows") references should come from citations in the table, and when the table is finished, the references should come again from the main text from the point where the main text was left previously (that is from after "Table shows"). Is this feasible using latex and bibtex?

Here is a MWE.

The main document's code:

\documentclass{article}
\begin{document}
Some text. \cite{Lamport1994} See table 1 citation. More text. \cite{Goossens1994}
\bibliographystyle{unsrt}
\bibliography{sample}
\end{document}


Table document code:

\documentclass{article}
\begin{document}
\begin{tabular}{|c|c|}
\hline
Table text. \cite{Knuth1984} & \\
\hline
\end{tabular}
\end{document}


And an example bib file:

@BOOK{Knuth1984,
title = {The \TeX book},
year = {1984},
author = {Knuth, Donald E},
}

@BOOK{Lamport1994,
title = {\LaTeXe , the Macro Package for \TeX },
year = {1994},
author = {Lamport, Leslie},
}

@BOOK{Goossens1994,
title = {The \LaTeX{} Companion},
year = {1994},
author = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
}


Of course, the table file won't compile as there is no \bibliography defined in it.

What I would like to get: the main document with citations and references formatted and in the order:

Lamport1994

Knuth1984

Goossens1994

I hope I made it clear.

Submitting separate main document, table and figure files is a requirement for many journals.

• From what you say the usual unsrt style would probably do this. Can you post some small sample code of you set-up. – Andrew Swann Feb 4 '14 at 10:43
• @Andrew Swann I have added an example – bcsikos Apr 29 '14 at 16:09

This sounds like a good job for the xcite package. Suppose you use \nocite{Knuth1984} in your main document, then you can "enable" this citation in the tabular document by using \usepackage{xcite} \externalcitedocument{<name of main document>}.

Full MWE:

\documentclass{article}

\usepackage{filecontents}
\begin{filecontents*}{sample.bib}
@BOOK{Knuth1984,
title = {The \TeX book},
year = {1984},
author = {Knuth, Donald E},
}

@BOOK{Lamport1994,
title = {\LaTeXe , the Macro Package for \TeX },
year = {1994},
author = {Lamport, Leslie},
}

@BOOK{Goossens1994,
title = {The \LaTeX{} Companion},
year = {1994},
author = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
}
\end{filecontents*}

\begin{document}
Some text. \cite{Lamport1994} See table 1 citation      \nocite{Knuth1984}. More text. \cite{Goossens1994}
\bibliographystyle{unsrt}
\bibliography{sample}
\end{document}


\documentclass{article}

\usepackage{xcite}