I am trying to set margins in elsevier_article with little success. This post suggests using geometry to set the margins but I am getting the following error:
! LaTeX Error: Option clash for package geometry.
I also tried adding the following latex commands in the preamble but none does change the margins in the output PDF:
header-includes:
- \PassOptionsToPackage{left=2.5cm,right=2.5cm,top=2.5cm,bottom=2.5cm}{geometry}
header-includes:
- \PassOptionsToPackage{margin=2.5cm}{geometry}
I need 2.5 cm on either sides of the pages. Below is something to work with. It is just the default template that one can access from Rstudio (I removed a few things that are not necessary):
---
title: Short Paper
author:
- name: Alice Anonymous
email: [email protected]
affiliation: Some Institute of Technology
correspondingauthor: true
footnote: 1
- name: Bob Security
email: [email protected]
affiliation: Another University
- name: Cat Memes
email: [email protected]
affiliation: Another University
footnote: 2
- name: Derek Zoolander
email: [email protected]
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 {-}
CodePudding user response:
The header-includes
are too late to use \PassOptionsToPackage{...}
, this macro needs to used before the documentclass, which would be a bit difficult to do in rmarkdown.
Instead you can use \geometry{...}
to change the settings after the package is already loaded.