r - R Markdown 中的 4 级标题问题

标签 r latex knitr r-markdown pdflatex

当我使用 #### 作为 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. 

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

标题 4 Lorem Ipsum 只是打印和排版行业的虚拟文本。自 1500 年代以来,Lorem Ipsum 一直是行业标准的虚拟文本,当时一位不知名的打印商拿走了一堆字体并将其打乱以制作一本字体样本簿。

我到处都读到 r markdown 允许 1-6 # 作为标题,所以我试图找出我在这里做错了什么。

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

最佳答案

查看 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

关于r - R Markdown 中的 4 级标题问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33134416/

相关文章:

python - 在 sympy Latex 中将系数渲染为分数

r - 使用 rmarkdown 和knitr 将部分添加到投影仪演示文稿中

r - 使用 R 裁剪空白 pdf(有独立的跨平台解决方案吗?)

html - 仅使用 knitr 更改 HTML5 中的字体大小

r - 合并 Igraph 时保持属性名称

r - ObserveEvent 中 Shiny 的应用程序错误? [.default : invalid subscript type 'list' 中的错误

r - 无循环匹配家庭伙伴

r - 获取 plot() 边界框值

latex - 如何在 reStructuredText 的定义列表上使用强制换行来渲染 LaTeX/PDF

r - 观星者 R 包 : Position of Title in Latex Table