Ale*_*era 3 pdf pdf-generation r r-markdown
我目前正在使用Rmarkdown
on处理 pdf 文档,RStudio
但我对如何自定义 YAML 部分感到非常困惑。这是我的实际代码:
---
title: "The very basics of R"
author: "Alejandro C."
date: "March, 2020"
output:
pdf_document:
latex_engine: xelatex
toc: true
mainfont: Times New Roman
fontsize: 12pt
header-includes:
- \usepackage{titling}
- \pretitle{\begin{flushleft}}
- \posttitle{\end{flushleft}}
- \preauthor{\begin{flushleft}}
- \postauthor{\end{flushleft}}
- \predate{\begin{flushleft}}
- \postdate{\end{flushleft}}
---
Run Code Online (Sandbox Code Playgroud)
我想要实现的是以下内容:
我是这个话题的新手,所以除了R Markdown Reference Guide之外,我真的不知道从哪里开始。任何帮助和建议将不胜感激。
您可以LaTeX
在 YAML 部分中包含命令,以便您可以更改字体的大小、形状和外观。请注意,您需要\
在 YAML 部分复制(反斜杠)。
在下面的 MWE 中,使用了以下命令:
\textit{}
\\textit{}
在 YAML 中\textbf{}
\\textbf{}
在 YAML 中\fontsize{14pt}{3pt}\\selectfont
\\fontsize{14pt}{3pt}\\selectfont
在 YAML 中正如@Marius here所建议的那样,您可能希望在简单的降价语法之外进一步自定义输出。所以,最好设置keep_tex: true
为这样的场合。
---
title: "\\fontsize{14pt}{3pt}\\selectfont \\textbf{\\textit{The very basics of R}}"
author: "\\fontsize{12pt}{3pt}\\selectfont Alejandro C."
date: "\\fontsize{12pt}{3pt}\\selectfont March, 2020"
output:
pdf_document:
latex_engine: xelatex
toc: true
keep_tex: true
mainfont: Times New Roman
fontsize: 11pt
header-includes:
- \usepackage{titling}
- \pretitle{\begin{flushleft}}
- \posttitle{\end{flushleft}}
- \preauthor{\begin{flushleft}}
- \postauthor{\end{flushleft}}
- \predate{\begin{flushleft}}
- \postdate{\end{flushleft}}
---
# Lorem Ipsum
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed eiusmod tempor incidunt
ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquid ex ea commodi consequat. Quis aute iure reprehenderit
in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint
obcaecat cupiditat non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.
Run Code Online (Sandbox Code Playgroud)