Giter VIP home page Giter VIP logo

Comments (2)

coatless avatar coatless commented on June 20, 2024

@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.

Debug RMD file
---
title: "Debug Commas"
author: "JJB"
output: html_document
---


```{r}
library("bibtex")

my_ref <- "@article{BusemeyerTober2022,
author = {Marius R. Busemeyer and Tobias Tober},
journal = {Comparative Political Studies},
pages = {00104140221139381},
title = {Dealing with Technological Change: Social Policy Preferences and Institutional Context},
year = {2022}}"

# Need to check by writing first
tmp1 <- tempfile(fileext = ".bib")
writeLines(my_ref, tmp1)

# And reading from the temp file
out <- read.bib(tmp1)
```

```{r}
out["BusemeyerTober2022"]
```

## Capture Output

`r capture.output(out["BusemeyerTober2022"])`

## Format Output

`r format(out["BusemeyerTober2022"], style = "text")`

Please let me know if this works and I'll close out the ticket.

from bibtex.

michaelaklin avatar michaelaklin commented on June 20, 2024

Wonderful, this works like a charm. Thanks a lot!

from bibtex.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.