如何适合PDF中的广泛输出?
I am trying to print str(df) in pdf output of rmarkdown. How do I fit the wide output in pdf?
str(df)
对于PDF输出而言,包裹线路有点棘手。一个选项是使用乳胶软件包列表。我将使用mtcars数据集作为示例。您的rmarkDown应通过pandoc参数- listings这样的启用包:
列表
mtcars
- listings
--- title: "Test" output: pdf_document: pandoc_args: --listings includes: in_header: preamble.tex --- ```{r, echo=FALSE, warning=FALSE, message=FALSE} options(width = 300) str(mtcars) ```
在preamble.tex中,您在另一个文件中设置了该软件包的选项:
preamble.tex
\lstset{ breaklines=true basicstyle=\ttfamily }
这是输出:
有关更多信息,请访问此链接: httpps ://bookdown.org/yihui/rmarkdown-cookbook/text-width.html
For PDF output is a bit trickier to wrap lines. One option is using the LaTeX package listings. I will use mtcars dataset as example. Your Rmarkdown should enable the package via the Pandoc argument --listings like this:
listings
--listings
In preamble.tex, you set an option of the package in a different file:
This is the output:
For more info check this link: https://bookdown.org/yihui/rmarkdown-cookbook/text-width.html
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(1)
对于PDF输出而言,包裹线路有点棘手。一个选项是使用乳胶软件包
列表
。我将使用mtcars
数据集作为示例。您的rmarkDown应通过pandoc参数- listings
这样的启用包:在
preamble.tex
中,您在另一个文件中设置了该软件包的选项:这是输出:
有关更多信息,请访问此链接: httpps ://bookdown.org/yihui/rmarkdown-cookbook/text-width.html
For PDF output is a bit trickier to wrap lines. One option is using the LaTeX package
listings
. I will usemtcars
dataset as example. Your Rmarkdown should enable the package via the Pandoc argument--listings
like this:In
preamble.tex
, you set an option of the package in a different file:This is the output:
For more info check this link: https://bookdown.org/yihui/rmarkdown-cookbook/text-width.html