wenjie2wang / formatBibtex

Format BibTeX Entries/Files
https://wwenjie.org/formatbibtex/
GNU General Public License v3.0
0 stars 1 forks source link

Protected names and accents in author field #1

Open jun-yan opened 3 years ago

jun-yan commented 3 years ago

1) The CDC protection was removed and an unnecessary comma was added.

2) The curly brace in Br{\aa}dvik was removed.

@misc{CDC:2019, author = {{CDC}}, title = {{WISQARS} Leading Causes of Death Reports}, url = {https://webappa.cdc.gov/sasweb/ncipc/leadcause.html}, journal = {Centers for Disease Control and Prevention}, publisher = {Centers for Disease Control and Prevention}, year = {2021}, note = {Retrieved on April 24, 2021} }

@misc{braadvik2018suicide, title = {Suicide Risk and Mental Disorders}, author = {Br{\aa}dvik, Louise}, year = {2018}, publisher = {Multidisciplinary Digital Publishing Institute} }

@article{barabasi:1999, title={Emergence of scaling in random networks}, author={Barab{\'a}si, A.L. and Albert, R.}, journal={science}, volume={286}, number={5439}, pages={509--512}, year={1999}, publisher={American Association for the Advancement of Science} }

wenjie2wang commented 2 years ago

Thanks for reporting this issue with examples.

  1. The CDC protection was removed and an unnecessary comma was added.

It should be resolved by 3c618239344e73d6e80b9dac164dec260e805280.

  1. The curly brace in Br{\aa}dvik was removed.

The curly braces were removed by bibtex::read_bib():

> str(bibtex::read.bib("test.bib"))
List of 3
 $ barabasi:1999      :Class 'bibentry'  hidden list of 1
  ..$ barabasi:1999:List of 8
  .. ..$ title    : chr "Emergence of scaling in random networks"
  .. ..$ author   :List of 2
  .. .. ..$ :Class 'person'  hidden list of 1
  .. .. .. ..$ :List of 5
  .. .. .. .. ..$ given  : chr "A.L."
  .. .. .. .. ..$ family : chr "Barab'asi"
  .. .. .. .. ..$ role   : NULL
  .. .. .. .. ..$ email  : NULL
  .. .. .. .. ..$ comment: NULL
  .. .. ..$ :Class 'person'  hidden list of 1
  .. .. .. ..$ :List of 5
  .. .. .. .. ..$ given  : chr "R."
  .. .. .. .. ..$ family : chr "Albert"
  .. .. .. .. ..$ role   : NULL
  .. .. .. .. ..$ email  : NULL
  .. .. .. .. ..$ comment: NULL
  .. .. ..- attr(*, "class")= chr "person"
  .. ..$ journal  : chr "science"
  .. ..$ volume   : chr "286"
  .. ..$ number   : chr "5439"
  .. ..$ pages    : chr "509--512"
  .. ..$ year     : chr "1999"
  .. ..$ publisher: chr "American Association for the Advancement of Science"
  .. ..- attr(*, "bibtype")= chr "Article"
  .. ..- attr(*, "key")= chr "barabasi:1999"
 $ CDC:2019           :Class 'bibentry'  hidden list of 1
  ..$ CDC:2019:List of 7
  .. ..$ author   :Class 'person'  hidden list of 1
  .. .. ..$ :List of 5
  .. .. .. ..$ given  : NULL
  .. .. .. ..$ family : chr "CDC"
  .. .. .. ..$ role   : NULL
  .. .. .. ..$ email  : NULL
  .. .. .. ..$ comment: NULL
  .. ..$ title    : chr "{WISQARS} Leading Causes of Death Reports"
  .. ..$ url      : chr "https://webappa.cdc.gov/sasweb/ncipc/leadcause.html"
  .. ..$ journal  : chr "Centers for Disease Control and Prevention"
  .. ..$ publisher: chr "Centers for Disease Control and Prevention"
  .. ..$ year     : chr "2021"
  .. ..$ note     : chr "Retrieved on April 24, 2021"
  .. ..- attr(*, "bibtype")= chr "Misc"
  .. ..- attr(*, "key")= chr "CDC:2019"
 $ braadvik2018suicide:Class 'bibentry'  hidden list of 1
  ..$ braadvik2018suicide:List of 4
  .. ..$ title    : chr "Suicide Risk and Mental Disorders"
  .. ..$ author   :Class 'person'  hidden list of 1
  .. .. ..$ :List of 5
  .. .. .. ..$ given  : chr "Louise"
  .. .. .. ..$ family : chr "Br\\aadvik"
  .. .. .. ..$ role   : NULL
  .. .. .. ..$ email  : NULL
  .. .. .. ..$ comment: NULL
  .. ..$ year     : chr "2018"
  .. ..$ publisher: chr "Multidisciplinary Digital Publishing Institute"
  .. ..- attr(*, "bibtype")= chr "Misc"
  .. ..- attr(*, "key")= chr "braadvik2018suicide"
 - attr(*, "class")= chr "bibentry"
 - attr(*, "strings")= Named chr(0) 
  ..- attr(*, "names")= chr(0) 

It can be hard to recover them after removal. This part should probably be reported to https://github.com/ropensci/bibtex/issues/.