How to make vertical scrollbar appear in RMarkdown code chunks (html view)

北战南征 提交于 2019-12-01 17:19:35

The problem seems to be that you did not specify the height of the code chunk. Try this instead:

<style>
pre {
  white-space: pre !important;
  overflow-y: scroll !important;
  height: 50vh !important;
}
</style>

(For information about the unit vh check this)

Adam Elder

Adding onto @Martin Schmelzer's solution, I noticed there can be issues if echo = TRUE, or if your output is not much large in other parts of the document. To fix this issue just change:

height: 50vh !important;

to

max-height: 50vh !important;
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!