Site icon R-bloggers

Create Beamer/knitr Lecture Slideshow with Bash, Explain the Script with knitr

[This article was first published on Christopher Gandrud (간드루드 크리스토파), and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Setting up a beamer slideshow is tedious. Creating new slideshows with the same header/footer/style files every week for your course lectures is very very tedious.

To solve this problem I created a simple bash shell script. When you run the script in your terminal it asks whether you want to create a “Lecture” or “Seminar” and what number you want it to have. Then it does the rest.

You can find the script and all of the necessary files here.

To create the README file I used knitr version 0.8’s new engine='bash' option. This allows you to knit bash code into your Markdown file the same what you would R code. It’s pretty simple. See the R Markdown file for more details.

Please feel free to take and modify the files. Also, if you can help streamline them that would be great.

Oh kind of related tip: If you want a bash command to show up over more than one line in your knitted document place a backslash (\) at the end of the line.


The beamer theme I use is based on something I hammered together awhile ago. See this post for more details.

To leave a comment for the author, please follow the link and comment on their blog: Christopher Gandrud (간드루드 크리스토파).

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.