bookdown
bookdown copied to clipboard
Support underscore in chunk label name with referencing mechanism
From https://github.com/ropensci/targets/discussions/469#discussioncomment-824093
Possibly the only place that we need to modify in bookdown is here if we want to support _:
https://github.com/rstudio/bookdown/blob/c8883c9bbd70400144b396b7cfc66e5e4f2ae8a5/R/latex.R#L117-L130
\@ref(foo_bar) would become @ref(foo\_bar) in .tex output. We need to consider this \ before _.
Related to
- #892,
- #839,
- #157,
- #941,
- #867,
- #406,
- #194
- #336
I've look into this more and it is not as straightforward as I thought. Underscore in LaTeX seems to cause issue, even when escaped by \_ and it is not just a matter of changing the regex.
I can't make it work in LaTeX right now. I'll look again later.