【问题标题】:Rmarkdown Table of Contents on page 2 and cross referencing第 2 页的 Rmarkdown 目录和交叉引用
【发布时间】:2022-10-25 21:00:50
【问题描述】:

我希望我的 pdf 输出满足 3 个条件:

  1. 第 1 页的标题页
  2. 第 2 页上的目录
  3. 交叉参考图和表。

    我可以用pdf_document 做1 和2,但正如here 解释的那样,pdf_document2 是3 所必需的。

    如何构建一个可以满足这三个条件的 pdf 文档?如果可能,我想避免将我的文档类设置为报告。

    This 答案是我找到的最接近的答案。

    示例代码:

    ---
    title: "Untitled"
    output: 
      pdf_document:
        number_sections: true
    ---
    
    \newpage
    \tableofcontents
    \listoffigures
    \listoftables
    \newpage
    
    
    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = TRUE)
    ```
    
    ## R Markdown
    
    Figure (...) below is a 
    
    ```{r pressure}
    plot(pressure)
    ```
    

【问题讨论】:

  • 所以你不想使用pdf_document2
  • @Quinten 我编辑了标题以阐明输出类型的不重要性。只要满足 3 个条件,pdf_documentpdf_document2 都可以。

标签: r r-markdown knitr pdfdocument


【解决方案1】:

你只需要添加 ef{}

## R Markdown

Figure (
ef{fig:pressure}) below is a ...

```{r pressure}
plot(pressure)
```

【讨论】:

    猜你喜欢
    • 2023-02-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-26
    • 1970-01-01
    • 2018-10-14
    • 2016-12-16
    • 2021-12-23
    • 2011-07-22
    相关资源
    最近更新 更多