Latex 减少rmarkdown beamer演示中代码块和代码输出之间的空间
我正在使用rmarkdown和LaTeX/Beamer构建演示文稿。我想减少显示的R命令和R输出之间的间隔。我相信这与LaTeX/Beamer中的段落间距选项有关 这是我应该在rmarkdown(块选项、knit_hooks或其他什么?)中、pandoc Yaml头(一些pandoc选项?)或LaTeX beamer模板文件中执行的操作吗?我觉得它应该在LaTeX模板文件中 下面是一个最小标记文件的工作示例,以及我用来控制某些beamer设置的.tex模板文件 示例.RmdLatex 减少rmarkdown beamer演示中代码块和代码输出之间的空间,latex,r-markdown,pandoc,spacing,beamer,Latex,R Markdown,Pandoc,Spacing,Beamer,我正在使用rmarkdown和LaTeX/Beamer构建演示文稿。我想减少显示的R命令和R输出之间的间隔。我相信这与LaTeX/Beamer中的段落间距选项有关 这是我应该在rmarkdown(块选项、knit_hooks或其他什么?)中、pandoc Yaml头(一些pandoc选项?)或LaTeX beamer模板文件中执行的操作吗?我觉得它应该在LaTeX模板文件中 下面是一个最小标记文件的工作示例,以及我用来控制某些beamer设置的.tex模板文件 示例.Rmd --- title:
---
title: "Untitled"
author: "Ryan"
date: "March 1, 2016"
output:
beamer_presentation:
pandoc_args: '--latex-engine=xelatex'
includes:
in_header: latex-topmatter.tex
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Vertical Spacing is too much
Here is a working example.
- some
- bullets
Example code:
```{r, echo = TRUE}
a <- 1
a
a+a
```
---
title: "Untitled"
author: "Martin"
date: "January 4, 2017"
output:
beamer_presentation:
keep_tex: yes
pandoc_args: --latex-engine=xelatex
includes:
in_header: latex-topmatter.tex
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Vertical Spacing is just right
Here is a working example.
- some
- bullets
Example code:
```{r, echo = TRUE}
a <- 1
a
a+a
```
我尝试过将R命令或R输出的字体变小,这似乎不会影响段落间距
我尝试过使用knit_hooks()
,如本例所示:
,这基本上是有效的-但是我似乎不能减少代码和输出的大小
我还尝试使用了\parskip{0pt}
,以及其他几个beamer选项或parskip选项,这些选项在上面的latex topmatter.tex
部分中有注释。它们似乎都没有改变文本块、R代码或R输出之间的间距。我找对地方了吗
以下是一个工作示例。请注意头文件末尾的定义:
- 源代码块包含在
环境中,该环境反过来使用阴影
作为其间距。所以我们需要重新定义它\OuterFrameSep
- 使用
我们将命令\preto
预先发送到每个逐字记录环境。这会影响输出块的间距\topsep=-10pt\partopsep=-10pt
---
title: "Untitled"
author: "Ryan"
date: "March 1, 2016"
output:
beamer_presentation:
pandoc_args: '--latex-engine=xelatex'
includes:
in_header: latex-topmatter.tex
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Vertical Spacing is too much
Here is a working example.
- some
- bullets
Example code:
```{r, echo = TRUE}
a <- 1
a
a+a
```
---
title: "Untitled"
author: "Martin"
date: "January 4, 2017"
output:
beamer_presentation:
keep_tex: yes
pandoc_args: --latex-engine=xelatex
includes:
in_header: latex-topmatter.tex
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Vertical Spacing is just right
Here is a working example.
- some
- bullets
Example code:
```{r, echo = TRUE}
a <- 1
a
a+a
```
您有没有找到解决方案?谢谢。@DataJack看到下面感谢你解决了这个问题,Martin!你能提出其他的解决办法吗?在这里发布我的问题并等待9个月是一种方法。在查找latex文档的过程中,我经常努力寻找我需要的东西,这个问题只是一个例子。我不能。考虑到答案并没有那么难,我真的很惊讶花了这么长时间。