fge*_*eri 5 pdf latex pandoc quarto
当 RMarkdown.rmd文档被编织为 PDF 时,文本正文以及标题、副标题和标题都以相同的 LaTeX 标准字体呈现。
将四开.qmd文档渲染为 PDF 时,文本正文的字体保持不变,但标题、副标题和标题以不同的字体渲染,没有衬线。
为了实现较旧的 R Markdown 文档和较新的 Quarto 文档的输出之间的一致性,我想将标题、副标题和标题的字体更改回正常字体。我怎样才能实现这个目标?
我尝试fontfamily:在 YAML 标头中使用,但这没有找到我想要的字体。\setkomafont{section}{\normalfont}我通过使用in取得了一些成功include-in-header:,因为这确实改变了字体,但仅限于 h1 标题,而不是 h2 或标题或副标题。它还删除了 h1 的所有其他格式(例如字体大小、粗体等),这不是我想要的。
使用Tex StackExchange 的答案,我们可以轻松地在四开本中完成此操作。
---
title: "Fonts"
subtitle: "Changing fonts of title, subtitle back to normal font"
author: "None"
format:
pdf:
include-in-header:
text: |
\addtokomafont{disposition}{\rmfamily}
---
## Quarto
Quarto enables you to weave together content and executable code into a
finished document. To learn more about Quarto see <https://quarto.org>.
## Running Code
When you click the **Render** button a document will be generated that includes
both content and the output of embedded code.
Run Code Online (Sandbox Code Playgroud)
当然,请查看KOMA-Script 手册的第 3.6 节 - 文本标记,其中提供了可以进行此类更改的非常详细的元素列表(如author、chapter、title、subtitle、等)。date
如果正文中使用的字体已知,则可以使用 设置标题和标题中使用的字体sansfont: ...。明智的做法是还进行设置mainfont以确保它们相同。
使用的默认字体是Latin Modern Roman,因此将其添加到 YAML frontmatter 应该可以做到:
---
mainfont: Latin Modern Roman
sansfont: Latin Modern Roman
---
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4079 次 |
| 最近记录: |