Package: bibfish
bibfishBibfish generates a local BibTeX file from a central BibTeX database based on the citations found in a LaTeX file. This is useful if you want to maintain a single master BibTeX file (or several) and automatically generate a separate, independent BibTeX file for each manuscript you're working on. It is similar toBibexportandMakebib, except Bibfish is not dependent on any particular LaTeX tool and is therefore agnostic about your choice of bibliographic software (BibTeX vs. BibLaTeX, etc.) or general typesetting pipeline.InstallationBibfish is written in Python and can be installed usingpip:pipinstallbibfishBasic usageBibfish may be used from the command line like so:bibfishmanuscript.tex~/master.bibreferences.bibWarningOrdering these filenames incorrectly could result in data loss! Ensure that the arguments are ordered as follows: (1) The LaTeX manuscript file. (2) Your master BibTeX database. (3) The output file that will be created by Bibfish.By default, Bibfish will not overwrite a local .bib file if it already exists. To override this behavior, use the-foption:bibfish-fmanuscript.tex~/master.bibreferences.bibBy default, Bibfish searches your manuscript for\cite{},\citet{}, and\citep{}. If you are using a different set of cite commands, you can specify them with the--ccoption:bibfish--cc"textcite,parencite,possessivecite"manuscript.tex~/master.bibreferences.bibIf you maintain multiple BibTex databases, you can pass additional .bib files with the--biboption:bibfishmanuscript.tex~/master.bibreferences.bib--bib~/my_papers.bib~/my_abstracts.bibUsage as part of a larger pipelineBibfish can also be used as an integral part of your typesetting procedure, with the following intended usage pattern:Start a new LaTeX document and, when setting up the bibliography, point it to e.g.references.bib(no need to create this file; it will be generated automatically). For example, depending on how you set things up, you might have a line like\bibliography{references.bib}or\addbibresource{references.bib}.Add any BibTeX entries you want to cite to yourmaster.bib(stored e.g. in your home directory).Cite some BibTeX entries in your LaTeX document using their citekeys as normal.Before typesetting, run Bibfish first; this will fish out the relevant entries frommaster.biband place them inreferences.bib.Continue with the rest of your typesetting procedure, e.g. runpdflatex,latex,xelatex,bibtex,biber,dvipdf, or whatever else you normally do in your pipeline.For example, you might create a typesetting script like this:#!/bin/bashbibfish-fmanuscript.tex~/master.bibreferences.bib
latexmanuscript.tex
bibtexmanuscript.aux
latexmanuscript.tex
dvipdfmmanuscript.dviEach time you run this script, Bibfish will searchmanuscript.texfor citekeys, extract the relevant entries from~/master.bib, and write them out toreferences.bib, allowing the rest of the typesetting process to proceed as normal.The benefit of this is that your LaTeX document does not need to have any dependence on or reference to~/master.bib. This means you can maintain a singlemaster.bib, while also maintaining each manuscript as its own independent self-contained package. You could, for example, sendmanuscript.texandreferences.bibto a coauthor or publisher without needing to supply your entiremaster.bib, andmanuscript.texandreferences.bibcan be kept under version control without any connection tomaster.bib.CaveatsBibfish relies onBibtexParserto read and write .bib files. Although we have configured it in a relatively permissive fashion, please raise an issue if Bibfish has trouble reading your database or is producing unexpected output.LicenseBibfish is licensed under the terms of the MIT License.