13

Consider the following bibliography and MWE:

\documentclass{article}
\usepackage{natbib}

\begin{filecontents*}{bibliography.bib}
@proceedings{conf:2006,
  editor    = {Star, Patrick and Tentacles, Squidward},
  title     = {Proceedings of the 1st Conference on Marine Biology},
  booktitle = {Proceedings of the 1st Conference on Marine Biology},
  year      = 2006,
  month     = jan,
}

@inproceedings{proc:2006:01,
  title     = {How To Live Underwater},
  author    = {Squarepants, SpongeBob},
  pages     = {1--8},
  crossref  = {conf:2006}
}

@inproceedings{proc:2006:02,
  editor    = {Star, Patrick and Tentacles, Squidward},
  booktitle = {Proceedings of the 1st Conference on Marine Biology},
  year      = 2006,
  month     = jan,
  title     = {How To Live Underwater},
  author    = {Squarepants, SpongeBob},
  pages     = {1--8},
}
\end{filecontents*}

\begin{document}
\nocite{*}
\bibliographystyle{plain}
\bibliography{bibliography}
\end{document}

This results in the following bibliography: Output of MWE.

My desired output would be to get item [2] (instead of [1] and [3]) while citing proc:2006:01 that uses a crossref to conf:2006.

I would like to use the crossref field mainly as an easier way to manage my .bib file, and I am not particularly interested in showing an entry for the article and an entry for the conference in my references. I guess, in a sense, that would mean that the conf:2006 entries are copied to proc:2006:01 before it is processed. Is there a way I can do this? Preferably the solution would allow me to revert to the normal output if necessary.

I've tried the answer here, but that only shows the fields of the main entry without inheriting the crossref entries. That's not what I want.

  • I am aware of the correct ordering, but I didn't think that it was an issue because all references were resolved. I guess latexmk did not show me the warnings. What you're saying is that the reason I was not getting the full bibliography entry when using \cite{proc:2006:01} is because the crossref entry was before the cited entry. Right? Also, depending on the number of times it is crossrefed, the crossref entry may appear separately in the references. I'll have to confirm tomorrow when I am using a PC. If that is the case, I was just being silly and I'll accept this as an answer. – sudosensei Dec 7 '13 at 21:46
  • @Mico: I guess the question, rather, is whether there is a way to avoid the ordering requirement. I sort my .bib entries by the key name and I'd rather avoid a silly naming scheme that will push them at the end of the .bib file. – sudosensei Dec 7 '13 at 21:50
  • @Mico Could you please convert your comment about the ordering into an answer so that I can accept it? I just tested it and it works fine. latexmk would not show me the warnings, so I thought that the ordering was not the issue. I'll also have to look for something more sophisticated than bibsort to sort my bibliography. Hopefully bibtool offers the "crossref-ed entries at the end" feature. If not, I guess I'll post another question. Thanks for the help! :-) – sudosensei Dec 8 '13 at 11:39
12

Entries that are cross-referenced by other entries should occur later in the .bib file than any entries that cross-reference them. In practice, this means placing the entries that are cross-referenced at the end of the .bib file.

The fact that your MWE's .bib file has the entry being cross-referenced (key: conf:2006) coming first rather than last may be the cause of the problem behavior you're experiencing. If I rearrange your .bib file so that the entry with key conf:2006 comes last, then executing either just \cite{proc:2006:01} (which cross-references conf:2006) or \cite{proc:2006:02} (which does not) in the body of the document produces the identical entry in the bibliography.

Making sure that entries that are cross-referenced come last in the .bib file can be tedious, especially if the files contains lots and lots of entries and if you'd like to maintain some systematic sorting scheme. Fortunately, quite a few LaTeX-aware editors feature routines that simplify the task of pretty-printing bibliographic entries and sorting them according to various criteria. One particularly useful sorting criterion is to place all entries that are cross-referenced by other entries last in the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.