17 September 2012

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

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.

2 comments:

jkeirstead said...

Hi Christopher,

I had the same problem too and created a Python-based solution which I called Lectures. It's reasonably similar to your approach and I hope to add some new features in the coming term.

James

Christopher Gandrud said...

James

Nice, I like your solution to the problem too.