Editing - MWRuszczycky/btx GitHub Wiki
Deleting and Editing Entries
Deleting entries
Working through the previous examples, we ended up adding six new references to our tutorial.bib
BibTex file. Now, we want to get rid of some of these. The toss
command is used to clear the context without having any effect on the working bibliography. Therefore, we can use toss
with get
to effectively delete entries from the working bibliography. In particular, suppose we want to delete AnArticle2000
, AnotherBook2018
and SomeBook2018
. We can do this with the following script
$ btx in tutorial.bib, get AnArticle2000 AnotherBook2018 SomeBook2018 and toss
If you now run
$ btx in tutorial.bib, get all and view list
you well see that the entries we wanted to get rid of have indeed been removed.
Editing entries
If we look back at the entry Ray1983
that we downloded using the doi
command (see here), we can see that the pages are listed as 4625[?]4637
, and we want to replace the [?]
with a hyphen -
. btx is not intended to be a text editor, since there are already lots of really good programs that fill that role. Instead, btx is intended to help you use your favorite editor to more easily access and edit the individual entries in a BibTeX bibliography.
So, to make the change, we first need to populate the context with the Ray1983
entry and then run our favorite editor on it. This is done with the edit
command
$ btx in tutorial.bib, get Ray1983 and edit vim
Here we are using vim
to edit the entry, but you can use any other editor you want (e.g., try replacing vim
with nano
in the above example). When you run this command, a Vim session will be started with the Ray1983
BibTeX data loaded. You can now edit whatever you want. btx will not allow you to quit editing the entry until it parses as valid BibTeX; however, if you want to abort editing, then just delete the entire entry. Actually, aborting a reference really just depends on deleting all the @
signs. This will not delete the entry from the working bibliography.