我正在尝试通过 RStudio 用 bookdown 来写我的论文,因为我对 Latex 不太熟悉。 我想在附录中添加为该项目生成的代码,但行不会中断,因此代码始终在页面上运行。
我在很长一段时间内尝试了太多,以至于我不再知道我尝试了什么或什么可能会干扰。我尝试更改代码块中的大小,但它没有执行任何操作(所以这里:
{r app, eval = FALSE, size = "tiny"}
)
另一个想法是改变纸张的旋转,但我也无法做到,也许我写错了页?
如果有人能帮助我,我将非常感激。谢谢!
我的索引文件如下所示:
---
title: "Thesis"
site: "bookdown::bookdown_site"
documentclass: book
output:
bookdown::pdf_book:
keep_tex: true
extra_dependencies: ["float"]
citation_package: biblatex
toc: true
toc_depth: 3
includes:
in_header:
- \usepackage{pdfpages}
bibliography: [file.bib]
link-citations: yes
geometry: "left=4cm, right=3cm, top=2.5cm, bottom=2.5cm"
---
And the head of the appendix document with an example of code that ist way too long:
# Appendix: Codes {.unnumbered #appendix}
\markboth{APPENDIX}{}
## app.R {-}
```{r app, eval = FALSE}
# Inputs ------------------------------------------------------------------
## Transform excel input data
input_data <- reactive({
req(input$file)
# functions used here are generated in 02_functions.r
headers <- read_excel(input$file$datapath, col_names = FALSE, n_max = 2) %>% tibble::as_tibble() %>% mutate(...3 = NA)
data <- read_excel(input$file$datapath, col_names = FALSE, skip = 2) %>% tibble::as_tibble()
return(data)
})
```
这会导致这样的事情:
我尝试过:
---
title: "Thesis"
site: "bookdown::bookdown_site"
documentclass: book
output:
bookdown::pdf_book:
keep_tex: true
extra_dependencies: ["float"]
citation_package: biblatex
toc: true
toc_depth: 3
header-includes:
- \usepackage{pdfpages}
- \usepackage{fvextra}
- \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\},breaklines=true, breakanywhere=true}
link-citations: yes
geometry: "left=4cm, right=3cm, top=2.5cm, bottom=2.5cm"
---
And the head of the appendix document with an example of code that ist way too long:
# Appendix: Codes {.unnumbered #appendix}
\markboth{APPENDIX}{}
## app.R {-}
```{r app, eval = FALSE}
# Inputs ------------------------------------------------------------------
## Transform excel input data
input_data <- reactive({
req(input$file)
# functions used here are generated in 02_functions.r
headers <- read_excel(input$file$datapath, col_names = FALSE, n_max = 2) %>% tibble::as_tibble() %>% mutate(...3 = NA)
data <- read_excel(input$file$datapath, col_names = FALSE, skip = 2) %>% tibble::as_tibble()
return(data)
})
```