R Shiny: Latex equations are not properly rendered - r

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"

Related

Specify custom powerpoint theme in R markdown

I am using R markdown to create a presentation. Here's a sample code:
---
title: "Untitled"
author: "April 2018"
date: "4/9/2019"
output: powerpoint_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## Slide with Plot
```{r pressure, fig.width=30, fig.asp=0.618,
out.width="200%"}
plot(pressure)
```
I want to apply a custom template that is specified by my organisation. How do I specify the custom theme? I read online that this can be specified by:
---
title: "Untitled"
author: "April 2018"
date: "4/9/2019"
output: powerpoint_presentation:
reference_doc: my_theme.pptx
---
But how does this work? Where do I have to store the my_theme.pptx file?
I hope you don't need this answer now, but just in reference for all of the guyz who were seeking for the answer like me.
Go to >> R\win-library\version e.g. 4.0\officer >>> paste your custom template on this path.
It will work

How do you get knitr PDf on an .rmd file to affect the title parameters?

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}.

R Markdown ioslides institution name [duplicate]

How to add author affiliation in a new line in an rmarkdown beamer presentation?
---
title: "This is the title"
author: "Author"
date: "Thursday, April 09, 2015"
output: beamer_presentation
---
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
The desire title slide should be
This is the title
Author
Affiliation
Thursday, April 09, 2015
If you use pipes | you can break the author line into multiple lines:
---
title: "The title"
author: |
| The author
| The affiliation
date: "9 April 2015"
output: beamer_presentation
---
Output:
Edit (can we play with the title and author/affiliation fonts?):
If you want to change the different font sizes, I recommend playing with the includes: in_header option of your presentation's header (check this RStudio link for specifics).
This points to a simple .tex file on your computer where you can add LaTeX commands specifically for your presentation's preamble. You could therefore have a file called preamble.tex in your Desktop, and use the \setbeamerfont{XX}{size={\fontsize{YY}{ZZ}}} command, where XX is the specific thing you want to change (title, author); YY is the font size to apply; and ZZ is the skip line (in pt) (also see this link for more details).
So for your example, we have:
preamble.tex file at your Desktop (or wherever you want) containing just two lines:
\setbeamerfont{title}{size={\fontsize{30}{25}}}
\setbeamerfont{author}{size={\fontsize{5}{20}}}
Your foo.Rmd file:
---
title: "The title"
author: |
| The author
| The affiliation
output:
beamer_presentation:
includes:
in_header: ~/Desktop/preamble.tex
---
## R Markdown
This is an R Markdown presentation.
Markdown is a simple formatting syntax for
authoring HTML, PDF, and MS Word documents.
And the output will be:
and you should be able to have multiple authors and institutions
title: This is the title
author:
- Author Juan$^1$
- Author Tu$^2$
institute:
- $^1$Juans Casa
- $^2$Tus Place
date: "Thursday, April 09, 2015"
output:
beamer_presentation
The proper way to deal with affiliation in beamer is through \institute{} (see this answer on tex.SE).
Current solution (pandoc version >= 1.17)
Starting with pandoc 1.17, the institute field is present in the default beamer template, so all you need to do if you have the proper version is:
---
title: "This is the title"
author: "Author"
institute: "Affiliation"
date: "Thursday, April 09, 2015"
---
Old answer
Might be needed if you use an older pandoc version (< 1.17) or while rmarkdown's default beamer template has not been updated.
To make this work with pandoc, you could edit your beamer template. If you have not edited it yet, you can create it with:
pandoc -D beamer > ~/.pandoc/templates/default.beamer
Then, open the file and add this after the author information:
$if(institute)$
\institute[]{$institute$}
$endif$
Finally, add the institute option to your yaml:
---
title: "This is the title"
author: "Author"
institute: "Affiliation"
date: "Thursday, April 09, 2015"
---
If you are using rmarkdown, you may have to specify the template:
---
title: "This is the title"
author: "Author"
institute: "Affiliation"
date: "Thursday, April 09, 2015"
output:
beamer_presentation:
template: ~/.pandoc/templates/default.beamer
---
There are two advantages to using this over a multiline author.
some beamer theme use the author field and/or the institute field, for instance to repeat it at the bottom of each slide. A multiline author would mess this up.
this allow for a finer control of the title slide elements: you can have a different font family and size for author and affiliation information for instance:
\setbeamerfont{institute}{size={\fontsize{5}{20}}}

How to change table of content header in knitr?

I am using the following options to produce a pdf document with knitr:
---
title: "Test"
author: "Paulo Miramor"
date: "13-07-2015"
output: pdf_document
toc: yes
---
I would like to change the header of the table of contents (which is "Contents"), since I am producing a document in Portuguese. Is there any way to customize it?
Thanks to #Molx and #Chris in the comments I could find a solution.
Solution 1
Add \renewcommand{\contentsname}{Índice} to the document so that the .Rmd header is:
---
title: "Test"
author: "Paulo Miramor"
date: "13-07-2015"
output: pdf_document
header-includes:
- \renewcommand{\contentsname}{Whatever}
toc: yes
---
With this solution the header is Whatever you put inside \contentsname argument.
Solution 2
Add lang: portuguese to the document so that the .Rmd header is:
---
title: "Test"
author: "Paulo Miramor"
date: "13-07-2015"
output: pdf_document
lang: portuguese
toc: yes
---
Using this solution the header was a translation of "Contents" to Portuguese. This should work if your TeX installation supports the language.

Rmarkdown to Word output - insert image above header

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.

Resources