Closed michaelaklin closed 1 year ago
@michaelaklin thanks for the report.
I've tested it out and can confirm an issue with the StackOverflow suggestion. However, bibtex
does not have a custom print style for citations. Instead, bibtex
interprets the bibliography file and places it into the bibentry
class, which is part of the utils
package.
Thus, I think you can fix the issue by switching from:
`r capture.output(refs["BusemeyerTober2022"])`
to
`r format(refs["BusemeyerTober2022"], style = "text")`
Note, we're using the utils:::format.bibentry(entry, style = "text")
to correctly set the output display.
For completeness, please feel free to see the reprex
.
Please let me know if this works and I'll close out the ticket.
Wonderful, this works like a charm. Thanks a lot!
Thanks for this terrific package!
I ran into something that seems like a bug, but I can't quite figure out where it comes from. I'm using bibtex (your package) to generate full citations in the body of the text in RMarkdown. However, when I generate the final document (a pdf, but the problem appears when I try other formats like html), some citations include commas that don't exist in the bib file.
Here's a simple example.
My rmd file (inspired by an earlier stack overflow suggestion here):
minimalbib.bib contains the following:
The pdf (and html) renders the following:
Note two new commas: one after the colon ("Change:, Social") and one in the name of the journal ("_Comparative, Political").
Yet when I check the citation in the R console, I get the correct markdown code:
I would add that it doesn't affect all references (eyeballing my file, I would say about 1 in 4). I don't know if I'm doing something wrong, if rmarkdown is causing the problem, or if there's a bug, but I was wondering if anyone had an idea of what's happening here. Thanks!