在 RStudio 中的 R markdown 中,使用 bash 语言时如何防止源代码从 pdf 页面运行?
我正在使用 Bookdown 和 RStudio 编写一本技术书籍。我的代码块主要使用 bash
。一切工作正常,除了当我将书导出为 pdf 时,源代码部分脱离“盒子”,甚至页面(如果足够长)。我读过很多使用r
语言时的解决方案,但是当使用bash
语言时这些解决方案都不起作用。
这是我在 .Rmd
文件开头的代码:
```{r, global_options, include=FALSE}
knitr::opts_chunk$set(message=FALSE, eval=FALSE,
tidy.opts=list(width.cutoff=60), tidy=TRUE)
```
然后当我编写代码块时:
```{bash}
mongodump --uri="mongodb+srv://cluster0.rh6qzzz.mongodb.net/" --db sample_mflix --username my_username
```
我想避免这种情况,但我还没有找到解决方案。
I'm writing a technical book using Bookdown and RStudio. My code chunks are mainly using bash
. Everything works fine except when I export the book to pdf, then the source code is partially out of the "box" and even the page if this is long enough. I have read a lot of solutions when r
language is used, but none of these solutions works when bash
language is used.
Here is my code at the beginning of the .Rmd
file:
```{r, global_options, include=FALSE}
knitr::opts_chunk$set(message=FALSE, eval=FALSE,
tidy.opts=list(width.cutoff=60), tidy=TRUE)
```
And then when I write the code chunk:
```{bash}
mongodump --uri="mongodb+srv://cluster0.rh6qzzz.mongodb.net/" --db sample_mflix --username my_username
```
The outputs were produced as shown below (see the end of line):
I would like to avoid this, but I have not found the solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论