当我使用####作为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只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是业界标准的虚拟文本,当时一台未知的打印机采用了类型的厨房,并将其拼凑成一个类型的样本书。
我到处都读到了markdown允许1-6#的标题,所以我想知道我在这里做错了什么。
另外我认为我可以使用\ subsubsubsubsection代替####作为标题,但这给了我一个错误。
答案 0 :(得分:2)
请参阅Mico对以下问题的回答:
将此代码添加到您的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
答案 1 :(得分:1)
这实际上是一个LaTeX风格的问题,而不是(r)降价特定的问题。如果添加YAML标题
---
output:
pdf_document:
keep_tex: true
---
到您的文档(或将这些行添加到现有的YAML标题),生成的LaTeX文件将被保留;然后你可以查看LaTeX文件,看看生成的是:
\ paragraph {Heading 4} \ label {heading-4}
Lorem Ipsum ......
问题是LaTeX中的默认段落样式不包含换行符。一旦您知道这是正在进行的操作,您就可以搜索this LaTeX incantation from tex.stackexchange.com之类的内容,创建一个包含
的parahdr.tex
文件
\usepackage{titlesec}
\titleformat{\paragraph}
{\normalfont\bfseries}
{}
{0pt}
{}
并根据"advanced customization" documentation for PDF output from the rmarkdown package
将其合并到您的YAML标头中---
output:
pdf_document:
keep_tex: true
includes:
in_header: parahdr.tex
---