美文网首页
R语言markdown文件导出pdf的一些零散知识点

R语言markdown文件导出pdf的一些零散知识点

作者: 小明的数据分析笔记本 | 来源:发表于2022-04-04 02:01 被阅读0次
image.png image.png image.png

如果pdf文件里需要用中文需要再表头上添加两行代码

header-includes:
  - \usepackage{ctex}

具体是什么意思我没有看明白

代码块里如果单行代码过长需要换行,可以添加代码

output: 
  beamer_presentation:
    pandoc_args: --listings
    includes:
      in_header: listings-settings.tex

listings-settings.tex 文件在当前目录下,文件内容是

\lstset{
    breaklines=true,
    basicstyle=\ttfamily
}

这里参考 https://d.cosx.org/d/422430-r-markdown/2
但是这个代码和前面需要使用中文的代码不能同时使用,暂时搞不懂是什么原因

image.png

{r,echo=FALSE,message=FALSE,results='hide'}

这里echo=TRUE是显示代码
results='hide'是将代码运行结果隐藏
message=FALSE 隐藏代码运行过程中的一些信息

相关文章

网友评论

      本文标题:R语言markdown文件导出pdf的一些零散知识点

      本文链接:https://www.haomeiwen.com/subject/danqsrtx.html