noframenumbering: no page number for specific slides in rmarkdown::beamer_presentation - r

In a LaTex beamer presentation generated with rmarkdown::beamer_presentation, how can I remove the slide numbers for specific slides?
Since the slides contain plots and tables generated by R-markdown, plain LaTex approaches like the attempt below likely won't work.
``` {=latex}
\begin{frame}[noframenumbering]{Frame name}
Frame without slide number but with Rmd-generated tables and plots.
- All other frames still have slide numbers.
\end{frame}
```

The noframenumbering option is not what you think it is. It is to exclude the frame from being counted.
To remove the footline with the page numbering, you can use the plain option:
---
output:
bookdown::pdf_book:
base_format: rmarkdown::beamer_presentation
theme: "THEMENAME"
slide_level: 2
keep_tex: true
---
## Slide 1 {.noframenumbering}
test
## Slide 2 {.plain}
test
## Slide 3
test

Related

How can I change the number of columns several times in an R Markdown pdf document?

I am creating a .pdf using R Markdown. I would like to have a section of text in two column format, and then follow that with a graph (or table, photo, etc.) that takes up the entire width of the page, and then return to two column text. I am new at Markdown / LaTex / Pandoc and I cannot figure out how to do it.
This answer by #AlisonShelton appears to be what I want, but when I run it I get this error in the RStudo R Markdown console:
! Undefined control sequence.
l.87 \btwocol
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
I have successfully used this method by #scoa to make a two column .pdf, but I don't know how go back and forth between one and two columns using this.
Here is some sample code for testing purposes
---
title: "Test"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Two columns of text
This seciton should be in two column format.
Here are a bunch of ? to make it longer: ???????????????????????????????????????????????????????????????????????????????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
??????????????????????????????????????????????????????????????????????????????????????????????????????????????????
## Once column section.
This part should be the whole page width
```{r plot}
plot(rnorm(20),rnorm(20))
```
## Now 2 columns again
This section should go back to two columns !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
What you can do is first, to add -- as you stated -- pandoc_args: ... into your YAML header. Second, there are a few LaTeX solutions around (like this or this one) which won't work for RMarkdown. The only way I found so far is to use \onyecolumn / \twocolumn -- just with the drawback of the page breaks. But perhaps you can live with it until there's a better solution.
---
title: "Test"
output:
pdf_document:
pandoc_args: [
"-V", "classoption=twocolumn"
]
html_document: default
header-includes:
- \usepackage{lipsum} # just used for producing example text in document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Two columns of text
\lipsum[1-7]
\onecolumn
## Once column section.
This part should be the whole page width
```{r plot}
plot(rnorm(20),rnorm(20))
```
\lipsum[1]
\twocolumn
## Now 2 columns again
This section should go back to two columns
\lipsum
\begin{table*}
This is nice, but won't work with R chunks or headers. And you'll have to format with LaTeX code (e.g. \textbf{Foo blaah}).
\lipsum[1]
\end{table*}
\lipsum

Incremental code evaluation in R markdown presentation

I'm looking for a way to evaluate code in a incremental way in R markdown presentation. I don't need to use any specific format - it can be anything that works and is flexible (rpres, ion, revealjs, etc.)
I'll use these presentation in class for my students and would like to make them type code in their R Console first and then compare our outputs.
So far I came up with one solution using revealjs with slide_level header
---
title: "Test presentation"
output: revealjs::revealjs_presentation
slide_level: 2
---
# Level 1 horizontal main slide
Some text
## Level 2 vertical slide with R Code
```{r eval=FALSE}
summary(cars)
```
## Level 2 vertical slide with R output
```{r echo=FALSE}
summary(cars)
```
Anything easier and less time consuming would be great.
I know the question is a bit old but you can use the incremental option for example with ioslides. That way you don't have to change slide but you can print step by step first the text then the code and then the result.
example code:
---
title: "Test presentation"
output:
ioslides_presentation:
incremental: yes
---
## Slide 1
- Some text
- Level 2 just the code
```{r eval=FALSE}
summary(cars)
```
- Level 2 just the output
```{r echo=FALSE}
summary(cars)
```

rmarkdown beamer presentation: how to not print section slides?

I am writing a beamer presentation in rmarkdown and converting it to pdf with knitr. I want to define sections at the header1 level, e.g. # Introduction, and then have a slide titled something else e.g. ## Introducing my brilliant research. Having the header1 level define sections is nice as the names of the sections can be displayed in the slide header in certain beamer themes, and this is why I include it.
But I do not want rmarkdown to insert a slide that simply says the name of the section between sections, which at the moment it is doing. Is there a way to not print a slide with the section name between sections? I thought slide_level would control this behavior but it does not seem to (or perhaps I am using it wrong).
A minimal reproducible example of my problem can be obtained with this code:
---
title: "Test Pres"
author: "Professor Genius Researcher"
date: "24 February 2017"
output:
beamer_presentation:
slide_level: 2
theme: "Singapore"
colortheme: "rose"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
# Markdown Intro
## R Markdown
This is an R Markdown presentation. 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.
# Using Bullets
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
# Including Chunks
## Slide with R Output
```{r cars, echo = TRUE}
summary(cars)
```
## Slide with Plot
```{r pressure}
plot(pressure)
```
At the moment, this code produces slides that say Markdown Intro, Using Bullets, and Including Chunks. I would like those slides labeling the sections omitted. Is this possible?
Create a new Latex template where you remove this part from the preamble:
\AtBeginSection[]
{
....
}
Place this latex template in the same folder as your .Rmd file and refer to it in the Rmd Yaml front matter using template: mytemplate.tex as explained here.

rmarkdown Table of Contents not being populated

I have a simple test .Rmd script which I am using to generate a PDF file with the rmarkdown render function.
When I set the toc to be true, the second PDF page is a blank white page and I would expect to see 'Slide With Bullets' and 'Slide with R Code and Output' to be in there.
Does anyone know how to format the slide titles so that they appear in the table of contents?
---
title: "test"
author: "test"
date: '2015-10-29'
output: beamer_presentation
toc: true
---
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
## Slide with R Code and Output
```{r}
summary(cars)
```
According to the documentation toc only works with level 1 headings. So the code below will create a table of contents to the title slide. I can't get it to work with slides that contain content though. Maybe this is how the table of contents is designed to work???
---
title: "Untitled"
output:
beamer_presentation:
toc: yes
---
# A Title Slide:
## Slide with Bullets
- Bullet 1
- Bullet 2
- Bullet 3
## Slide with R Code and Output
```{r}
summary(cars)
```

How to add table of contents in Rmarkdown?

I am using RStudio for writing markdown documents and want to add Table of Contents (TOC) at top of the documents so that the user could click the relevant section for reading. There were some relevant examples on rpubs but now I can't seem to find them. Please note that I don't use pandoc and am quite new to Rmd & knitr. Is there any way to add TOCs without using pandoc? If using pandoc is must then which functions are relevant?
EDIT
Here's a small sample page:
---
title: "Sample Document"
output:
html_document:
toc: true
theme: united
---
Header 1
---------------
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>.
## Header 2
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:
```{r}
summary(cars)
```
You can also embed plots, for example:
```{r, echo=FALSE}
plot(cars)
```
### Header 3
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
I tried running this in RStudio v 0.98.864 and it worked! but sadly it didn't work on 0.98.501 and 0.98.507. I am working on my thesis in 0.98.501 and after updating RStudio, some of my analyses didn't work. So, I reverted back to 0.98.501.
What should I do now? I really want TOCs but without harming the outputs of other analyses.
The syntax is
---
title: "Sample Document"
output:
html_document:
toc: true
theme: united
---
in the documentation. Make sure this is at the beginning of your document. Also make sure your document actually has headers otherwise R can't tell what you want in the table of contents.
Syntax with more options:
---
title: "Planets"
author: "Manoj Kumar"
date: "`r format(Sys.time(), '%B %d, %Y')`"
output:
html_document:
toc: true # table of content true
toc_depth: 3 # upto three depths of headings (specified by #, ## and ###)
number_sections: true ## if you want number sections at each table header
theme: united # many options for theme, this one is my favorite.
highlight: tango # specifies the syntax highlighting style
css: my.css # you can add your custom css, should be in same folder
---
If you are using pdf_document, you might want to add table of contents in a new page, which toc: true does not allow. It puts the table of contents right after the document title, author and date--because it is in yaml.
If you want to have it in a new page, you have to use some latex language. Here is what I did.
---
title: \vspace{3.5in}"Title"
author: "Name"
date: "`r Sys.Date()`"
output:
pdf_document:
fig_caption: true
number_sections: true
---
\newpage # adds new page after title
\tableofcontents # adds table of contents
\listoffigures
\listoftables
\newpage
So, after yaml (the chunk between ---), I added a new page using \newpage, then a table of contents using \tableofcontents, a list of figures using \listoffigures, a list of tables \listoftables, and a new page before everything else.
Note, \vspace{3in} in the title adds vertical space of 3 inch from the top before printing yaml (title, etc.).
Read more here: https://www.sharelatex.com/learn/Table_of_contents

Resources