Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

When using bibtex, one supplies a command like \bibliography{test} in the document to indicate the use of a bibfile test.bib, and the extension is omitted. However, it is natural for a user also to supply an extension, as in \bibliography{test.bib}. In this case, there is a difference between the actual behavior of bibtex and the contents of its log file and the screen output:

  1. If \bibliography{test.bib} is in the document, then bibtex opens and reads test.bib, which is natural from the user's point of view. However bibtex reports that it opens the file test.bib.bib:

    Database file #1: test.bib.bib
    
  2. If the file test.bib does NOT exist, but the file test.bib.bib does exist, then bibtex fails and, even though the file exists, it gives the following error message:

    I couldn't open database file test.bib.bib
    
  3. If a non-bib extension is appended, as in \bibliography{test.tbb}, then bibtex uses test.tbb.bib.

(The tests were done on with a current TeXLive 2012 installation.)

It appears that the main logic of bibtex and its messages work as if the extension .bib is always added to the user supplied filename. But the file opening routine silently opens a file with extension .bib instead of .bib.bib whenever the double .bib extension is present.

Is this documented behavior? Is this behavior specific to the TeXLive 2012 implementation of bibtex, or is it the same in all versions of bibtex?

Why does the answer matter? I am the maintainer of latexmk, which automatically determines dependencies from information in the .log and .aux files. latexmk needs to work out the name of the .bib file used by bibtex, and also analyzes error messages from bibtex. If there is version dependence in the bug/feature described above, and if bibtex puts incorrect information in its log file (.blg), it is tricky for latexmk to determine what to do.

share|improve this question
    
I believe that the safest method is for latexmk to issue a warning (or an error) if the argument to \bibfile in the .aux file appears to have an extension. –  egreg Dec 30 '12 at 21:29
1  
MiKTeX does not exhibit the same behaviour (at least on my system), and only looks for the file after appending .bib (so looking for .bib.bib if .bib is already present). The behaviour of TeXLive's bibtex to display a different filename to the one it actually opened is clearly a bug rather than documented behaviour. It would be better to fix this bug at the TeXLive end, and latexmk could still warn about the incorrect extension as it is not correct and is non-portable. –  cyberSingularity Dec 30 '12 at 22:30
add comment

1 Answer

MiKTeX does not exhibit the same behaviour (at least on my system), and only looks for the file after appending .bib (so looking for .bib.bib if .bib is already present). The behaviour of TeXLive's bibtex to display a different filename to the one it actually opened is clearly a bug rather than documented behaviour. It would be better to fix this bug at the TeXLive end, and latexmk could still warn about the incorrect extension as it is not correct and is non-portable.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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