Closed maxpel closed 1 year ago
@yihui I think I can help with this. Changing knitr::set_parent()
to take account of the YAML info of the Rmd file would be enough, correct?
UPDATE The rmarkdown YAML matter is more complicated than the Rnw preamble and is handled in the rmarkdown::render()
. So if we use knitr::set_parent()
, it may only be able to inherit the params
values or some specific settings. Or we can add a new slot in the YAML matter parent: xxx.Rmd
and then it will be handled in the rmarkdown::render()
function instead of in knitr
.
@maxpel After some investigations, I realized that it's rather complicated than I thought. Would you mind give me some hints about what you expect to have from the parent's YAML matters? I think inheriting the param
values should be fine, but I'm not sure if that's enough for your cases.
The best would be if that child just knits as in the parent document but without any of other content in the parent file. I guess having a custom tex template could create problems here (creating a title page for the child for example).
Thanks. Then it looks like we need to define a new entry in the YAML matter and handle this in the rmarkdown::render()
. knitr::set_parent()
doesn't seem the right place to go. However, I may be wrong so let's wait for @yihui 's opinion.
I thought for a while and posted an answer to your SO question: https://stackoverflow.com/a/60083597/559676 You probably don't need my support in knitr.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
From one comment to my SO question (https://stackoverflow.com/questions/59931498/knit-child-documents-in-standalone-mode) I learned that this feature, which is mentioned in the documentation (https://yihui.org/knitr/demo/child/) currently only works for Rnw documents.
Therefore, I would like to file a request for the implementation of this feature with Rmarkdown documents. I would consider this low priority, but I guess it is not hard to do and may come in handy in some situations (like, as in my case, writing my thesis with a lot of chapters that I work on separately).
By filing an issue to this repo, I promise that
xfun::session_info('knitr')
. I have upgraded all my packages to their latest versions (e.g., R, RStudio, and R packages), and also tried the development version:remotes::install_github('yihui/knitr')
.I understand that my issue may be closed if I don't fulfill my promises.