Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R降价中的4级标题问题_R_Latex_Knitr_R Markdown_Pdflatex - Fatal编程技术网

R降价中的4级标题问题

R降价中的4级标题问题,r,latex,knitr,r-markdown,pdflatex,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

当我将#####用于第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)格式的输出如下所示

标题4Lorem Ipsum只是印刷和排版行业的虚拟文本。自16世纪以来,Lorem Ipsum一直是行业标准的虚拟文本,当时一位不知名的印刷商拿起一个打印工具,将其拼凑成一本打印样本书

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


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

这本质上是一个乳胶式的问题,而不是(r)降价特定的问题。如果添加YAML标头

---
output:
   pdf_document:
      keep_tex: true
---
对于您的文档(或将这些行添加到现有YAML头),生成的LaTeX文件将被保留;然后,您可以查看LaTeX文件,查看生成的内容是:

\第{Heading 4}段\标签{Heading-4}

同侧眼线

问题是LaTeX中的默认段落样式不包含换行符。一旦您知道这是正在发生的事情,您可以搜索类似的内容,创建一个
parahdr.tex
文件,其中包含

\usepackage{titlesec}
\titleformat{\paragraph}
   {\normalfont\bfseries}
   {}
   {0pt}
   {}
并根据以下说明将其合并到YAML标题中:


见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

谢谢你的解决方案。它确实有助于在新行开始段落,但标题上没有章节编号。所以,这很像用粗体写标题4。看看latex代码,问题是在3级标题之后,latex认为更多的标题都是段落标题,因此解决了我的问题:)我做了一些类似的事情,但是,是的,基本上就是这样。
\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