benmarwick / rrtools

rrtools: Tools for Writing Reproducible Research in R
Other
670 stars 85 forks source link

Separate figure numbering in the main manuscript from Supplementary figures. #104

Open wolass opened 4 years ago

wolass commented 4 years ago

Please wait for some discussion of your request before making a Pull Request.

Is your feature request related to a problem? Please describe. When authoring papers in the rrtools pipeline I end up producing a one DOCX file with all the figures included. The problem is that the numbering of the figures is consecutive for supplementary figures and I always have to post-process the file by hand in order to correct numbering of supplementary figures (as these usually start with Suppl. Fig 1).

Describe the solution you'd like I would like to separate the numbering of main figures from the supplementary figures. Preferably we could use something like \@ref(sfig:supplementaryfigurexyz)

Describe alternatives you've considered I have posted this problem on the Stackoverflow page https://stackoverflow.com/questions/57753758/how-to-add-a-cross-reference-supplementary-figures-in-bookdown-knitr-rmarkdown

but with no luck ...

do we have a unified approach for this issue that can be used in the rrttools pipeline?

Additional context

benmarwick commented 4 years ago

Interesting question! I can see the need for this functionality, but no obvious solution springs to mind. Perhaps it can be achieved with parent-child Rmd documents, and a method that auto-prefixes figures numbers for figures generated by code in the child documents?

benmarwick commented 4 years ago

Perhaps the best solutions to this will come from the bookdown pkg directly, or the user's workflow (for example, two DOCX output files instead of one)

benmarwick commented 6 months ago

I think the best solution to this lies outside of rrtools.

wolass commented 6 months ago

With the new update of quarto 1.5 there is a new feature allowing custom crossref. This allowed me to have one paper.qmd including main and supplementary figures.

The code is being developed right now, and to crossrefence a suppfig we need to use fenced divs

See this issue here

https://github.com/quarto-dev/quarto-cli/issues/8956


::: {#suppfig-suplementary1}

```{r}
Figure code

Figure caption

:::



But it works! 

I think we can have this functionality finally implemented into rrtools.

I will wait a bit to see if the quarto devs are going to make the code easier that will not required the use of fenced divs and update the paper.qmd template soon. 

Think we can reopen this issue
benmarwick commented 5 months ago

Very interesting! Thanks for sharing the details of this development. Have your seen the quarto "manuscript" format?

wolass commented 5 months ago

Yes, but I still use rrtools qmd templates for the paper, because they are fitting my workflow more closely.

benmarwick commented 5 months ago

Yes, right, good to know. I'm not sure what the Posit team had in mind when they designed that manuscript format. Doesn't seem targeted for producing manuscripts for submission to journals, which is what I was expecting. Perhaps they are hoping a journal will adopt their format, and then require authors to use it? If so, I guess you and I are not the target audience!