R Markdown文本中的换行符(不是代码块)

d8a*_*nja 12 markdown r r-markdown tufte

使用tufte_template rmarkdown文件,我试图创建一个新的段落(比如\newthought{},但没有上限.)我使用两个空格,在这里用*表示:

# Introduction

The Tufte-\LaTeX\ [^tufte_latex] document**
**
classes define a style similar to the style Edward Tufte uses in his books...
Run Code Online (Sandbox Code Playgroud)

但得到这个结果:

在此输入图像描述

我也尝试\n过代替第二对空格(**),但是pandoc会抛出错误.

pandoc.exe: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
Run Code Online (Sandbox Code Playgroud)

最后,我尝试使用<br>标签,但这似乎没有任何效果 - 它不打印文本或打破PDF.

我想要一个没有缩进的新段落,类似于\newthought {},但没有大写......有没有办法?

使用sessionInfo()更新1:

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] digest_0.6.8    htmltools_0.2.6 rmarkdown_0.5.1 tools_3.1.2     yaml_2.1.13
Run Code Online (Sandbox Code Playgroud)

更新2

这似乎是我在使用Tufte模板时遇到的一个问题:

在此输入图像描述

zx8*_*754 21

我试过这些测试,似乎工作:

test.Rmd

---
output: pdf_document
---

# test 1
No spaces used   

line1
line2


# test 2
2spaces at the end of line1  

line1  
line2

# test 3
2spaces at the end of line1, then 2 spaces on next line

line1  

line2
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
[5] LC_TIME=English_United Kingdom.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] htmltools_0.2.6 tools_3.2.0     yaml_2.1.13     rmarkdown_0.5.1 digest_0.6.8 
Run Code Online (Sandbox Code Playgroud)


ssa*_*ols 9

这是一个相当古老的问题,但我发布了一个答案,因为这是谷歌搜索"rmarkdown中的换行符"时的第一个问题.

如果编译为pdf,则可以使用乳胶宏.用以下代码替换新行中的****:

# Introduction

The Tufte-\LaTeX\ [^tufte_latex] document**
\hfill\break
classes define a style similar to the style Edward Tufte uses in his books...
Run Code Online (Sandbox Code Playgroud)


小智 5

我发现添加空行的最佳方法是:

# First title
<br><br><br><br><br>  

# Second title with 5 blank spaces above it
Run Code Online (Sandbox Code Playgroud)

你可以试试这个,希望它有帮助。我只在 html_documents 中测试过,但大概它也可以在 pdf 中工作。

  • 遗憾的是,&lt;br&gt; 被 PDF 目标无声地吃掉了。 (5认同)