Wrap source code in pdf_document

I would like to know if there is a way to force R to break the lines of R code in order to avoid the issue showed on the enclosed picture. Also possible it for the output?


thank you for your answer in advance,

Hi @Marcell,

Are you rendering a R Markdown file to pdf_document? If so a knit_hook might solve that issue. There may be a more straightforward way that I haven't thought of yet.

Hi @Marcell,
You can add tidy = TRUE as a chunk hook to wrap long lines of code, or as @mattwarkentin suggested, set a default knit_hook for all chunks. Further details can be found at the Rmarkdown cookbook.


This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.