Open dmi3kno opened 2 years ago
Just commenting that that's an extremely frustrating design choice on the part of Quarto to co-opt the syntax that is already in wide use for citations for a different purpose
May I also suggest that while we're on it, we improve the error message? Instead of "Error: not found: fig-cars". it should say: "RBBT error when parsing example.qmd: the key @fig-cars was not found in Zotero database. If this is not a bibliography key, remember to add it to the vector of ignored keys" or something along these lines.
Could we, please, talk about this? I am exempting all of the keys used for cross-referencing listing them in ignore
argument of bbt_write_bib()
but since the prefixes are standardized I see no reason why c("^fig-", "^tbl-", "^eq-", "^sec-", "^lst-", "^thm-")
can not be exempted automatically.
This is becoming slightly urgent. Rstudio Visual Editor is getting really slowed down by large Zotero collections, as reported in this issue (rstudio/rstudio#9878). My preferred way of inserting references is through {rbbt} add-in ("Update bibliography for current document from Zotero"), partially because it does not require loading the Visual Editor (and it is talking to my Zotero much faster).
But now all of the @fig-something and @tbl-something in the text are causing errors because {rbbt} does not except them. Could we please provide the list of excepted prefixes for example in options()
?
I second the request for adding a list of excepted prefixes. fwiw, my current workaround is to
rbbt::bbt_update_bib("filename.qmd")
, now that it'll ignore all instances of "xyzfig-"rbbt::bbt_update_bib("filename.qmd")
so that it won't run again when renderingNow when rendering, rbbt
isn't doing anything because I've commented out bbt_update_bib()
, so there's no conflict between rbbt
and the Quarto cross-references. It works, but isn't optimal.
The magic happens here:
https://github.com/paleolimbot/rbbt/blob/master/R/detect-citations.R#L36-L58
I don't have a set up anymore where I can test this but am happy to review a better set of regexes for detecting or excluding citation! It sounds like something as simple as stringr::str_subset(refs, "@(fig-|tbl-)", negate = TRUE)
might work at the end of that function.
I pushed the PR #42 which should close this issue
Quarto plans to discontinue inline expressions in YAML (see quarto-dev/quarto-cli#6189). They recommend using pre-render scripts instead. There are more tips in the referenced closed issue.
For now, make sure you add engine: knitr
In Quarto internal references are now "bare" i.e. not prepended by
/@ref()
. Quarto website explainsI don't have a solution in mind other than creating a "whitelist" of references, which RBBT skips. So far we have
c("^fig-", "^tbl-", "^eq-", "^sec-", "^lst-", "^thm-")
.Could we allow the
ignore
argument inrbbt::bbt_write_bib()
to take regex? Then this vector of extensions could be made the default value. Today you are doingsetdiff()
without validating theignore
vector.https://github.com/paleolimbot/rbbt/blob/7c76fcca8ff29e4554910e631bfe24ffe5aac2de/R/write-bib.R#L45-L46