rofficedown

How can I create a single paged landscape document in officedown?


Intuitively, I would have thought that I just start and stop a landscape block. However, the landscape tags are introducing page breaks, hence creating a three page document where I only want one. Any ideas how I can create a single paged landscape document in officedown?

---
output:
  officedown::rdocx_document:
    base_format: "rmarkdown::word_document"
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(officedown) # 0.3.0
```

<!---BLOCK_LANDSCAPE_START--->

# A headline

And some text.

<!---BLOCK_LANDSCAPE_STOP--->

Solution

  • You can set the default orientation for the document in the YAML via page_size. However, to make this work I had to set the page_margins too, at least on one side, e.g. in the code below I opted for bottom.

    ---
    output:
      officedown::rdocx_document:
        page_size:
          orient: "landscape"
        page_margins:
          bottom: 1
    ---
    
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = FALSE)
    library(officedown)
    ```
    
    # A headline
    
    And some text.
    

    enter image description here