Open DanChaltiel opened 3 years ago
That is an interesting idea! Thanks for sharing.
The name \pagebreak
or \newpage
is inspired by the LaTeX command and the filter makes it available for different format. This feature is definitely interesting for word output though. Not sure if we could make it available for other printable output.
For reference, this can of Word customization is already easily possible using the great officedown package, which offert landscape mode switch and is compatible with R Markdown pagebreak feature. Try:
---
author: 'Bruce'
date: '0189-12-27'
output:
officedown::rdocx_document: default
---
This is in portrait
<!---BLOCK_LANDSCAPE_START--->
This is a landscape section.
\newpage
And another landscape page
<!---BLOCK_LANDSCAPE_STOP--->
We're back in portrait
So, for anything Word specific, I am always wondering what should be in rmarkdown or stay in the custom output format package.
About the naming of commands, another idea would be to use fenced div. This would work the same by adding the correct raw content at start and end of the divs.
---
title: "test"
output:
word_document:
pandoc_args: ["--lua-filter=inst/rmarkdown/word-landscape.lua"]
---
# Part 1
I am in portrait
::: landscape-layout
## Part 2
I am in landscape
:::
## Part 3
I am in portrait again
Just sharing thoughts and references to think about this feature.
I just realized that Word documents page breaks are now natively supported in Rmarkdown (since v2.4), so I wondered if you would also add support for orientation control.
I've already been using some functions for this from my old gist (and some SO help) for a couple of years and they proved really useful.
Here is some code (but it will obviously only work with the entire gist):
Lua
RMarkdown
The naming comes from an old logic ("end section and start landscape --> endLandscape") and may not make much sense, feel free to use better names.
Also, note that starting directly by
\endLandscape
will not work, but I think this is a Word limitation.Hope it helps
By filing an issue to this repo, I promise that
xfun::session_info('rmarkdown')
. 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('rstudio/rmarkdown')
.I understand that my issue may be closed if I don't fulfill my promises.