I have a tex file citing some references from a bib file. I want to reformat (i.e. regenerate) all the citation keys in the bib file using JabRef and automatically propagate the changes to the tex file. Does someone know a way of automatically keeping both files synchronized?
1 Answer
This simple project solved the key and cite renaming problem:
https://github.com/dmpalyvos/bibtex-rename
It's a simple code, you must
Clone the bibtex-rename with
git clone https://github.com/dmpalyvos/bibtex-rename
Rename the bibkey of your file
sample.bib
, and save assample_new.bib
.Install the bibtex parser:
pip install bibtexparser
.Execute
python transform.py --tex main.tex --oldbib sample.bib --newbib sample_new.bib --out out.tex
.
Check and ensure that the itens are in the same order,and if you are citing the BibTeX item with \cite{bibkey}
.
.bib
entry you mean to cite. If you change the key, there is nothing for it to recognise. That said, if you use Biblatex, you can put the old key into theids
field and then the entry will still be found, even though the.tex
file only uses the old key. This is what I do when I want to change a citation key. That way, existing files still work.sed
script and apply it to the two files. Then they'd be in sync because you'd make the same changes in both. But you'd need to make sure to avoid spurious matches. Possiblygawk
might do it a bit more safely, if there's a risk of matches on other lines. Whether JabRef would like your doing this I know not, but they are all just text files, after all, so you can use the standard text processing tools on them.bib
file changes, but not thetex
files referencing thebib
file. I think, this is a feature wish for JabRef. You could bring up that in the forum or just go ahead an implement it directly in JabRef's source.