Reputation: 121
I employ code folding through the following option specified in the header.
---
title: ""
output:
html_document:
code_folding: hide
---
I am not completely happy with the results, as I find that, when the code is folded, the space between the previous descriptive out of chuck text and the output is too large and it introduces a pause in reading, making it seems like the descriptive text and the output are not connected.
For example, I might write
This is our data frame
```{r}
df
```
And between the text and the printed df we will have, on the right, a button to fold/unfold the code, and that adds a space that it seems to amount to a line and a half, disrupting the flow of reading in my opinion.
I am asking if there are some easy ways to resolve this minor issue or if, if there are no quick fixes, there are some examples on the web, like blogs and github pages, where somebody was able to circumvent it by additional formatting.
What I did was to add <br>
after the code chunks, to distance the following ones, in a way that the text and the chunk of my previous example seem closer together, forming a single reading unit, so to speak.
This is our data frame
```{r}
df
```
<br>
This is another data frame
```{r}
df_2
```
Here the drawback is that the document will come out with a lot of white spaces, like small islands of text in a sea of white, so it is surely not optimal.
EDIT: As requested, I added some pictures.
Here you can see what I see, one solution could be to have the code button on the same line as "The data frame consists...., listed below" for example.
Like it is for the main code folding button at the top of the document,
But I am also open to other solutions/suggestions.
Upvotes: 0
Views: 68