R Markdown 中的第 4 级标题问题

Pda*_*awg 5 latex r pdflatex knitr r-markdown

当我使用 #### 作为第 4 级标题时,pdf(latex) 中的输出在段落开始之前不会留下行距。例如,

#### Heading 4

Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 
when an unknown printer took a galley of type and scrambled it to make a type
specimen book. 
Run Code Online (Sandbox Code Playgroud)

仅在 pdf(latex) 中的输出看起来像这样

Heading 4 Lorem Ipsum 只是印刷和排版行业的虚拟文本。自 1500 年代以来,Lorem Ipsum 一直是行业标准的虚拟文本,当时一位不知名的印刷商使用了一个类型的厨房并争先恐后地制作了一本类型样本书。

我到处都读到 r markdown 允许标题使用 1-6 个 #,所以我想弄清楚我在这里做错了什么。

另外我想我可以使用 \subsubsubsubsection 而不是 #### 作为标题,但这给了我一个错误。

Sco*_*rff 6

请参阅Mico对以下问题的回答:

https://tex.stackexchange.com/questions/60209/how-to-add-an-extra-level-of-sections-with-headings-below-subsubsection

将此代码添加到您的 tex 头文件中即可:

\documentclass{article}
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
        {-2.5ex\@plus -1ex \@minus -.25ex}%
        {1.25ex \@plus .25ex}%
        {\normalfont\normalsize\bfseries}}
\makeatother
\setcounter{secnumdepth}{4} % how many sectioning levels to assign numbers to
Run Code Online (Sandbox Code Playgroud)