bbartholdy / endgame

Semi-continuous deployment of my PhD dissertation
https://myphd.netlify.app
Creative Commons Attribution 4.0 International
7 stars 0 forks source link

Including articles as chapters #2

Open bbartholdy opened 2 years ago

bbartholdy commented 2 years ago

Need to find a way to include articles as chapters without (or with limited) copy-paste.

bbartholdy commented 2 years ago

The current solution:

Include the article as a git submodule. Each section in the article has its own .Rmd or .qmd file. These are included in the chapter by using the include shortcode {{< include path/to/file.ext >}}. This has the benefit of executing any R code, both chunks and inline, that is included in the file and rendering it properly in the chapter.

issue with current solution:

The articles use the here() function to sort out the file paths relative to the project root. When included in the chapters, the here() functions start at the project root of the dissertation, not the articles, causing the filepaths to break.

bbartholdy commented 2 years ago

Issue with here() has been resolved by including a code chunk at the top of the chapter .qmd/.rmd file. The current issue is that the shift-heading-level-by: 1 only works for html output and not pdf output. The pdf output retains the original heading levels from the chapter document, meaning the section headers from the article are rendered as individual chapters in the book.

bbartholdy commented 2 years ago

Solution recommended by Quarto team: https://github.com/quarto-dev/quarto-cli/discussions/1635

Shift heading levels via a lua filter.