R Markdown文本中的换行符(不是代码块) [英] Line breaks in R Markdown text (not code blocks)

查看:70
本文介绍了R Markdown文本中的换行符(不是代码块)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

Using the tufte_template rmarkdown file, I am trying to make a new paragraph (like \newthought{}, but no caps.) I use two spaces, denoted here by *:

# Introduction

The Tufte-\LaTeX\ [^tufte_latex] document**
**
classes define a style similar to the style Edward Tufte uses in his books...

但是得到这个结果:

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

I have tried \n in place of the second pair of spaces (**) as well, but pandoc throws an error.

pandoc.exe: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43

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

Finally, I tried using a <br> tag, but that seems to have no effect whatsoever - it doesn't print the text or a break to the PDF.

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

I would like a new paragraph, without the indentation, similar to \newthought{}, but without the capitalization...is there a way?

更新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

更新2

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

This seems to be a problem I encounter specifically when using the Tufte template:

推荐答案

我尝试了这些测试,但似乎可行:

I tried these tests, it seems to be working:

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

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 

这篇关于R Markdown文本中的换行符(不是代码块)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆