【问题标题】:Adding line number when using rticles::elsevier_article使用 rticles::elsevier_article 时添加行号
【发布时间】:2020-12-04 11:58:21
【问题描述】:

我正在使用 rticles::elsevier_article 写手稿。我无法正确添加行号。我做了什么:

      header-includes:
         - \usepackage{lineno}
         - \linenumbers
     output: 
        bookdown::pdf_book:
        base_format: rticles::elsevier_article

但是,在这种情况下,当有方程时,不会添加行号,也不会添加嵌入方程的部分。有什么建议吗?

【问题讨论】:

    标签: r bookdown


    【解决方案1】:

    您的 YAML 似乎格式错误。最好这样做:

    bookdown::pdf_book:
      base_format: rticles::elsevier_article
      includes:
        in_header: "preamble.tex"
    

    然后在 preamble.tex 中添加额外的 LaTeX 标题行:

    \usepackage{booktabs}
    \usepackage{lineno}
    \linenumbers
    

    示例

    index.Rmd

    --- 
    title: "A Minimal Book Example"
    author: "You"
    date: "`r Sys.Date()`"
    site: bookdown::bookdown_site
    output:
      bookdown::pdf_book:
        base_format: rticles::elsevier_article
        includes:
          in_header: "preamble.tex"
    abstract: "This is your awesome abstract"
    ---
    
    # Introduction
    
    ```{r, results='asis'}
    cat(
      stringi::stri_rand_lipsum(1)
    )
    ```
    

    (代码块需要安装stringi包。)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-09-06
      • 2013-10-01
      • 1970-01-01
      • 2013-09-28
      • 1970-01-01
      • 1970-01-01
      • 2023-03-07
      • 1970-01-01
      相关资源
      最近更新 更多