6

I have a file one.tex that contains its own bibliography from ref1.bib.

I don't believe the following fact is relevant to the current problem but just in case: This bibliography is split up according to type through \printbibliography.

This is one.tex

\documentclass[12pt]{article}
\usepackage[backend=biber, defernumbers=true, maxnames=10, sorting=ydnt, sortcites=true, style=ieee, citestyle=numeric]{biblatex}
\addbibresource{ref1.bib}

\begin{document}

\section{Section 1 Text}
blablbalbalabla~\cite{citation2}. blablablaba~\cite{citation7, citation6, citation4}.blablab~\cite{citation7}

\section{Section 2 bibliography}

\nocite{*}
\printbibliography[title={Refereed Contributions in Journals},heading=subbibliography,type=article]

\printbibliography[title={Refereed Full Paper Contributions in Conferences}, heading=subbibliography, type=inproceedings]

\printbibliography[title={Refereed Short Paper Contributions in Conferences \& Workshops}, heading=subbibliography, type=incollection]

\section{Section 3 more text}
blablbalbalabla~\cite{citation6, citation7, citation3}.
blablablaba~\cite{citation4}.blablaba~\cite{citation7}.
blablabla~\cite{citation1}

\end{document}

and here is bib1.bib

@article{citation1,
author={X Y and A B and T Y},
title={Just repeating the same title again and again},
journal = {IEEE Journal},
year={2016}
}

@article{citation5,
author={X Y and A B and T Y},
title={Just repeating the same title again and again},
journal = {IEEE Journal},
year={2014}
}

@inproceedings{citation2,
author={X Y and A B and T Y},
title={Just repeating the same title again and again},
booktitle= {Proceedings of the aweosme conference},
year={2016},
}

@inproceedings{citation3,
author={X Y and A B and T Y},
title={Just repeating the same title again and again},
booktitle= {Proceedings of the aweosme conference},
year={2016},
}

@inproceedings{citation4,
author={X Y and A B and T Y},
title={Just repeating the same title again and again},
booktitle= {Proceedings of the aweosme conference},
year={2015},
}

@incollection{citation5,
author={X Y and A B and T Y},
title={Just repeating the same title again and again},
booktitle= {Proceedings of the aweosme conference},
year={2012},
}


@incollection{citation6,
author={X Y and A B and T Y},
title={Just repeating the same title again and again},
booktitle= {Proceedings of the aweosme conference},
year={2016},
}

@incollection{citation7,
author={X Y and A B and T Y},
title={Just repeating the same title again and again},
booktitle= {Proceedings of the aweosme conference},
year={2016},
}

I now have a second file two.tex that also contains its own bibliography from ref2.bib. Now, in the text in two.tex, I might have \cite{ref1} and \cite{ref2} where ref1 is a reference from the bibliography of one.tex while ref2 is from the current file's bibliography bib2 It is important that the number that appears for ref1 corresponds to its number in the compiled bibliography of one.pdf. I tried using the xcite package by first compiling one.tex (pdflatex followed by bibtex followed by pdflatex) and then using \externalcitedocument{one} in two.tex, but all references that refer to bib1 are still undefined. In the following example, the first citation works while the second one referring to the bibliography from the other file is still undefined.

Here is two.tex

\documentclass{article}
\usepackage{xcite}
\externalcitedocument{one}

\begin{document}

Here is some text that will reference something from the current document~\cite{ref2-1}, as well as something from the first document~\cite{citation6}.

\bibliographystyle{plain} 
\bibliography{ref2}

\end{document}

and here is ref2.bib

@article{ref2-1,
author={X Y and A B and T Y},
title={This is a ref 2 title},
journal = {IEEE Journal},
year={2016}
}

@article{ref2-2,
author={X Y and A B and T Y},
title={This is a ref 2 title},
journal = {IEEE Journal},
year={2014}
}

Am I using xcite incorrectly?

Stefan Pinnow
  • 29,535
  • 2
    Please post two minimal(!) files that attempt to do what you want. It is tedious and time-consuming for others to create two separate files with two separate sets of bibliography items just to test. – jon Nov 11 '16 at 23:02
  • Welcome! What do you mean when you say that each file contains its own bibliography? Do you mean each contains \bibliographystyle{}\bibliography{<filename>}? Also relevant: is Biblatex/Biber an option? It can handle multiple bibliographies (relatively) easily. – cfr Nov 12 '16 at 00:00
  • I just edited my question with a full example. I could have minimized the first file more but I'm not sure if using the printbibliography in combination with the biber backend might also be contributing to the issue here. – Sarah Nadi Nov 12 '16 at 00:05
  • 2
    It seems xcite does not work with biblatex. – Guido Nov 14 '16 at 09:42
  • Thanks Guido. Do you have any suggestions on what to use instead to get the same effect of the divided bibliography in the first document? I'm also surprised xcite doesn't work with biblatex since its documentation says "Notice that \bibitem commands may not appear in aaa.tex, but rather in aaa.bbl if BibTEX or Biber are used to generate the bibliography, but this doesn’t matter. The important thing is that aaa.tex is in final form with all citations resolved and that aaa.aux is readable." – Sarah Nadi Nov 14 '16 at 18:26
  • My guess is that it might have worked for a very previous version of biblatex. There were many changes in biblatex in the past 5 years. – Guido Nov 15 '16 at 03:39
  • 1
    @SarahNadi -- The reference to aaa.aux is concerning (nowadays) for Biber-based bibliographies. While BibTeX relies on the .aux file, Biber requires a .bcf file. – jon Nov 19 '16 at 07:10
  • We may ask @egreg, who is the author of xcite package, if there is a way to make it work with BibLaTeX... – CarLaTeX Nov 19 '16 at 07:58
  • @CarLaTeX, that would be great -- I hope he gives me some hints. I still couldn't get it to work. – Sarah Nadi Nov 21 '16 at 23:31
  • 2
    @SarahNadi xcite doesn't work with biblatex generated references. – egreg Nov 22 '16 at 09:22

1 Answers1

4

xcite does not work with biblatex generated .aux files.

For this particular case you can do with

\documentclass{article}

\usepackage{xcite}
\makeatletter
\def\abx@aux@number#1#2#3#4#5#6\XC@{\bibcite{#2}{#5}}
\long\def\XC@test#1#2#3#4\XC@{%
  \ifx#1\bibcite
    \bibcite{\XC@prefix#2}{#3}%
  \else
    \ifx#1\abx@aux@number
      \abx@aux@number{#2}{#3}#4\XC@
    \else
      \ifx#1\@input
        \edef\XC@list{\XC@list#2\relax}%
      \fi
    \fi
  \fi
  \ifeof\@inputcheck\expandafter\XC@aux
  \else\expandafter\XC@read\fi}
\makeatother

\externalcitedocument{one}

\begin{document}

Here is some text that will reference something from the current 
document~\cite{ref2-1}, as well as something from the first 
document~\cite{citation6}.

\bibliographystyle{plain} 
\bibliography{ref2}

\end{document}

enter image description here

egreg
  • 1,121,712