How to add new yaml headers in Rmarkdown (pagedown)? - r

I've seen these header in the thesis template's yaml header that comes with pagedown package Can I add some other categories like: period, surname, deadline, any? Are these predefined with the thesis template? Can I create my own template with some particular yaml headers?
author
degree
institute
faculty
etc
title: A paged html thesis template for R Markdown users
subtitle: A {pagedown} template.
author:
- name: William Brent Thorne
edu: BSc
degree: Master of Documentation
institute: Typeset University
faculty: Reproducibility and FOSS
department: Templates
location: St. Catharines, ON
date:
- year: 2019
month: August
sign_page: true
dedication: A dedication line or two goes here.
abstract: This is the abstract.
preface: A preface to the thesis.
acknowledge: Put the ackknowledgements here.
committee:
- name: Jane Doe III
prefix: Dr
position: Chair of Department
- name: John Smith
prefix: Dr
position: Faculty Advisor
lof: true
lot: true
toc-title: Contents
output:
pagedown::thesis_paged:
toc: true
number_sections: yes
pandoc_args: --mathjax
self_contained: no
bibliography: packages.bib
link-citations: yes
# uncomment this line to produce HTML and PDF in RStudio:
knit: pagedown::chrome_print
---

Related

Customizing the output of rticles::elsevier_article document class in r

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: 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 {-}
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.
Full code:
---
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 {-}

Not finding my bookdown bibliography file

My document is simply this
---
title: "The Visual Speech (VISP) Handbook"
author: "Fredrik Karlsson & Linda Sandström"
site: bookdown::bookdown_site
documentclass: book
output:
bibliography: references.bib
#bookdown::pdf_book: default
bookdown::gitbook: default
biblio-style: "apalike"
link-citations: true
---
# Preface {-}
[#R-base]
and I have a reference file:
> dir(pattern = "*.bib")
[1] "references.bib"
but I am unable to find this bib file when knitting the book:
Error in eval(parse(text = name)) : object 'references.bib' not found
Calls: ... create_output_format ->
create_output_format_function -> eval -> eval Please delete _main.Rmd
after you finish debugging the error. Execution halted
Any ideas on how to set this up properly (in Rstudio)
Thanks!
Fredrik
It's just a location problem in the code (see more information here).
You could try:
---
title: "The Visual Speech (VISP) Handbook"
author: "Fredrik Karlsson & Linda Sandström"
site: bookdown::bookdown_site
documentclass: book
output:
#bookdown::pdf_book: default
bookdown::gitbook: default
bibliography: references.bib
biblio-style: "apalike"
link-citations: true
---
# Preface {-}
[#R-base]

rticles and rmarkdown not removing table of contents

I cannot seem to remove the table of contents from my RMarkdown pdf document. I have tried a number of different things such as.
Changing toc: no to false
using differrent base_format: rticles::ieee_article artiles from the getNamespaceExports("rticles").
removing csl: elsevier-harvard.csl
Nothing seems to work and everytime I compile the table of contents appears - what am I missing?
Markdown:
---
title: some title
author:
- name: some name
email: some email
affiliation: some department
footnote: some footnote
- name: some name
email: some email
affiliation: some department
footnote: 2
footnote:
- code: 1
text: "Corresponding Author"
- code: 2
text: "Corresponding Author"
abstract: |
some abstract here
journal: "An awesome journal"
date: "`r Sys.Date()`"
bibliography: mybibfile.bib
#linenumbers: true
#numbersections: true
csl: elsevier-harvard.csl
output:
bookdown::pdf_document2:
base_format: rticles::ieee_article
number_sections: no
toc: no
tables: true
header-includes:
- \usepackage{floatrow}
- \floatplacement{figure}{H}
- \usepackage{booktabs}
- \usepackage{array}
---
Try to format your output section of the YAML header as follows:
output:
bookdown::pdf_document2:
number_sections: no
toc: no
tables: true
base_format: rticles::ieee_article
Then the TOC should disappear. I hope that the base_format argument will be taken into consideration. Please try and report.

remove facebook and twitter links in `bookdown` in R, Rmarkdown

I am using the bookdown package in R to write a gitbook, but I don't want the final book to have the sharing links to facebook, twitter. I am using something like this in the YAML
---
title: "A Minimal Book Example"
author: "SN"
date: "`r Sys.Date()`"
output:
bookdown::gitbook
gitbook_config:
sharing:
facebook: false
twitter: false
documentclass: book
link-citations: yes
description: "This book ... ."
---
but I am getting an error
Error in yaml::yaml.load(enc2utf8(string), ...) :
Scanner error: mapping values are not allowed in this context at line 6, column 19
Calls: <Anonymous> ... yaml_load_utf8 -> mark_utf8 -> <Anonymous> -> .Call
Execution halted
Can anyone help me in setting options in YAML so that no sharing options show up in the final rendering?
thanks!
SN
Two mistakes:
You omitted a colon after bookdown::gitbook;
gitbook_config should be config.
---
title: "A Minimal Book Example"
author: "SN"
date: "`r Sys.Date()`"
output:
bookdown::gitbook:
config:
sharing:
facebook: false
twitter: false
documentclass: book
link-citations: yes
description: "This book ... ."
---

Customising R markdown pdf document

I am trying to accommodate multiple authors and affiliations as follows.
---
title: "Title"
author: |
| Author1^1^, Author2^2^, Author3^1^ and Author4^2^
| 1. Affiliation1
| 2. Affiliation2
date: "Wednesday, April 10, 2015"
output:
pdf_document
---
With above I am getting
How to modify the default R markdown Yaml header to get customised output in the author field? I would like to.
Avoid italics for affiliation.
Have some space between author and affiliation (Empty line with | does not work).
Reduced font size for affiliation alone.
I was looking a good way to add different affiliations with an elsevier template within 'rticles' and i could do it like this:
---
title: Title
author:
- name: Sergio Ibarra Espinosa^a^
email: sergio.ibarra#iag.usp.br
- name: María de Fátima Andrade^a^
- name: Seaghán Mhartain^b^
- name: Rita Yuri Ynoue^a^
address:
- code: 1
address: Instituto de Astronomía, Geofísica e Ciências Atmosféricas, Universidade de São Paulo
- code: 2
address: Faculdade de Medicina, Universidade de São Paulo
abstract: abstract
It consists of two paragraphs.
bibliography: mybibfile.bib
output: rticles::elsevier_article
---
which produced the following result:
I hope it can help

Resources