问题
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