How can I change PDF output font from within the YAML header when using Pandoc on Markdown?

谁说我不能喝 提交于 2019-12-12 07:45:04

问题


Is there a (built-in) way to set a different font (or fonts) to use in the Pandoc YAML header? Ideally, I would do something like this in the YAML header of my Markdown file:

---
font: MySansSerifFontName  
...

I'm using TexLive on Linux (Ubuntu), with pandoc, of course.


回答1:


This should do the trick:

---
fontfamily: arev
---

From Pandoc's README:

fontfamily: font package to use for LaTeX documents (with pdflatex): TeXLive has bookman (Bookman), utopia or fourier (Utopia), fouriernc (New Century Schoolbook), times or txfonts (Times), mathpazo or pxfonts or mathpple (Palatino), libertine (Linux Libertine), arev (Arev Sans), and the default lmodern, among others.




回答2:


When you use xelatex or lualatex to render the PDF you must use:

---
mainfont: Arial
---

Official documentation: Variables for LaTeX



来源:https://stackoverflow.com/questions/26479047/how-can-i-change-pdf-output-font-from-within-the-yaml-header-when-using-pandoc-o

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!