简体   繁体   中英

RStudio, knitr, pandoc, Word: how do I get a 'new page' in my docx?

I am using the RStudio, knitr, pandoc, MS Word combo to get my final results in a docx document.

Occasionally, I would like the report to continue on a new page. I can't find the way to achieve this.

From what I have Googled, it seems to be possible with CSS . I don't know HTML or CSS , but if it is the solution I will learn. Just don't want to take the wrong road...

Try the LaTeX command \\newpage. Pandoc recognizes it and might (not on a computer right now) translate it to a Word page break.

​```{=openxml}
<w:p>
  </w:pPr>
    <w:r>
      <w:br w:type="page"/>
    </w:r>
</w:p>
​```

Insert this codes in the position of new page you wanted in the .RMD file, and knit the file to word file. It will be translated into a new page break by pandoc, just like a \\newpage command using $Latex$.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM