ropensci / bib2df

Parse a BibTeX file to a tibble
https://docs.ropensci.org/bib2df
99 stars 22 forks source link

field names in lower case #36

Open vikasrawal opened 4 years ago

vikasrawal commented 4 years ago

I find that bib2df does not correctly parse when field names are "title", "author" etc. Has anyone else faced this problem?

ginolhac commented 4 years ago

Hi, are you sure that's the issue ? I had difficulties and found out that what matters is spaces aound the = between keys and values. For example

@Article{pmid31044623,
   Author="Becker, J. C.  and Gerard, D.  and Ginolhac, A.  and Sauter, T.  and Sinkkonen, L. ",
   Title="{{I}dentification of genes under dynamic post-transcriptional regulation from time-series epigenomic data}",
   Journal="Epigenomics",
   Year="2019",
   Volume="11",
   Number="6",
   Pages="619--638",
   Month="May",
   Note={[DOI:\href{https://dx.doi.org/10.2217/epi-2018-0084}{10.2217/epi-2018-0084}]
}

needs to be

@Article{pmid31044623,
   Author = "Becker, J. C.  and Gerard, D.  and Ginolhac, A.  and Sauter, T.  and Sinkkonen, L. ",
   Title = "{{I}dentification of genes under dynamic post-transcriptional regulation from time-series epigenomic data}",
   Journal = "Epigenomics",
   Year = "2019",
   Volume = "11",
   Number = "6",
   Pages = "619--638",
   Month = "May",
   Note = {[DOI:\href{https://dx.doi.org/10.2217/epi-2018-0084}{10.2217/epi-2018-0084}]
}

to be parsed correctly. read_lines("biblio.bib") %>% str_replace("([a-z])=([\"\\{])", "\\1 = \\2") should do

bwiernik commented 4 years ago

pandoc (or rmarkdown) fails when trying to render a document that uses a .bib file output by bib2df. If I lowercase the field names and item categories, rendering works correctly.

agricolamz commented 4 years ago

Wow, spaces were my issue! I am lucky that I get here by accident. Is it possible to make it working with any amount of spaces around the =?

ottlngr commented 4 years ago

@vikasrawal If this is still relevant to you, could you please provide an example?

@ginolhac @agricolamz bib2df now should support arbitrary amount of spaces around the =. Please re-install bib2df from GitHub and check if the problem still occurs.

agricolamz commented 4 years ago

Thank you, @ottlngr!