0

I am using Pandoc to process some R Markdown files. These files include citations to works specified in a BibTeX (.bib) file. In the YAML header of the R Markdown file, I specify the path to this file:

bibliography: 'c:/myDir/myRefs.bib'

None of that is problematic. But the .bib file contains a lot of entries that pandoc won't process. Specifically, it contains a lot of entries in which the field names begin with an asterisk. For example:

@ARTICLE{Smith_Hello_2021,
  AUTHOR  = {John Smith},
  TITLE   = {Some Title},
  JOURNAL = {Some Journal},
  YEAR    = {2021},
  volume =  {1},
  number =  {1},
  pages =   {1-2},
  *month =  {},
}

The problem is the *month field. I often add an asterisk to the start of field names when I don't want them to be processed by BibTeX; I have hundreds of .bib entries like this. When Pandoc comes across such an entry, it gives me this error message:

Error reading bibliography file c:/myDir/myRefs.bib:
(line 54, column 3):
unexpected "*"
expecting space, white space or "}"
Error: pandoc document conversion failed with error 25
Execution halted

Is there any workaround, short of removing the asterisks from my .bib file?

user697473
  • 2,165
  • 1
  • 20
  • 47
  • 1
    Field names beginning with an asterisk are malformed. Have you tried using underscore instead? AFIK, BibTeX ignores fields i does not recognize. – zkoza Mar 28 '21 at 19:46
  • Thank you. Replacing the asterisks with underscore characters seems to do the trick. bibtex has no problem processing field names that begin with asterisks (and ignoring them, as I want it to). But pandoc chokes on the asterisks. And both bibtex and pandoc accept the underscore characters. – user697473 Mar 28 '21 at 19:57

0 Answers0