1

Is there any code I can enter that will force any long code or comments, when knitted to pdf, to not be written off the page when I knit to pdf.

See image for example

enter image description here

user20650
  • 24,654
  • 5
  • 56
  • 91
  • You can always wrap the line of code so that it does not exceed the margins in the pdf file. Just wrap the code line after `regamerica+`. – dcarlson Dec 22 '19 at 21:29
  • Of course, I'm just wondering if there is a code that automatically sets max width of the pdf document. When it's a long document its annoying, so I'm just wondering if there is a way to be more efficient. – Joseph Sandor Dec 22 '19 at 21:36
  • see [here](https://stackoverflow.com/questions/26210656/in-r-markdown-in-rstudio-how-can-i-prevent-the-source-code-from-running-off-a-p) – G. Cocca Dec 22 '19 at 22:42
  • I think there are packages which will wrap long lines for you in the code itself. Here might be a start. I think they are referenced in the intro: https://style.tidyverse.org/ –  Dec 22 '19 at 22:48
  • @G.Cocca ; I think the issue with that solution is that it can't break big long strings, as you may find in a formula -- [old but possibly still related](https://github.com/rstudio/rmarkdown/issues/646#issuecomment-219256078) – user20650 Dec 22 '19 at 22:50

0 Answers0