-1

I am trying to knit a PDF doc using Markdown and the regression table and one of the graphs are not in the place I wrote then in the rmarkdown file, which makes the report looking out of order. I have tried every solution I could find online but I would either get no results at all or error messages. I would appreciate help that would solve this issue.

I tried adding the following code to the end of every chunk.

knitr::knit_hooks$set(plot = function(x, options)  {
  paste0(knitr::hook_plot_tex(x, options), "\n\\FloatBarrier\n")
})

I've tried the following at the top of chunks:

knitr::opts_chunk$set(fig.pos = "!H", out.extra = "")

I have also tried setting fig.pos = 'h' among many other codes with no success at all.

H B
  • 1
  • 4
  • 1
    See if any of [these ideas](https://bookdown.org/yihui/rmarkdown-cookbook/figure-placement.html) help. – Kat Aug 13 '22 at 04:06

1 Answers1

0

For tables i use knitr::kable in combination with kableExtra::kablestyling:

kable_styling(latex_options =c("HOLD_position"))

For figures i used this: How to hold figure position with figure caption in pdf output of knitr?

MartineJ
  • 591
  • 5
  • 16