Open lcolladotor opened 6 years ago
Hi Leo, thanks for reporting this. Actually, the problems you are experiencing might indicate an issue with bookdown responsible for managing references, as the following doesn't produce links either.
---
title: "Cross-referencing multiple figures"
output:
bookdown::html_document2
---
References to Figure \@ref(fig:plot1) and Figure \@ref(fig:plot2).
```{r plot, fig.cap=c("First", "Second"), fig.pos="h"}
plot(cars)
plot(faithful)
```
For some reason the former approach described in https://github.com/rstudio/bookdown/issues/343 doesn't work anymore. Do you happen to know which was the last bookdown version which was fine?
Hi Andrzej,
Thanks for looking into this! From http://bioconductor.org/help/workflows/recountWorkflow/ I believe that it still worked with bookdown
version 0.5. My current version is 0.7. It's not the most narrow clue but hopefully it helps.
Best, Leo
Hi,
In previous versions I was able to use
\@ref(fig:chunkname1)
and\@ref(fig:chunkname2)
if a single Rmd chunk (here calledchunkname
) generated two plots. In the current devel version (2.7.8) this doesn't work.You can see an example at http://research.libd.org/recount-brain/example_SRP027383/example_SRP027383.html that matches this commit https://github.com/LieberInstitute/recount-brain/commit/614316ab53b37025545078dfbbb04e9a979678b4. I include a screenshot here for simplicity.
I also tried using
\@ref(fig:chunkname-1)
and it failed. Note that\@ref(fig:chunkname)
did work, but it doesn't make sense to me to reference several figures with the same number (even if they come from the same code chunk) as in:.
I guess that I could use
\@ref(fig:chunkname)-1
and\@ref(fig:chunkname)-2
although the links won't point to the correct location.Is is still possible to reference multiple plots from the same chunk? Maybe there's a new syntax that I'm missing. There are cases where I can't break the code and separate the code so that each code chunk makes a single figure. For example, when a function makes more than 1 plot.
Thanks! Leo