简体   繁体   English

从 Markdown 到 PDF:如何使用 Pandoc 更改字体大小?

[英]From Markdown to PDF: how to change the font-size with Pandoc?

I'm converting some Markdown files into PDF using Pandoc like this:我正在使用 Pandoc 将一些 Markdown 文件转换为 PDF,如下所示:

pandoc input.md -V geometry:margin=1in -o output.pdf 

By default, the font-size is quite small in the pdf.默认情况下,pdf 中的字体大小非常小。 I'd like to make all the fonts bigger (title, sub title, text, etc.).我想让所有字体都变大(标题、副标题、文本等)。 How can I do that?我怎样才能做到这一点?

将此添加到您的咒语中:

-V fontsize=12pt

If you want to go bigger than 12pt you can use the extsizes package .如果你想大于 12pt,你可以使用extsizes 包 Was already pre installed for me, so this worked out of the box with pandoc :已经为我预先安装了,所以这与pandoc一起开箱即用:

---
documentclass: extarticle
fontsize: 14pt
---

…

Possible sizes are 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt, 20pt.可能的大小为 8pt、9pt、10pt、11pt、12pt、14pt、17pt、20pt。

For new users of pandoc (like myself), as an alternative to specifying variables with the -V flag, you can add them to the YAML metadata block of the markdown file.对于 pandoc 的新用户(比如我自己),作为使用-V标志指定变量的替代方法,您可以将它们添加到 Markdown 文件的YAML 元数据块中。 To change the fontsize, prepend following to your markdown document.要更改字体大小,请将以下内容添加到您的 Markdown 文档中。

---
fontsize: 12pt
---

Works with fontsize 10,11, and 12. In addition to the comments on John MacFarlane's answer, there is some good info on specifying additional fontsizes with latex in this article (inline latex can be used in pandoc markdown documents being converted to pdf).适用于 fontsize 10,11 和 12。除了对 John MacFarlane 的回答的评论之外,还有一些关于 在本文中使用乳胶指定其他字体大小的好信息(内联乳胶可用于被转换为 pdf 的 pandoc markdown 文档)。

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

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