FredHutch / VISCtemplates

Tools for writing reproducible reports at VISC
Other
6 stars 2 forks source link

Hotfix: change \newpage to \clearpage #216

Closed kelliemac closed 1 month ago

kelliemac commented 1 month ago

Description

Yung-Wen noticed an issues with two figures being crammed onto the same page and running off the page when using the latest VISCtemplates to render a previous PT report. I was able to reproduce the issue and trace it to a limitation of the \newpage command that is now being used by insert_break(). Changing \newpage to \clearpage resolves the issue.

Helpful explanation of the differences between \newpage and \clearpage: https://tex.stackexchange.com/questions/497746/comparison-between-newpage-clearpage-and-pagebreak-etc

Checklist

slager commented 1 month ago

After updating the templates to use \clearpage, I can see that using \clearpage appears to make the page breaks non-functional in Word output.

\newpage was supposed to work for everything, see here: https://bookdown.org/yihui/rmarkdown-cookbook/pagebreaks.html#pagebreaks

slager commented 1 month ago

Trying it conditionally depending on output type. This works for me locally @kelliemac. If this also works on CI, then maybe the only thing still needed here is updating the instructions in the vignette before doing a patch release.

slager commented 1 month ago

Kellie was able to successfully test that this fixes the broken report in question, and I have added instructions to the vignette.