Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change BibTeX "I couldn't open database file" message to include double extension #541

Closed
1 task done
moewew opened this issue May 15, 2020 · 4 comments
Closed
1 task done
Assignees
Labels
Milestone

Comments

@moewew
Copy link

moewew commented May 15, 2020

Consider the following MWE which fails because of the incorrect inclusion of .bib in the file name argument to \bibliography

\documentclass{article}

\bibliographystyle{plain}

\begin{document}
\cite{incollection-full}
\bibliography{xampl.bib}
\end{document}

BibTeX (MiKTeX-BibTeX 2.9.7388 (0.99d) (MiKTeX 2.9.7420 64-bit)) reports

I couldn't open database file xampl.bib
---line 4 of file Namenlsasos-9.aux
 : \bibdata{xampl.bib
 :                    }
I'm skipping whatever remains of this command
I found no database files---while reading file Namenlsasos-9.aux
Warning--I didn't find a database entry for "incollection-full"
(There were 2 error messages)

This is a bit confusing, because BibTeX claims xampl.bib could not be found (that file is present and would be found), but it actually looks for xampl.bib.bib, which can not be found. Compare this to

\documentclass{article}

\bibliographystyle{plain}

\begin{document}
\cite{incollection-full}
\bibliography{filethatdoesnotexist}
\end{document}

where BibTeX appends .bib to the file name

I couldn't open database file filethatdoesnotexist.bib
---line 4 of file hagasgjasgjs.aux
 : \bibdata{filethatdoesnotexist
 :                              }
I'm skipping whatever remains of this command
I found no database files---while reading file hagasgjasgjs.aux
Warning--I didn't find a database entry for "incollection-full"
(There were 2 error messages)

I think up until a while ago BibTeX correctly reported xampl.bib.bib as not found. (On a quick Google search I found https://stackoverflow.com/q/53969663 and https://www.reddit.com/r/LaTeX/comments/2wip2b/new_to_latex_first_time_bibliography_ive_been/)

So I suggest to re-instate the behaviour to always append .bib to the file not found message and not to strip a double .bib. I.e. the first message should read

I couldn't open database file xampl.bib.bib
---line 4 of file Namenlsasos-9.aux
 : \bibdata{xampl.bib
 :                    }
I'm skipping whatever remains of this command
I found no database files---while reading file Namenlsasos-9.aux
Warning--I didn't find a database entry for "incollection-full"
(There were 2 error messages)

That way the message can at least give a hint as to what might be going wrong.


Of course an alternative solution would be to strip double .bib extensions to avoid the issue in the first place (TeX live seems to accept \bibliography{xampl.bib}), but that is not what I'm primarily asking for. I think it is perfectly fine to support only documented use of the command (without the .bib file extension).

@edocevoli edocevoli self-assigned this May 15, 2020
@edocevoli edocevoli added the bug label May 15, 2020
@edocevoli edocevoli added this to the 2.9.7420 milestone May 15, 2020
edocevoli added a commit that referenced this issue May 15, 2020
@edocevoli
Copy link
Member

MiKTeX-BibTeX now accepts \bibliography{file.bib} just as file.aux is accepted on the command-line.

@moewew
Copy link
Author

moewew commented May 18, 2020

I'm not going to have a good argument any more to tell people to stop using the strictly speaking incorrect \bibliography{file.bib} now, but I guess this is the more user friendly outcome.

Is this already part of This is BibTeX, Version 0.99d (MiKTeX 2.9.7440 64-bit)?

Anyway, while I'm here, could you have a look at

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}

\begin{filecontents}{section.tex}
\section{My section}
I need to test the citations, so see \cite{incollection-full}.
\end{filecontents}

\begin{document}
\include{section}
\bibliography{xampl}
\bibliographystyle{plain}
\end{document}

(from https://tex.stackexchange.com/q/544949/35864).
When I run BibTeX I now get

This is BibTeX, Version 0.99d (MiKTeX 2.9.7440 64-bit)
Capacity: max_strings=200000, hash_size=200000, hash_prime=170003
The top-level auxiliary file: includetest.aux
Reallocating 'name_of_file' (item size: 1) to 12 items.
I couldn't open auxiliary file section.aux
---line 3 of file includetest.aux
 : \@input{section.aux
 :                    }
I'm skipping whatever remains of this command
Reallocating 'name_of_file' (item size: 1) to 6 items.
Reallocating 'name_of_file' (item size: 1) to 6 items.
The style file: plain.bst
I found no \citation commands---while reading file includetest.aux
Database file #1: xampl.bib
You've used 0 entries,
            2118 wiz_defined-function locations,
            505 strings with 4256 characters,
and the built_in function-call counts, 20 in all, are:
= -- 0
> -- 0
< -- 0
+ -- 0
- -- 0
* -- 2
:= -- 7
add.period$ -- 0
call.type$ -- 0
change.case$ -- 0
chr.to.int$ -- 0
cite$ -- 0
duplicate$ -- 0
empty$ -- 1
format.name$ -- 0
if$ -- 1
int.to.chr$ -- 0
int.to.str$ -- 0
missing$ -- 0
newline$ -- 4
num.names$ -- 0
pop$ -- 0
preamble$ -- 2
purify$ -- 0
quote$ -- 0
skip$ -- 0
stack$ -- 0
substring$ -- 0
swap$ -- 0
text.length$ -- 0
text.prefix$ -- 0
top$ -- 0
type$ -- 0
warning$ -- 0
while$ -- 0
width$ -- 0
write$ -- 3
(There were 2 error messages)

I think something like this used to work. (And in fact it does work in TeX live.)

@edocevoli
Copy link
Member

Is this already part of This is BibTeX, Version 0.99d (MiKTeX 2.9.7440 64-bit)?

Yes.

Anyway, while I'm here, could you have a look at

Thank you, yet another bug. Deserves a new ticket.

@moewew
Copy link
Author

moewew commented May 18, 2020

I'll open another ticket about the .aux issue shortly. (edit #546)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants