While using rebib with RJ article LaTeX files one can use the following two options as per their needs :
In bibliography construction mode, rebib will check for existing BibTeX files and will convert the embedded bibliography only when there are no linked BibTeX files in the RJ article.
%% typically rebib will search for this line in the RJ article, not the RJwrapper file
\bibliography{example}
If there is no linked BibTeX file, rebib will begin its procedure of converting the embedded bibliography to BibTeX and then link it with the article file as well.
#> Warning in dir.create(your_article_folder <- file.path(tempdir(),
#> "exampledir")): '/tmp/RtmpHcDHTo/exampledir' already exists
# for files without BibTeX source
rebib::handle_bibliography(your_article_path)
#> No Bib files found !
#> BibTeX file does not exist
#> will parse for bibliography
#> bibtex file created
cat(readLines(paste(your_article_path,"example.bib",sep="/")),sep = "\n")
#> @book{ihaka:1996,
#> author = {{Ihaka, Ross and Gentleman, Robert}},
#> title = {{R: A Language for Data Analysis and Graphics}},
#> publisher = {Journal of Computational and Graphical Statistics 3: :},
#> pages = {299--314},
#> year = {1996},
#> url = {https://doi.org/10.1080/10618600.1996.10474713}
#> }
#> @book{R,
#> author = {R {Core Team}},
#> title = {{R: A Language and Environment for Statistical Computing}},
#> publisher = {R Foundation for Statistical Computing Vienna Austria :},
#> year = {2016},
#> url = {https://www.R-project.org/},
#> isbn = {3-900051-07-0}
#> }
#> @book{Tremblay:2012,
#> author = {A.~{Tremblay}},
#> title = {{LMERConvenienceFunctions: A suite of functions to back-fit fixed effects and forward-fit random effects, as well as other miscellaneous functions., }},
#> publisher = {R package version 1.6.8.2},
#> year = {2012},
#> url = {http://CRAN.R-project.org/package=LMERConvenienceFunctions}
#> }
If you have a BibTeX file and it is missing some references then this mode can help you read the embedded bibliography and combine the two bibliographies in a single BibTeX file.
# Suppose you have a example.bib file in your article path
cat(readLines(paste(your_article_path,"example.bib",sep="/")),sep = "\n")
#> @book{ihaka:1996,
#> author = {{Ihaka, Ross and Gentleman, Robert}},
#> title = {{R: A Language for Data Analysis and Graphics}},
#> publisher = {Journal of Computational and Graphical Statistics 3: 299--314},
#> year = {1996},
#> url = {https://doi.org/10.1080/10618600.1996.10474713}
#> }
# for files with BibTeX source as well as embedded entries
rebib::aggregate_bibliography(xfun::normalize_path(your_article_path))
#> Found Bib file example.bib
#> bibliography aggregation possible
#> Found Bib file example.bib
#> aggregation delta : 2
#> BibTeX file aggregated
cat(readLines(paste(your_article_path,"example.bib",sep="/")),sep = "\n")
#> @book{ihaka:1996,
#> author = {{Ihaka, Ross and Gentleman, Robert}},
#> title = {{R: A Language for Data Analysis and Graphics}},
#> publisher = {Journal of Computational and Graphical Statistics 3: 299--314},
#> year = {1996},
#> url = {https://doi.org/10.1080/10618600.1996.10474713}
#> }
#> @book{R,
#> author = {R {Core Team}},
#> title = {{R: A Language and Environment for Statistical Computing}},
#> publisher = {R Foundation for Statistical Computing Vienna Austria :},
#> year = {2016},
#> url = {https://www.R-project.org/},
#> isbn = {3-900051-07-0}
#> }
#> @book{Tremblay:2012,
#> author = {A.~{Tremblay}},
#> title = {{LMERConvenienceFunctions: A suite of functions to back-fit fixed effects and forward-fit random effects, as well as other miscellaneous functions., }},
#> publisher = {R package version 1.6.8.2},
#> year = {2012},
#> url = {http://CRAN.R-project.org/package=LMERConvenienceFunctions}
#> }