https://github.com/crsh/citr
RStudio Addin to Insert Markdown Citations from a BibTeX file or Zotero
Science Score: 23.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
○DOI references
-
○Academic publication links
-
✓Committers with academic emails
3 of 9 committers (33.3%) from academic institutions -
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (14.7%) to scientific vocabulary
Keywords
bib
bibliographies
insert-markdown-citations
rstudio-addin
Keywords from Contributors
ropensci
tidy-data
pandoc
geo
setup
literate-programming
rmarkdown
book
latex
visualisation
Last synced: 6 months ago
·
JSON representation
Repository
RStudio Addin to Insert Markdown Citations from a BibTeX file or Zotero
Basic Info
Statistics
- Stars: 410
- Watchers: 8
- Forks: 48
- Open Issues: 31
- Releases: 4
Topics
bib
bibliographies
insert-markdown-citations
rstudio-addin
Created over 9 years ago
· Last pushed over 2 years ago
Metadata Files
Readme
Changelog
License
README.Rmd
---
title : "citr: RStudio Addin to Insert Markdown Citations"
output : github_document
---
[](https://cran.r-project.org/package=citr) [](https://cran.r-project.org/package=citr)
[](http://www.repostatus.org/#active)
[](https://travis-ci.org/crsh/citr)
`citr` provides functions and an [RStudio addin](https://rstudio.github.io/rstudioaddins/) to search a BibTeX-file to create and insert formatted Markdown citations into the current document.
## Installation
You can either use the stable version of `citr` from CRAN,
~~~r
install.packages("citr")
~~~
or the current development snapshot from this GitHub repository:
~~~r
devtools::install_github("crsh/citr")
~~~
## How to use citr
### The RStudio addin
Once `citr` is installed and you have restarted your R session, the addin appears in the menus.
Alternatively, you can define a [keyboard shortcut](https://rstudio.github.io/rstudioaddins/#keyboard-shorcuts) to call the addin.

The addin will automatically look up the bibliography files specified in the YAML front matter.
If the document does not contain a YAML front matter the addin will attempt to locate a parent document and look up the bibliography file specified therein.
That is, the addin works its automagic even if you edit R Markdown documents that are included as [children](http://yihui.name/knitr/demo/child/) in another R Markdown document.
The expected names of a parent document default to `c("index.Rmd", "master.Rmd")`, it thus works with [`bookdown`](https://bookdown.org/) out of the box, but can be customized (e.g., `options(citr.parent_documents = "my_parent.Rmd")`).
### Using citr without RStudio
The following call searches a bibliography file and creates formatted Markdown citations for the results.
~~~r
library("citr")
md_cite("foo 2016", bib_file = "references.bib")
~~~
`md_cite()` searches the author, year, title, and journal fields of your references.
### Better BibTeX integration
If you are using Zotero `citr` can access your reference database directly.
For this to work, you need to install the [Better BibTeX extension](https://github.com/retorquere/zotero-better-bibtex/wiki).
Once the extension is installed and your reference manager is running, `citr` can access all your references and keep your bibliography file updated by adding missing references.

### Tidying bibliography files
When you are done writing, your bibliography file is likely to contain some unneeded references, which you added while writing but removed during revisions.
`tidy_bib_file()` removes unneeded (or duplicate) entries from your bibliography file.
~~~r
tidy_bib_file(
rmd_file = "report.Rmd"
, messy_bibliography = "references.bib"
, file = "tidy_references.bib"
)
~~~
## Known problems
`citr` relies on `RefManager::ReadBib()` and, thus, indirectly on `bibtex::read.bib()` to load bibliographies.
I have noticed that very long Bib(La)TeX fields can cause these underlying functions to fail (e.g., `Error in do_read_bib(file, encoding = .Encoding, srcfile): lex fatal error: input buffer overflow, can't enlarge buffer because scanner uses REJECT`).
To avoid such problems, I strongly recommend to disable the export of potentially long metadata fields, such as abstract and notes.
The Better BibTeX-plugin allows users to specify fields to omit:

Once, the above error has occurred, it may be necessary to restart the R session.
Otherwise reading any other file may fail with `Error: lex fatal error: fatal flex scanner internal error--end of buffer missed`.
## Other RStudio addins
If you are interested in other handy addins take a look at this [list](https://github.com/daattali/addinslist#readme). There you can find other useful addins, such as [rcrossref](https://github.com/ropensci/rcrossref) or [wordcountaddin](https://github.com/benmarwick/wordcountaddin).
# Package dependencies
```{r dependency_plot, echo = FALSE, fig.width = 7, fig.height = 5, message = FALSE, warning = FALSE, fig.path = "tools/images/"}
source("https://gist.githubusercontent.com/crsh/c906e93c260488e7363ea606243057c2/raw/f6f0fce38bc274446d205854ea35cfa03b9b1f7a/plot_dependencies.R")
plot_dependencies()
```
Owner
- Name: Frederik Aust
- Login: crsh
- Kind: user
- Location: Cologne, Germany
- Company: Psychological Methods, University of Amsterdam
- Website: https://frederikaust.com/
- Twitter: FrederikAust
- Repositories: 18
- Profile: https://github.com/crsh
GitHub Events
Total
- Watch event: 6
- Fork event: 2
Last Year
- Watch event: 6
- Fork event: 2
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Frederik Aust | f****t@u****e | 90 |
| Ilse Pit | i****t@g****m | 6 |
| Vilmantas Gegzna | G****V@g****m | 3 |
| Robin Lovelace | r****x@g****m | 3 |
| Yihui Xie | x****e@y****e | 1 |
| TobiasHeycke | t****e@u****e | 1 |
| Miles McBain | m****n@g****m | 1 |
| Mara Averick | m****k@g****m | 1 |
| Garrick Aden-Buie | g****e@m****u | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 9 months ago
All Time
- Total issues: 85
- Total pull requests: 11
- Average time to close issues: 3 months
- Average time to close pull requests: 13 days
- Total issue authors: 61
- Total pull request authors: 8
- Average comments per issue: 4.66
- Average comments per pull request: 2.0
- Merged pull requests: 10
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- crsh (10)
- Robinlovelace (5)
- koliajaykr (3)
- jooyoungseo (3)
- andreifoldes (2)
- awmercer (2)
- nevrome (2)
- bwiernik (2)
- heinonmatti (2)
- ogsteele (1)
- julou (1)
- profandyfield (1)
- llrs (1)
- statzhero (1)
- sebacea (1)
Pull Request Authors
- ilsePit (4)
- MilesMcBain (1)
- batpigandme (1)
- yihui (1)
- gadenbuie (1)
- Robinlovelace (1)
- TobiasHeycke (1)
- GegznaV (1)
Top Labels
Issue Labels
bug (18)
enhancement (17)
more-information-needed (5)
question (4)
upstream (3)
help wanted (1)
Pull Request Labels
Packages
- Total packages: 1
- Total downloads: unknown
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 5
proxy.golang.org: github.com/crsh/citr
- Documentation: https://pkg.go.dev/github.com/crsh/citr#section-documentation
- License: other
-
Latest release: v0.3.2
published over 6 years ago
Rankings
Dependent packages count: 5.5%
Average: 5.7%
Dependent repos count: 5.9%
Last synced:
6 months ago
Dependencies
DESCRIPTION
cran
- R >= 3.0.0 depends
- RefManageR >= 0.14.2 imports
- assertthat >= 0.1 imports
- bibtex >= 0.4.2.2 imports
- curl >= 1.1 imports
- httr >= 1.3.1 imports
- methods >= 3.0.0 imports
- miniUI >= 0.1.1 imports
- rstudioapi >= 0.6 imports
- shiny >= 0.13.2 imports
- shinyjs >= 1.0 imports
- yaml >= 2.1.13 imports
- testthat >= 1.0.2 suggests