Closed
Description
citr::tidy_bib_file()
does not seem to handle BibLaTeX entries. For example, @online
entry in the original bib file is not preserved as is; it is transferred into BibTeX @Misc
entry in tidy bib file while missing some information.
This causes some issues as different entries are differently interpreted by pandoc-citeproc
. In brief, even though the original messy bib file is in BibLaTeX format, currently tidy_bib_file()
forces it into BibTeX
format.
Would there be any way to keep the original BibLaTeX entries as they are?
Please refer to the following reproducible code along with original messy test.bib
and the processed tidy_references.bib
file with a special attention to @online
entry.
# Download test Rmd and bib files:
utils::download.file("https://jooyoungseo.com/test.Rmd", destfile = "test.Rmd")
utils::download.file("https://jooyoungseo.com/test.bib", destfile = "test.bib")
# Loading RefManageR
library(RefManageR)
# Create tidy bib file:
citr::tidy_bib_file(
rmd_file = "test.Rmd"
, messy_bibliography = "test.bib"
, file = "tidy_references.bib"
)
#> Removing 119 unneeded bibliography entries.
#> Writing 4 Bibtex entries ... OK
#> Results written to file 'tidy_references.bib'
Created on 2020-01-21 by the reprex package (v0.3.0.9001)
Session info
sessioninfo::session_info()
#> - Session info ---------------------------------------------------------------
#> setting value
#> version R version 3.6.2 (2019-12-12)
#> os Windows 10 x64
#> system x86_64, mingw32
#> ui RTerm
#> language (EN)
#> collate English_United States.1252
#> ctype English_United States.1252
#> tz America/New_York
#> date 2020-01-21
#>
#> - Packages -------------------------------------------------------------------
#> package * version date lib source
#> assertthat 0.2.1 2019-03-21 [2] CRAN (R 3.6.2)
#> backports 1.1.5 2019-10-02 [2] CRAN (R 3.6.1)
#> bibtex 0.4.2.2 2020-01-02 [2] CRAN (R 3.6.2)
#> citr 0.3.2 2020-01-09 [1] Github (crsh/citr@e09de2e)
#> cli 2.0.1 2020-01-08 [1] CRAN (R 3.6.2)
#> crayon 1.3.4 2017-09-16 [2] CRAN (R 3.6.2)
#> digest 0.6.23 2019-11-23 [2] CRAN (R 3.6.2)
#> evaluate 0.14 2019-05-28 [2] CRAN (R 3.6.2)
#> fansi 0.4.1 2020-01-08 [1] CRAN (R 3.6.2)
#> fastmap 1.0.1 2019-10-08 [2] CRAN (R 3.6.2)
#> fs 1.3.1 2019-05-06 [2] CRAN (R 3.6.2)
#> glue 1.3.1 2019-03-12 [2] CRAN (R 3.6.2)
#> highr 0.8 2019-03-20 [2] CRAN (R 3.6.2)
#> htmltools 0.4.0.9002 2020-01-17 [1] Github (rstudio/htmltools@e07546c)
#> httpuv 1.5.2 2019-09-11 [2] CRAN (R 3.6.2)
#> httr 1.4.1 2019-08-05 [2] CRAN (R 3.6.2)
#> jsonlite 1.6 2018-12-07 [2] CRAN (R 3.6.2)
#> knitr 1.27.2 2020-01-21 [1] Github (yihui/knitr@ab191b0)
#> later 1.0.0 2019-10-04 [2] CRAN (R 3.6.2)
#> lubridate 1.7.4 2018-04-11 [2] CRAN (R 3.6.2)
#> magrittr 1.5 2014-11-22 [2] CRAN (R 3.6.2)
#> mime 0.8 2019-12-19 [2] CRAN (R 3.6.2)
#> miniUI 0.1.1.1 2018-05-18 [2] CRAN (R 3.6.0)
#> pillar 1.4.3 2019-12-20 [2] CRAN (R 3.6.2)
#> pkgconfig 2.0.3 2019-09-22 [2] CRAN (R 3.6.2)
#> plyr 1.8.5 2019-12-10 [2] CRAN (R 3.6.2)
#> promises 1.1.0 2019-10-04 [2] CRAN (R 3.6.2)
#> purrr 0.3.3 2019-10-18 [2] CRAN (R 3.6.2)
#> R6 2.4.1 2019-11-12 [2] CRAN (R 3.6.2)
#> Rcpp 1.0.3 2019-11-08 [2] CRAN (R 3.6.2)
#> RefManageR * 1.2.13 2020-01-03 [2] Github (ropensci/RefManageR@be9d663)
#> reprex 0.3.0.9001 2020-01-14 [1] Github (tidyverse/reprex@9639e88)
#> rlang 0.4.2 2019-11-23 [2] CRAN (R 3.6.2)
#> rmarkdown 2.1.1 2020-01-21 [1] Github (rstudio/rmarkdown@18ba267)
#> sessioninfo 1.1.1 2018-11-05 [2] CRAN (R 3.6.2)
#> shiny 1.4.0.9001 2020-01-16 [1] Github (rstudio/shiny@cdbdb45)
#> stringi 1.4.5 2020-01-11 [1] CRAN (R 3.6.2)
#> stringr 1.4.0.9000 2020-01-21 [1] Github (hadley/stringr@cc6e322)
#> styler 1.2.0 2019-10-17 [2] CRAN (R 3.6.2)
#> tibble 2.1.3 2019-06-06 [2] CRAN (R 3.6.2)
#> withr 2.1.2 2018-03-15 [2] CRAN (R 3.6.2)
#> xfun 0.12.2 2020-01-17 [1] Github (yihui/xfun@9ecdc33)
#> xml2 1.2.2 2019-08-09 [2] CRAN (R 3.6.2)
#> xtable 1.8-4 2019-04-21 [2] CRAN (R 3.6.2)
#> yaml 2.2.0 2018-07-25 [2] CRAN (R 3.6.0)
#>
#> [1] C:/Users/JooYoung/R/win-library/3.6
#> [2] C:/Program Files/R/R-3.6.2/library