Replies: 3 comments 5 replies
-
Note that
This being said, I don't know a simple way to do what you want. Maybe the future work tracked in #6518 could help with this in the future. |
Beta Was this translation helpful? Give feedback.
-
Thanks for this reply, and for those pointers to the I guess, for my use case, I'll go with manually resetting |
Beta Was this translation helpful? Give feedback.
-
As a really ugly workaround, you could write the current chapter number to a tmp file, and use that value to set the fig path,
(with suitable pre/post-render script to delete the counter file) Obviously this relies on quarto processing files in the same order as you want, but presumably your naming convention will do that. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
For a Quarto book project, I'm generating many figures, currently all sent to a single folder, using the knitr
fig.path
option/A file,
common.R
containing this code is sourced at the start of every chapter, viaI would like to be able to set the
fig.path
on a chapter basis, eg, tofigs/ch01/
,figs/ch02/
... I know I can do this by modifying the initial chunk for each chapter toBut is there any way I can capture the chapter number in my
common.R
script and have it work for all chapters?I'm thinking somehow to use
basename()
of the current .qmd file, e.g.,01-intro.qmd
and extract the chapter number from that.Or else, is there a chapter counter I could access?
Beta Was this translation helpful? Give feedback.
All reactions