It extracts fields from unstructured \bibitem content by pattern matching (based on GROK regex library) and then saves them in bibtex format.
Use it when a document has citations without using BibTex but just old style thebibliography environment and \bibitem's. The script translates \bibitem entries and puts them into BibTex format.
Install dependencies with
pip install -r requirements.txtor
pip3 install pygrok plyRun it and save its output to a file:
python3 bbl2bib.py samples/bibitem-medium.tex > bibitem.bibRun with verbose debug output:
python3 bbl2bib.py samples/bibitem.tex -dYou can test your grok patterns at https://grokdebug.herokuapp.com/.
See the list of available default grok patterns: https://grokdebug.herokuapp.com/patterns or https://github.com/garyelephant/pygrok/tree/master/pygrok/patterns.
Sources and documentation for pygrok: https://github.com/garyelephant/pygrok.
Both pygrok and py3grok have their limitations.
- http://materia.fisica.unimi.it/manini/scripts/convertbiblio.py
- http://materia.fisica.unimi.it/manini/scripts/convertbiblio
Run as
python3 convertbiblio.py ref.texUses online database.
curl -L -o bbl2bib.pl https://raw.githubusercontent.com/borisveytsman/crossrefware/master/bbl2bib.pl
sudo cpan install BibTeX::Parser
perl bbl2bib.pl bibitem.texdocker run -it --rm -v $(pwd):/srv --entrypoint sh php:5.6-alpine
cd /srv
php -f convert.php bibitem2.tex
#docker run -it --rm -v $(pwd):/srv php:5.6-alpine -f /srv/convert.php /srv/bbl.texRemove square brackets []
gsed -E 's \[\{ { ; s \}\] } ' bibitem.tex > bibitem2.texhttps://ctan.org/tex-archive/biblio/bibtex/utils/tex2bib https://sites.ualberta.ca/afs/ualberta.ca/sunsite/ftp/pub/Mirror/CTAN/help/Catalogue/entries/tex2bib.html
/CTAN/biblio/bibtex/utils/tex2bib/
sudo cpan notest install Perl4::CoreLibs
perl tex2bib.pl -i bibitem.tex