Is there an option to control output page orientation (using knitr->pander->pandoc->docx)

前端 未结 2 940
一个人的身影
一个人的身影 2021-02-13 16:53

I am playing with Tal\'s intro to producing word tables with as little overhead as possible in real world situations. (Please see for reproducible examples there - Thanks, Tal!)

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-13 17:19

    Based on Taleb's answer here and some officer package functions, I created a little gist that one can use like this:

    ---
    title: "Example"
    author: "Dan Chaltiel"
    output: 
      word_document:
        pandoc_args:
         '--lua-filter=page-break.lua'
    ---
    
    I'm in portrait
    
    \endLandscape
    
    I'm in landscape
    
    \endPortrait
    
    I'm in portrait again
    

    With page-breaks.lua being the file hosted here: https://gist.github.com/DanChaltiel/e7505e62341093cfdc489265963b6c8f

    This is far from perfect (for instance it won't work without the last portrait section), but it is quite useful sometimes.

提交回复
热议问题