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

September 17, 2012

(This article was first published on Christopher Gandrud (간드루드 크리스토파), and kindly contributed to R-bloggers)

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 (간드루드 크리스토파). offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.


Mango solutions

RStudio homepage

Zero Inflated Models and Generalized Linear Mixed Models with R

Quantide: statistical consulting and training




CRC R books series

Six Sigma Online Training

Contact us if you wish to help support R-bloggers, and place your banner here.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)