bookdown icon indicating copy to clipboard operation
bookdown copied to clipboard

Support underscore in chunk label name with referencing mechanism

Open cderv opened this issue 4 years ago • 2 comments

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

cderv avatar Jun 04 '21 08:06 cderv

Related to

  • #892,
  • #839,
  • #157,
  • #941,
  • #867,
  • #406,
  • #194
  • #336

cderv avatar Jun 10 '21 16:06 cderv

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.

cderv avatar Jun 10 '21 18:06 cderv