Change size of section titles in R Markdown PDF

心不动则不痛 提交于 2019-12-26 02:44:34

问题


Is there a way to change the font size of text of headings in R Markdown?

I know how to number the sections of the article; however, in terms of formatting, the font size of the sections that are numbered 1., 2., 3... is too large. As a workaround, I have been using lower-level headers ### Introduction, but these have the wrong numbering.

Here is a basic example:

---
output: bookdown::pdf_document2
---

# This is too big

### This is the right size but are labelled as 1.0.1

回答1:


You can place

\usepackage[medium]{titlesec} % or small

in preamble.tex (or where ever you have special LaTeX commands) together with

subparagraph: yes

in th e YAML headers (c.f. this question). For a more detailed answer we will need a minimal working example.




回答2:


One workaround to this is to change the font size of the section title by including a css file. An example is:

h1 { font-size: 16px; }

h2 { font-size: 14px; }

h3 { font-size: 12px; }

The font size specified inside h1{} will change the font size of the header of depth 1 (i.e. # Section). The font size specified inside h2{} will change the font size of the header of depth 2 (i.e. ## Subsection) and so on.



来源:https://stackoverflow.com/questions/50825249/change-size-of-section-titles-in-r-markdown-pdf

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