问题描述
我正在编织此.Rmd,但是结果使字幕“ ## PLOTS”与我制作的三个数字分开了。
第一种方法
计算页面中的剩余空间,并将其除以3。 out.height ='\ dimexpr((\\ textheight -3 \ baselineskip-\ parskip -.2em-\ abovecaptionskip-\ 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)
```
解决方法
在块选项中使用fig.pos='H'
为我解决了。它需要- \usepackage{float}
中的header-includes
。 Ref