R 在页面的剩余空间中垂直添加多个绘图

R 在页面的剩余空间中垂直添加多个绘图,r,latex,r-markdown,knitr,tex,R,Latex,R Markdown,Knitr,Tex,我正在编辑这个.Rmd,但是结果将副标题“###PLOTS”与我制作的三个数字分开 第一种方法 计算页面中的铰孔空间并将其除以3。 out.height='\dimexpr(\texthheight-3\baselineskip-\parskip-.2em-\overcaptionskip-\belowcaptionskip)/3)' 第二种方法 将out.height的大小调整为25%会减少字幕的空间,但不会产生任何效果 --- title: "My report" out

我正在编辑这个.Rmd,但是结果将副标题“###PLOTS”与我制作的三个数字分开

第一种方法 计算页面中的铰孔空间并将其除以3。 out.height='\dimexpr(\texthheight-3\baselineskip-\parskip-.2em-\overcaptionskip-\belowcaptionskip)/3)'

第二种方法 将out.height的大小调整为25%会减少字幕的空间,但不会产生任何效果

---
title: "My report"
output: 
  pdf_document: 
    keep_tex: yes
    latex_engine: pdflatex
header-includes:
  - \usepackage{subfig}
  - \usepackage{calc}
  - \renewcommand{\figurename}{Fig.} 
---

```{r setup, include=FALSE}
options(tinytex.verbose = TRUE)
knitr::opts_chunk$set(echo = FALSE, message = FALSE)
```

First page. Leaving alone. No figures here

\newpage

## PLOTS

```{r plots, fig.cap = 'My plots', fig.subcap=c('top', 'mid', 'down'), fig.ncol = 1, out.height='\\dimexpr ((\\textheight  -3\\baselineskip -\\parskip -.2em -\\abovecaptionskip -\\belowcaptionskip)/3)', out.extra='keepaspectratio'}
plot(-1:-10)
plot(1:10)
plot(iris$Sepal.Width)
```

在chunk选项中使用
fig.pos='H'
可以为我解决这个问题。它需要
-\usepackage{float}
中的
头包含

在chunk选项中使用
fig.pos='H'
可以为我解决这个问题。它需要
-\usepackage{float}
中的
头包含

你好像在用乳胶。我通常通过单独生成每个图来解决这些问题,并使用LaTeX PackAge子图进行布局。这也会创建与文档字体和大小一致的图形标题。看起来您使用的是LaTeX。我通常通过单独生成每个图来解决这些问题,并使用LaTeX PackAge子图进行布局。这也会创建与文档字体和大小一致的图形标题。