I built an interactive shiny presentation in Rstudio. Header of the .Rmd file is:
---
title: "title"
author: "author"
date: "date"
output:
ioslides_presentation:
mathjax: "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
runtime: shiny
---
I generate really nice slides with interactive elements. No problem. However, I cannot knit the document as html or pdf files. I think this's by design since I specifically select "runtime: shiny". Is there an alternative way to capture the presentation as pdf/html file even if it means loss of the interactive elements? The only solution I could come up with is capture a screenshot for every slide from the browser and save it separately. But this's laborious...
You can Knit on-demand screenshots of the app by following these instructions.
Related
Have tried styling MS Word document from the markdown but I don't seem to get it write. What could I not be doing right? Below is the code
---
title: "Test Document"
author: "Moses Otieno"
date: "05/04/2021"
output:
word_document:
reference_docx: referent-doc.docx
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
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>.
## Test
This is the test
Referent Document https://www.dropbox.com/scl/fi/dyww5eiga334j55t58vcp/referent-doc.docx?dl=0&rlkey=o1ejilu3dfnncar65irh5er7v
Resulting document https://www.dropbox.com/scl/fi/mieqkcvy22eeighdjaby3/Test.docx?dl=0&rlkey=8wyrci2cg0ijyxbfdw5ks1znh
In a nutshell, make a template using an already knitted document containing your content and different types of headers etc.
I had a similar problem that was fixed by knitting my document and saving the resulting word(.docx) as "template". I now had a good working file with lots of content examples.
Next, I went into this file and manually changed the styles using "styles" in the Home tab. Open up this feature in your new "template" document by using the little down arrow on the bottom right-hand corner. Click on the various paragraphs and headers in your document to see what they refer to (the style will jump about on the dropdown menu) and make your changes. Save again. Now when you want to knit a new document, it will hopefully apply your changes.
Be aware that you might get caught out by the "Body Text" and "First Paragraph", so you might need to change both of these separately.
output:
word_document:
reference_docx: template.docx
In the YAML part of your project, you have to change your referent.docx into "referent-doc.docx", surrounded by quotation marks (" "):
output:
word_document:
reference_docx: "referent-doc.docx"
# quoted with quotation marks, and here located in the same folder
P.S. Be sure to produce a good reference_doc: You need to start from a .docx file which is produced by markdown (e.g., using the knit button), in order to get a few titles, texts, figs and tables into a .docx. Then edit the styles; margin, etc. from Microsoft Word, and save it to a .docx file.
I've been trying to solve some HTML knitting issues. My HTML does not currently allow me to use HTML in the code, and thus I am unable to create tabsets.
However, while trying to solve that issue a new issue occured: My HTML output adds a clickable # behind each # Header.
I use the basic Rmarkdown format:
---
title: "Try"
output: html_document
---
/```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
/```
## R Markdown
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>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
## Including Plots
And then the output shows me this:
Anyway have any idea how to solve this?
This is a new feature introduced in the current development version of rmarkdown. See the NEWS file for more info. To disable this feature, you may use:
output:
html_document:
anchor_sections: false
I'm writing a presentation in R using RStudio. To create new presentation, I select "R Presentation" from the File => New File menu. RStudio creates new document. Here is the template:
New Presentation
========================================================
author:
date:
First Slide
========================================================
For more details on authoring R presentations click the
**Help** button on the toolbar.
- Bullet 1
- Bullet 2
- Bullet 3
Slide With Code
========================================================
```{r}
summary(cars)
```
Slide With Plot
========================================================
```{r, echo=FALSE}
plot(cars)
```
Once a presentation is created, it can be saved as an HTML. However, I cannot find an option to make it a self-contained HTML file.
As a counter-example, I can create a self-contained HTML file using Rmarkdown:
---
title: "Habits"
output:
ioslides_presentation:
mathjax: local
self_contained: false
---
Source: http://rmarkdown.rstudio.com/ioslides_presentation_format.html
What is the equivalent of this code in RStudio R Presentation?
Additionally, does anyone know why they did it both ways?
SOLVED (09/25/2017)! See Nova's answer below. Here is a screenshot to show how I did it:
I've been able to "export" the presentation to html by going to the "Presentation" tab in RStudio, clicking the gear shift icon where it says "More", and choosing "Save as Webpage". This saved a stand-alone .html file that works when I open it from a different folder location.
By default the PDF documents created by the Knit PDF are US Letter size. Instead I would like to create A4 size documents. I have a feeling this should simple to change, either in the RStudio GUI or by adding an option to the metadata at the top of the Rmd file. Unfortunately I can't find any instructions how to do this. Is there a way to specify paper size, preferably within the Rmd file itself? I am still using RStudio version 0.98.953 but can upgrade if it would help.
I'd be grateful if someone could point me in the right direction.
OK, so I figured it out. In the .Rmd file's header, options documentclass and classoption get written into the preamble of the resulting .tex file. The article document class accepts a number of paper size options including a4paper. The header in the .Rmd file will then look something like this:
---
title: "Title"
author: "Name"
date: "Date"
output:
pdf_document
documentclass: article
classoption: a4paper
---
For more information see: http://rmarkdown.rstudio.com/pdf_document_format.html
At least in newer versions of the rmarkdown R package (and Pandoc) you can just set:
---
output: pdf_document
papersize: a4
---
I would like to save the presentation generated by knitr as a html file. Which I am able to share with people as standalone html file.
If I use Run Document button in R studio (server) this generates a file with the .Rmd extension.
---
title: "Standalone"
author: "MarketRedesign"
date: "10-7-2014"
output: ioslides_presentation
---
## Slide with R Code and Output
```{r}
summary(cars)
```
When you press the knit HTML button, a HTML file IS always created by RStudio in the same directory as the R Markdown file lives in. The HTML file will also have the same name as the R Markdown file that was used to create it.