首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >自定义r中rticles::elsevier_article文档类的输出

自定义r中rticles::elsevier_article文档类的输出
EN

Stack Overflow用户
提问于 2022-04-17 20:07:23
回答 1查看 146关注 0票数 1

我正试图在elsevier_article中设置利润率,但收效甚微。This post建议使用几何学来设置页边距,但我得到了以下错误:

代码语言:javascript
复制
! LaTeX Error: Option clash for package geometry.

我还尝试在序言中添加以下latex命令,但没有一个改变输出PDF中的页边距:

代码语言:javascript
复制
header-includes:
  - \PassOptionsToPackage{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm}{geometry}
代码语言:javascript
复制
header-includes:
  - \PassOptionsToPackage{margin=2.5cm}{geometry}

我需要2.5厘米的两边的书页。下面是一些需要处理的问题。它只是可以从Rstudio访问的默认模板(我删除了一些不必要的内容):

代码语言:javascript
复制
---
title: Short Paper
author:
  - name: Alice Anonymous
    email: alice@example.com
    affiliation: Some Institute of Technology
    correspondingauthor: true
    footnote: 1
  - name: Bob Security
    email: bob@example.com
    affiliation: Another University
  - name: Cat Memes
    email: cat@example.com
    affiliation: Another University
    footnote: 2
  - name: Derek Zoolander
    email: derek@example.com
    affiliation: Some Institute of Technology
    footnote: 2
address:
  - code: Some Institute of Technology
    address: Department, Street, City, State, Zip
  - code: Another University
    address: Department, Street, City, State, Zip
footnote:
  - code: 1
    text: "This is the first author footnote."
  - code: 2
    text: "Another author footnote."
abstract: |
  This is the abstract.

  It consists of two paragraphs.
keywords: 
  - keyword1
  - keyword2
journal: "An awesome journal"
date: "`r Sys.Date()`"
classoption: preprint, 3p, authoryear
# bibliography: mybibfile.bib
linenumbers: false
numbersections: true
# Use a CSL with `citation_package = "default"`
# csl: https://www.zotero.org/styles/elsevier-harvard
# geometry: "left=3cm,right=3cm,top=2cm,bottom=2cm"
output: 
  rticles::elsevier_article:
    keep_tex: true
    citation_package: natbib
# geometry: margin=2.54cm
# header-includes:
#   - \PassOptionsToPackage{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm}{geometry}
#   - \PassOptionsToPackage{margin=2.5cm}{geometry}
---

Please make sure that your manuscript follows the guidelines in the 
Guide for Authors of the relevant journal. It is not necessary to 
typeset your manuscript in exactly the same way as an article, 
unless you are submitting to a camera-ready copy (CRC) journal.

For detailed instructions regarding the elsevier article class, see   <https://www.elsevier.com/authors/policies-and-guidelines/latex-instructions>

# References {-}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-04-18 10:04:07

header-includes使用\PassOptionsToPackage{...}为时已晚,这个宏需要在文档类之前使用,这在重标记中有点困难。

相反,您可以在已经加载包后使用\geometry{...}来更改设置。

完整代码:

代码语言:javascript
复制
---
title: Short Paper
author:
  - name: Alice Anonymous
    email: alice@example.com
    affiliation: Some Institute of Technology
    correspondingauthor: true
    footnote: 1
  - name: Bob Security
    email: bob@example.com
    affiliation: Another University
  - name: Cat Memes
    email: cat@example.com
    affiliation: Another University
    footnote: 2
  - name: Derek Zoolander
    email: derek@example.com
    affiliation: Some Institute of Technology
    footnote: 2
address:
  - code: Some Institute of Technology
    address: Department, Street, City, State, Zip
  - code: Another University
    address: Department, Street, City, State, Zip
footnote:
  - code: 1
    text: "This is the first author footnote."
  - code: 2
    text: "Another author footnote."
abstract: |
  This is the abstract.

  It consists of two paragraphs.
keywords: 
  - keyword1
  - keyword2
journal: "An awesome journal"
date: "`r Sys.Date()`"
classoption: preprint, 3p, authoryear
# bibliography: mybibfile.bib
linenumbers: false
numbersections: true
# Use a CSL with `citation_package = "default"`
# csl: https://www.zotero.org/styles/elsevier-harvard
# geometry: "left=3cm,right=3cm,top=2cm,bottom=2cm"
output: 
  rticles::elsevier_article:
    keep_tex: true
    citation_package: natbib
# geometry: margin=2.54cm
header-includes:
  - \geometry{hmargin=2.5cm}
---

Please make sure that your manuscript follows the guidelines in the 
Guide for Authors of the relevant journal. It is not necessary to 
typeset your manuscript in exactly the same way as an article, 
unless you are submitting to a camera-ready copy (CRC) journal.

For detailed instructions regarding the elsevier article class, see   <https://www.elsevier.com/authors/policies-and-guidelines/latex-instructions>

# References {-}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71905074

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档