3

I have a .bib file that I want to shrink down so that it only contains all the entries but only a subset of the original parameters. Furthermore, I would like to do this by specifying which parameters to include and not which ones to remove (the reason being that I have no control over the naming of the extra parameters that might get included in my original file).

(In my specific case, I would like to keep the parameters Author, Journal, Pages, Title, Volume, Number, Year, and Doi.)

Can I achieve this somehow? I don't really care what tool I would have to use.

I've been looking into using BibDesk for this. More specifically, using templates. However, the information I've found about this so far has been sparse and incomprehensible at best and outright faulty at worst (or maybe it's just me who can't read instructions).

2
  • sed or (g)awk? (I assume you are not using Windows given the reference to BibDesk and so will have these.) – cfr Jun 14 '15 at 22:20
  • Presumably biber can do this? – cfr Jun 15 '15 at 2:52
5

You should be able to do this with BibDesk templates. If you don't want the required/optional fields as specified in btxdoc, I'd start with this example, but replace the requiredFields and optionalFields with blocks like this for each field that you want to keep:

<$fields.Author?>
   Author = <$fields.Author.bibTeXString/>,
<?$fields.Author?>

If that doesn't work, post back here or (better) the BibDesk mailing list. It's been years since I did anything with the template system, so I can't give you a full example off the top of my head.

2
  • Thanks for pointing me in the right direction. After a lot of digging around, I managed to create an output that I was satisfied with. However, it really feels like the manual for BibDesk needs a thorough overhaul by someone who isn't a nerdy programmer :) – Speldosa Jun 17 '15 at 15:27
  • 1
    Unfortunately, the guys who wrote the code for BibDesk (of which I am one) also wrote the manual, because no one else could or would. It is open-source, so contributions would be welcome! – Adam Maxwell Jun 17 '15 at 15:30
2

One tool I've used is BibtexParser. You can use it in a Python script that takes the .bib file and outputs another one with the fields you want. I've used it for something similar myself: https://github.com/twsh/Convertbibliography

This isn't a Bibdesk specific solution, of course. But I take it that that doesn't matter to you.

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.