2

It seems that the latest version of bibtool (2.67) has a problem reading .aux files.

MWE (from here):

1. a file named exampl_01.tex:

\documentclass{article}

\begin{document}

Random citation \cite{DUMMY:1} embedded in text.

\newpage

\bibliography{lesson7a1} 
\bibliographystyle{plain}

\end{document}

2. a file named lesson7a1.bib:

@BOOK{DUMMY:1,
AUTHOR="John Doe",
TITLE="The Book without Title",
PUBLISHER="Dummy Publisher",
YEAR="2100",
}

Upon LaTeXing the above, we get (among others) the file exampl_01.aux, which has the content

\relax 
\citation{DUMMY:1}
\bibdata{lesson7a1}
\bibcite{DUMMY:1}{1}
\bibstyle{plain}

Then we run bibtool as follows

bibtool  -x exampl_01.aux -o used_references.bib

We get the output

*** BibTool WARNING: File bibstyle not found.

The file used_references.bib is produced, but is empty.

Note that the manual (pp. 10-11, 1.2.4. Extracting Entries for a Document) gives the following sample command: bibtool -x document.aux -o document.bib. Thus, it seems the above should have worked, but it doesn't.

If we simply erase the line \bibstyle{plain} from the .aux file and rerun bibtool, we get the error message

*** BibTool WARNING: File bibcite not found.

The file used_references.bib is again empty.
Finally, if we also erase the \bibcite{DUMMY:1}{1} line from the the .aux file and rerun bibtool, we get no error messages and the file used_references.bib contains what we expect, namely,

@Book{        dummy:1,
  author    = "John Doe",
  title     = "The Book without Title",
  publisher = "Dummy Publisher",
  year      = "2100"
}

I see this behavior both under kubuntu 18.04 and under cygwin. In the bibtool documentation, I see no mention of this.

I used to be able to do this without any errors.

Is this a bug in the newest version of bibtool? (Which is actually not that new: executing bibtool -help gives 2017 as the most recent year.) Am I doing something wrong?

There is a hack that has worked for me so far: use grep to extract just the relevant lines from the .aux file (namely those that begin either with \citation or with \bibdata), and run bibtool on that file. Here's one way to do it:

grep -E '\\citation|\\bibdata' exampl_01.aux  > cleaned-up_aux_file.aux
bibtool  -x cleaned-up_aux_file.aux -o used_citations_01.bib 
rm cleaned-up_aux_file.aux

The problem is that I don't really know the details of how either BibTeX or bibtool work 'under the hood', and so I don't know if this hack really solves the problem in all circumstances, or if I have just been lucky so far.

Questions:

  1. Is the described behavior a bug?

  2. Is there a better workaround than the hack I described?

  3. Are there any potential problems that my hack could create?

3

This is in fact a bug in version 2.67. It has been fixed in 2.68. Since 2.68 has not been released officially yet, you can retrieve the latest version from the repository at https://github.com/ge-ne/bibtool/ I will make an official release in the near furture.

Sorry for any inconvenience.

Gerd (author and maintainer of BibTool)

  • Thank you so much! I have downloaded and compiled version 2.68 (instructions here if anyone needs them: tex.stackexchange.com/a/181005/192504 Formally that's for cygwin, but it will work on linux as well—it did for me). Bibtool version 2.68 indeed has the expected behavior. – linguisticturn Jul 11 at 2:09

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.