Inconsistent figure note line spacing rendering pdf in Bookdown

96 views Asked by At

I am trying to insert a figure note to render in pdf from the following code chunk:

``{r boxfreshAe, out.width = c("49%","49%","49%","49%"),fig.align = "center", warning=FALSE, message=FALSE, error=FALSE, fig.pos="H",fig.show = 'hold', fig.cap='(ref:boxfreshAe)', echo=FALSE}

the text note reads like this:

(ref:boxfreshAe) Forest of Ae - boxplot of fresh example (%) by management example. A): 0 - 15 cm depth; B): 15 - 30 cm depth; C): litter example; D): H horizon. Displayed are minimum, twenty-fifth percentile, fiftyeth percentile, seventy-fifth percentile and maximum. Black dots are observations that may be outliers accoring to the rule ± 1.5 * interquartile range, this being determined as as the upper quartile minus the lower quartile [@reference2015]. Same colour / shape dots are same block replication.

but also this would work the same:

(ref:boxfreshAe) example example example example example example example example example example example example example example example exampleexample example example example example example example exampleexample example example exampleexample example example example

the above chunk contains box-and-whiskers plots and results in a pdf with a figure note that looks like this:


enter image description here


This is not what I want because the figure is using the layout of the main text of my book which I setup in the index.Rmd with linestretch: 2.

Instead, when I insert a photo the figure note has a reduced line spacing. I would like this spacing (below) to be also in the figure above.

(ref:shallow-Hhor) detail of the H horizon in the Control treatment. This was consistently < 5 cm deep.

```{r shallow-Hhor, out.width = "50%" , fig.align="center",fig.pos="h", fig.cap='(ref:shallow-Hhor)', echo=FALSE}

enter image description here


Any help is very welcome, many thanks in advance.

1

There are 1 answers

0
BAlpine On BEST ANSWER

I solved the problem by changing the chunk option from fig.pos="H" to fig.pos="!h"