在Rmd文档中呈现为pdf,防止在R块中额外换行

  • 本文关键字:换行 pdf 文档 Rmd knitr r-markdown
  • 更新时间 :
  • 英文 :


下面的代码导致rnorm(1)和返回值之间的额外换行。如何删除这条额外的行?

---  
title: "Lecture2"  
output: pdf_document  
---
```{r}  
rnorm(1)  
```

我已经安装了miktex,我正在使用knitr。

也许你应该评估内联代码(即:"(1)r标准")。

此方法仅在highlight=FALSE时有效,并且有一个不幸的副作用,即无法在新段落中创建换行符…

---
title: "Untitled"
output: 
  beamer_presentation:
    keep_tex: true
    includes:
      in_header: header.tex
---
```{r, highlight=FALSE}  
rnorm(1)  
```
在header.tex

%code from http://tex.stackexchange.com/questions/43331/control-vertical-space-before-and-after-verbatim-environment
usepackage{etoolbox}
makeatletter
preto{@verbatim}{topsep=0pt partopsep=0pt }
makeatother

%https://www.sharelatex.com/learn/Paragraph_formatting
setlength{parskip}{0 em}

最新更新