1

In an r notebook viewed in RStudio, I can have the following yaml, setup, r chunk, and text:

---
title: "R Notebook"
output:
  html_notebook: 
    fig_height: 2
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(fig.height=2, fig.width=2, out.height=2, out.width=2)
```

```{r fig.height=2, fig.width=2, out.height=2, out.width=2}

rmarkdown::html_notebook_output_html(
  "<div style='border:1px solid red'>hello</div>"
)

```
goodbye

Note the variety of ways I'm trying to establish the height for the html object. For the .nb.html file, this outputs just fine. 'Goodbye' is right after a red bordered 'hello'.

However, for the in-document output that follows immediately after the code chunk, the output is quite tall (I believe the default is 7 inches, and that's about what it seems to be), and certainly outsizes its contents. The size directives (fig.height, out.height) are ignored.

Is there a more appropriate way to set the size?

rnotebook chunk output

I ran into the issue when using kable:

```{r fig.height=2, fig.width=2, out.height=2, out.width=2}

knitr::kable(data.frame(col1 = c('hello')), 'html')

```

Though I don't think it's a kable issue, based on the first example, I believe it's an rmarkdown issue.

pwilcox
  • 5,542
  • 1
  • 19
  • 31
  • Looks like an RStudio issue (you're viewing it there, right?), not an rmarkdown issue. – user2554330 Mar 26 '20 at 00:42
  • @user2554330, I edited to add the RStudio tag and changed first sentence to reflect that I'm viewing this in RStudio. Thanks. – pwilcox Mar 26 '20 at 01:16

0 Answers0