Question: no floating figures with biocstyle
0
gravatar for Lescai, Francesco
21 months ago by
Denmark
Lescai, Francesco380 wrote:

Hi guys,

I've searched for this without success and maybe there's a banal solution :) how do I keep in place a figure when I'm using BiocStyle to output a PDF? seems the default is floating, but couldn't find a way to change it.

Sometimes I find it useful to have the figure right before or after the text referring to it, without having the reader go some pages ahead to find it.

cheers, 

Francesco

biocstyle float • 422 views
ADD COMMENTlink modified 21 months ago by Andrzej Oleś720 • written 21 months ago by Lescai, Francesco380

Is your source a .Rnw or a .Rmd file?

ADD REPLYlink modified 21 months ago • written 21 months ago by Andrzej Oleś720

.Rmd with RStudio, using knitR

ADD REPLYlink modified 21 months ago • written 21 months ago by Lescai, Francesco380
Answer: no floating figures with biocstyle
0
gravatar for Andrzej Oleś
21 months ago by
Andrzej Oleś720
Heidelberg, Germany
Andrzej Oleś720 wrote:

There is a knitr code chunk option fig.pos meant for the purpose of controlling the placement of floats. When it is set to 'H' it will freeze the figure by unfloating it. Note the uppercase which is important because this is a special placement specifier which also requires the LaTeX package float to be loaded.

However, as pointed out by Yihui, in order to get fig.pos to work in R Markdown you will additionally need to specify one of the options: fig.align, out.width or out.extra. I've updated BiocStyle 2.5.41 to do it automatically by setting out.extra = '' when fig.pos is specified.

The following MWE translates the above into code.

example.Rmd

---
output: 
  BiocStyle::pdf_document:
    includes:
      in_header: header.tex
---

```{r, fig.cap='Old Faithful Geyser Data', fig.pos='H'}
plot(faithful)
```

header.tex

\usepackage{float}
ADD COMMENTlink written 21 months ago by Andrzej Oleś720
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 313 users visited in the last hour