latexr-markdownrstudiopandocbookdown

How do you change one A4 (portrait) page in rmarkdown-pandoc to A3 (landscape) without inserting a separately generated document?


I have a large table that I need to fit in a PDF LaTEX document that is generated ("Knitted") using rmarkdown (specifically bookdown and pandoc, within rstudio) and I think it can only fit on a landscape A3 page.

I have seen potential solutions that required a separately generated PDF page be inserted, but I would like the solution to be self-contained to the rmarkdown document.

I would also like to keep the rest of the PDF document at an A4 size (I do have some other pages that are landscape, but they are also A4).

Can provide additional details on request,

Appreciate any ideas - thanks!

EDIT: Header and output information added below as requested.

title: "Title"
subtitle: "Subtitle"      
author: "NAME"
date: "DATE"
output:
  bookdown::pdf_document2:
    highlight: haddock
    number_sections: yes
    toc: yes
    keep_tex: true
    toc_depth: 4
geometry: "left=1.6cm,right=1.6cm,top=1.6cm,bottom=3.2cm"

Solution

  • You could use the typearea package:

    ---
    title: "Title"
    subtitle: "Subtitle"      
    author: "NAME"
    date: "DATE"
    output:
      bookdown::pdf_document2:
        highlight: haddock
        number_sections: yes
        toc: yes
        keep_tex: true
        toc_depth: 4
    geometry: "left=1.6cm,right=1.6cm,top=1.6cm,bottom=3.2cm"
    header-includes:
     - \usepackage[paper=A4]{typearea}
    ---
    
    test
    
    \KOMAoptions{paper=A3}
    \recalctypearea
    
    something
    
    \KOMAoptions{paper=A4}
    \recalctypearea
    
    else
    

    enter image description here