简体   繁体   English

在RStudio中更改字体和/或边距-> RMarkdown-> YAML->针织-> pandoc-> LaTex-> PDF

[英]Changing font and/or margin in RStudio -> RMarkdown -> YAML -> knitr -> pandoc -> LaTex -> PDF

Can someone give me an example of a YAML header that successfully passes command line args / options to pandoc? 有人可以给我举一个成功将命令行参数/选项传递给pandoc的YAML标头的示例吗? The documentation and examples I've found, indicate that I can do this by setting the margin in the YAML header for an PDF output file with: geometry: margin=0.5in . 我发现的文档和示例表明,可以通过以下方式为PDF输出文件的YAML标头设置边距来实现此目的: geometry: margin=0.5in But I can't seem to get it to work. 但是我似乎无法使其正常工作。

After much trial an error, I was able to get the following to work 经过大量的尝试错误后,我得以完成以下工作

output:
  pdf_document:
    keep_tex: yes
    latex_engine: xelatex
  word_document: default
  html_document: default
geometry: margin=0.5in 
mainfont: Arial
fontsize: 12pt

But with these caveats: 但是请注意以下几点:

  • The geometry and mainfont tags must be at the top level of the YAML options, even though they only apply to the PDF_document type of output. 即使几何和mainfont标签仅适用于输出的PDF_document类型,也必须位于YAML选项的顶层。
  • The mainfont: Arial tag only seems to work with the xelatex engine. 主字体:Arial标签似乎仅适用于xelatex引擎。 I was not able to find a list of valid font names, but just lucked out with Arial 我找不到有效字体名称的列表,但是很幸运地与Arial在一起
  • The fontsize only seems to work on the included tables, not the main text. fontsize似乎仅适用于包含的表,而不适用于主要文本。

If anyone can point me to a more definitive description of what YAML header option gets passed to Pandoc and LaTex, I'd appreciate it. 如果有人可以指导我更明确地描述将哪些YAML标头选项传递给Pandoc和LaTex,我将不胜感激。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM