In the cover page of the term paper I should include some information as instructor’s name, name of the course, and name of the university.
I added the instructor’s name and the course name and into the YAML header, but they are not shown in the PDF. Moreover, I do not exactly know how to include the name of the PDF, I cannot find a list of tags for the YAML header.
If possible, I would like to solve the problem without installing much software and packages, as it increases the cost of reproducing the code on another computer.
Here the YAML header I used:
---
title: "Cool title"
author: "My Self"
date: "31st February 2023"
instructor: "Dr. Professor"
course: "Econ 101"
output:
pdf_document:
latex_engine: xelatex
editor_options:
chunk_output_type: console
abstract: "This is my abstract, it will be about 100 words"
---
# Introduction #
My .rmd file now reads:
---
title: "My title"
author: "Fix"
date: "March 28, 2016"
output: pdf_document
---
And I'm looking to have it say something like:
---
title: "My title"
author: "Fix"
date: "March 28, 2016"
thanks: "Everybody that helped me!"
output: pdf_document
---
so that the thanks are included in the title page of the document...
The easier way is to use latex command \thanks:
---
title: "My title\\thanks{I am grateful to everybody that helped me!}"
---
It will output thanks as a footnote to the title. If you are unhappy with the format, you can also change your latex template and redefine \maketitle, for instance using usepackage{titling}.
I can't get ioslides to render latex equation. A simple example is:
---
title: "Title"
author: "Author"
date: "Tuesday, November 03, 2015"
output: ioslides_presentation
runtime: shiny
---
## slide 1
$\sum_{i=1}^n X_i$
The equation is rendered as \(\sum_{i=1}^n X_i\
Note that I'm able to get the proper rendering if I create the file as RPresentation but not as ioslides.
ioslides needs to know that it has to use mathjax
---
title: "Title"
author: "Author"
date: "Tuesday, November 03, 2015"
output:
ioslides_presentation:
mathjax: "http://example.com/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
runtime: shiny
---
## slide 1
$\sum_{i=1}^n X_i$
The equation is rendered as \(\sum_{i=1}^n X_i\
So it turned out I needed to change the reference to MathJax in the deck header to:
output:
ioslides_presentation:
mathjax: "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
Note that I previously had the following reference to MathJax (which did not work):
output:
ioslides_presentation:
mathjax: "http://example.com/mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
I have an Rmarkdown document which I'm outputting to Word and I'm trying to insert a company logo to the top of the page, above the header that includes the title and author.
I haven't found a solution to this. I've tried using pandoc_args to --include-in-header, but this wasn't successful. I'm not confident that I was using it correctly though.
Is it possible to include an image above the header?
---
title: "Untitled"
author: "r.bot"
date: "Thursday, January 1, 2015"
output:
word_document:
fig_caption: yes
fig_height: 5
fig_width: 5
reference_docx: template.docx
pandoc_args: [
"--include-in-header", "C:\\path\\to\\file.png"
]
---
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
This is possible using image headers in a Word template. In Word 2010 go: insert header -> image and add the image of choice. Save this document as template_image.docx in the same folder as the .Rmd file.
Then, in the YAML header:
---
title: "Untitled"
author: "Simon"
date: "Thursday, May 21, 2015"
output:
word_document:
fig_caption: yes
fig_height: 5
fig_width: 5
reference_docx: template_image.docx
---
Knit the .Rmd file and the output should include the image.
I'm trying to follow this pandoc example to add multiple authors to an Rmarkdown file in the yaml metadata block. The pdf will generate in RStudio (Version 0.98.932), but there is no author information.
---
title: 'This is the title: it contains a colon'
author:
- name: Author One
affiliation: University of Somewhere
- name: Author Two
affiliation: University of Nowhere
date: "`r format(Sys.time(), '%d %B %Y')`"
tags: [nothing, nothingness]
abstract: |
This is the abstract.
It consists of two paragraphs.
output: pdf_document
---
I'd also like to customize the heading a bit more and add a subtitle. Possible?
I just found out that it is possible to add subtitles to R markdown PDF output. I am using R 3.2.2 and RStudio 0.99.473 in Ubuntu 14.04.
---
title: 'This is the title: it contains a colon'
subtitle: 'This is the subtitle'
output: pdf_document
---
The default latex template in rmarkdown does not support author affiliations or subtitles. It does support multiple authors however, the correct yaml syntax is
---
title: 'This is the title: it contains a colon'
author:
- Author One
- Author Two
date: "`r format(Sys.time(), '%d %B %Y')`"
tags: [nothing, nothingness]
abstract: |
This is the abstract.
It consists of two paragraphs.
output:
pdf_document:
template: NULL
---
If you want to customize your header, the best approach is to modify the latex template, found here to suit your needs. Then copy it to your local directory and pass it to the header in the template field.
As explained in the main answer, the default R Markdown template does not support author affiliations. While users can edit the template file to add their own custom YAML fields, there are easier some workarounds you can use for PDF or HTML outputs.
HTML Outputs
You can use the recently released radix template. First you must install the package:
install.packages("radix")
Once installed, you must set the
---
title: "Radix for R Markdown"
description: |
Scientific and technical writing, native to the web
date: May 4, 2018
author:
- name: "JJ Allaire"
url: https://github.com/jjallaire
affiliation: RStudio
affiliation_url: https://www.rstudio.com
- name: "Rich Iannone"
url: https://github.com/rich-iannone
affiliation: RStudio
affiliation_url: https://www.rstudio.com
output: radix::radix_article
---
Your content
PDF Outputs
You can use premade templates, and there are some good examples within the rticles package. First we must install the package:
install.packages("rticles")
Once Installed, you can use one of the templates, such as the Journal of Statistical Software:
---
author:
- name: FirstName LastName
affiliation: University/Company
address: >
First line
Second line
email: \email{name#company.com}
url: http://rstudio.com
- name: Second Author
affiliation: Affiliation
title:
formatted: "A Capitalized Title: Something about a Package \\pkg{foo}"
# If you use tex in the formatted title, also supply version without
plain: "A Capitalized Title: Something about a Package foo"
# For running headers, if needed
short: "\\pkg{foo}: A Capitalized Title"
abstract: >
The abstract of the article.
keywords:
# at least one keyword must be supplied
formatted: [keywords, not capitalized, "\\proglang{Java}"]
plain: [keywords, not capitalized, Java]
preamble: >
\usepackage{amsmath}
output: rticles::jss_article
---
If you render a pdf, LaTex use authors' footnote for affiliations (i.e. converting numbering in symbles). Try
---
title: 'This is the title: it contains a colon'
subtitle: 'This is the subtitle'
author:
- Author One^[University of Somewhere]
- Author Two^[University of Nowhere]
date: "`r format(Sys.time(), '%d %B %Y')`"
tags: [nothing, nothingness]
abstract: |
This is the abstract.
It consists of two paragraphs.
output: pdf_document
---
I've found a solution to your subtitle part of the question here: https://stackoverflow.com/a/41444545/14027216
You can add subtitle by adding subtitle: to your code and multiple subtitles can be added as follow:
---
title: 'This is the title: it contains a colon'
subtitle: |
| 'subtitle 1'
| 'subtitle 2'
author:
- name: Author One
affiliation: University of Somewhere
- name: Author Two
affiliation: University of Nowhere
date: "`r format(Sys.time(), '%d %B %Y')`"
tags: [nothing, nothingness]
abstract: |
This is the abstract.
It consists of two paragraphs.
output: pdf_document
---
You can add more than two subtitles, but I don't know the maximum amount. Each subtitle will be displayed in new line.
I've also had this problem. Following the suggestion from #tmpname12345 I modified the latex template (default.tex) and the html template (default.html) to render subtitles. This pull request is on github rstudio/rmarkdown if you want the code quickly, and looks like it will be standard in rmarkdown next time they push to CRAN.
Add to the answer by Ze Grisi, i just discovered adding html heading tags into the yaml works to adjust the font in the title and subtitle. Note the quotation marks are no longer needed.
---
title: 'This is the title: it contains a colon'
subtitle: <h1>This is the subtitle</h1>
output: pdf_document
---
For a more dramatic effect add an underline to the subtitle
---
title: 'This is the title: it contains a colon'
subtitle: <h1><u>This is the subtitle</u></h1>
output: pdf_document
---
Using a solution for latex here enter link description here by #greg. I put the latex code into rmarkdown yaml header with some changes and it does the job.
---
title: 'Some Title'
author: Author One$^1$ \and
Author Two$^2$ \and
Author Three$^3$
date: $^1$Organization 1 \newline
$^2$Organization 2 \newline
$^3$Organization 3
\newline
\newline
\today
output:
---
The trick is to put the affiliations into date tag.