R Markdown affiliation doesn't appear in the pdf-document - r

I want to add the affiliation and the e-mail adress in a pdf-article in r-markdown. But with my code the affiliation and the e-mail adress doesn't appear.
Can someone tell me what I'm doing wrong?
---
title: "title"
subtitle: "subtitle"
date: "`r format(Sys.time(), '%B %d, %Y')`"
keywords: "keywords"
author:
-name: My Name
affiliation: University of somewhere
email: test#e-mail.com
output:
pdf_document:
fig_cap: yes
keep_tex: yes
bibliography: references.bib
biblio-style: "apalike"
link-citations: true
documentclass: article
capsize: normalsize
fontsize: 11pt
geometry: margin=1in
spacing: doublespacing
footerdate: yes
abstract: 'Insert abstract here'
---
Here is the Output with the help of the BiocManager-package.

Two things :
Space between "-" and "name" ?
Did you import BiocStyle 2.11.0 ?
src : https://www.bioconductor.org/packages/devel/bioc/vignettes/BiocStyle/inst/doc/AuthoringRmdVignettes.html
It's only a supposition, hope it'll do the job !

The regular pdf_document output format doesn't support affiliation etc. You need to output to BiocStyle::pdf_document. You also have the formatting for the author specification wrong, which causes troubles.
---
title: "title"
subtitle: "subtitle"
date: "`r format(Sys.time(), '%B %d, %Y')`"
keywords: "keywords"
author:
- name: My Name
affiliation: University of somewhere
email: test#e-mail.com
output:
BiocStyle::pdf_document:
fig_cap: yes
keep_tex: yes
bibliography: references.bib
biblio-style: "apalike"
link-citations: true
documentclass: article
capsize: normalsize
fontsize: 11pt
geometry: margin=1in
spacing: doublespacing
footerdate: yes
abstract: 'Insert abstract here'
---
To install BiocStyle if you haven't already got it, you first need to install BiocManager in the regular way, then use it to install BiocStyle:
install.packages("BiocManager")
BiocManager::install("BiocStyle")

Related

Add space between Author, Date, and Abstract in YAML header

My YAML header looks like this, and I would like to change only the space between the author/date, and abstract.
How can I achieve this? I have tried using \vspace{1cm} after the date (failed), and also at the start of the abstract text, but that only spaces the text, and not "Abstract" itself.
Any ideas?
---
title:
subtitle:
author: "Me "
date: "`r format(Sys.time(), '%B %d, %Y')`"
abstract: "The document shows the answer to all questions & the output (as it relates to each)"
output:
pdf_document:
keep_tex: false
toc: false
---
With an up-to-date latex installation, you can use the hook system to add a bit of space before the abstract environment or the \#date macro which inserts the date:
---
title: "test"
subtitle:
author: "Me "
date: "`r format(Sys.time(), '%B %d, %Y')`"
abstract: "The document shows the answer to all questions & the output (as it relates to each)"
output:
pdf_document:
keep_tex: false
toc: false
header-includes:
- \AddToHook{env/abstract/before}{\vspace*{4cm}}
- \makeatletter\AddToHook{cmd/#date/before}{\vspace*{4cm}}\makeatother
---
\maketitle
test

How to output with R Markdown in foreign languages?

I'm trying to write a document in Ukrainian/Russian using R markdown to output to a pdf, but the characters don't render. For example, my title 'Мова чи/или язык' just appears as '/'. Is there a package or setting that can accommodate foreign langauges?
Below is an example
title: "Мова чи/или язык"
date: "3/7/2021"
output:
pdf_document:
latex_engine: xelatex
It's really hard to find easy way to do it. My suggestion is :
title: "Заглавие по руски или българкси"
author: "Име"
output:
pdf_document:
keep_tex: yes
latex_engine: xelatex
html_document: default
mainfont: Tempora
fontsize: 11pt

Using custom LaTeX class changes numbering in R Markdown

I recently discovered that you can include your own LaTeX class in an R-Markdown doc to change the appearance of the PDF. Here is a minimal example:
R Markdown
---
title: "Test"
date: "`r format(Sys.time(), '%d %B, %Y')`"
documentclass: book
output:
pdf_document:
citation_package: natbib
toc: yes
toc_depth: 3
number_sections: true
fontsize: 12pt
---
# A
## AA
### AAA
### AAA
## AB
# B
This works as intended.
But when I define my own class, the numbering is preceded by 0s and the page numbering is off.
myclass.cls
I place a file called "myclass.cls" in the same direcoty as the RMD file above and change documentclass: myclass:
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{glasgowthesis}
\LoadClass{book}
My understanding is that this should simply call the same class as above but the file now looks like this:
Maybe somebody can give me a hint what I'm doing wrong. I would like to copy the book class 1:1 before starting to change things.
I found the solution in the bookdown book and wanted to share it in case anyone wanders off to this question through google etc.
Note that when you change documentclass, you are likely to specify an
additional Pandoc argument --top-level-division=chapter so that Pandoc
knows the first-level headers should be treated as chapters instead of
sections (this is the default when documentclass is book)
So this YAML header solved the issue:
---
title: "Test"
date: "`r format(Sys.time(), '%d %B, %Y')`"
documentclass: myclass
output:
pdf_document:
pandoc_args: --top-level-division=chapter
citation_package: natbib
toc: yes
toc_depth: 3
number_sections: true
fontsize: 12pt
---
# A
## AA
### AAA
### AAA
## AB
# B

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.

How to wrap output in R markdown using pdf_document

How do I get this result in which both the source code and the output appear wrapped by a line in R markdown using a pdf_document.
My yaml is configured as follows:
---
title: 'Applied Econometrics using R'
subtitle: 'Federal University of Paraiba'
author: 'Alexandre Loures'
date: "`r Sys.Date()`"
documentclass: book
bibliography: [econometrics.bib]
biblio-style: apalike
link-citations: yes
colorlinks: yes
lot: yes
lof: yes
output:
html_document:
theme: united
pdf_document:
highlight: tango
description: "A book example for a Chapman & Hall book."
github-repo: yihui/bookdown-crc
graphics: yes
#cover-image: images/cover.jpg
---

Resources