bookdown icon indicating copy to clipboard operation
bookdown copied to clipboard

[FR] Add prefixes to cross-references

Open malcolmbarrett opened this issue 4 years ago • 5 comments

I would really like a way to prepend cross-references automatically with a prefix, e.g., if I use the prefix “Figure”, I see \@ref(fig:chunk-name) rendered as Figure n.

I know I can do it manually, e.g. Figure \@ref(fig:chunk-name), but it would be nice to be able to automate!

malcolmbarrett avatar Jun 02 '21 15:06 malcolmbarrett

I am currently writing a bookdown book which already has >400 pages. It has numerous theorem and proof chunks, and since a couple of days these do not work any more (Rstudio 1.4.1717, latest bookdown from Github, OS X Big Sur 11.5 beta). For some reason numerous \iffalse ... \fi are inserted, even in the gitbook output format. See example .Rmd file (disguised as .txt).

index.txt

deleeuw avatar Jun 04 '21 02:06 deleeuw

@deleeuw please open a new issue - this is not directly related to this feature request. Let's keep things clean and discussion in thread bound to one topic.

Please open a new issue and provide all the useful information. BTW you can include attachment using a zip file which prevent doing any disguise. You can also paste the Rmd directly in the issue https://yihui.org/issue/#please-format-your-issue-correctly

cderv avatar Jun 04 '21 08:06 cderv

@cderv This indeed needs to be a new issue instead of a reply, but I just tried @deleeuw's example and it was actually reproducible to me. If you have a chance, could you take a quick look and see if you can figure out what went wrong (possibly in the recent release of bookdown)?

On the other hand, @deleeuw you could try to switch to the new syntax for theorems: https://bookdown.org/yihui/bookdown/markdown-extensions-by-bookdown.html#theorems (Section 2.2.2.1 has instructions on the conversion from the old to new syntax)

yihui avatar Jun 14 '21 16:06 yihui

Thanks @yihui. Sorry for the delay on this.

@deleeuw I opened a new issue in #1178 where we can follow up. There is indeed a bug we'll fix quickly. Thanks for the report!

cderv avatar Jun 14 '21 16:06 cderv

I would also like to ask for this feature, I thought this is what the label option under language might do (specially if provided with a function) but it doesn't seem to work: https://community.rstudio.com/t/changing-labels-of-cross-references-on-bookdown/126621. Thanks in advance for all the work on making it easier to write and publish documents with mixed content.

llrs avatar Jan 19 '22 14:01 llrs