Skip to content

KU Leuven R/Markdown, plain Markdown and LaTeX templates

License

Notifications You must be signed in to change notification settings

tomfrancart/kuleuven-templates

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

KU Leuven R/Markdown/LaTeX templates

Build Status

Latest version and bugreports on Github: https://github.com/exporl/kuleuven-templates/

Title Slide Example Slide

This repository contains R/Markdown, Markdown and LaTeX templates for presentations and posters according to the KU Leuven Corporate Design. Next to the actual templates, a build system based on R, Pandoc, TeX Live and GNU Make is provided.

Examples:

Comments, bug reports and pull requests welcome!

Table of Contents

R/Markdown, plain Markdown or LaTeX

The templates are available in three versions.

R/Markdown

If you care about the reproducibility of your research, and want to be able to analyze your data and generate your figures in the same place where you write your text, R/Markdown should fit the bill quite nicely. If you are using RStudio, you can just click the Knit button to compile your R/Markdown document.

Plain Markdown

If you need something that is a easier on the eyes than LaTeX and allows very easy customization of the templates, but don't want to go the full way to R/Markdown, take a look at the plain Markdown examples:

LaTeX

If you are already experienced in LaTeX, and you don't want to bother with all that fancy new R/Markdown stuff, you can start with the LaTeX templates:

Linux

The easiest way to use the templates in Linux is with the included Makefile, although it is also possible to directly call Rmarkdown, Pandoc or LaTeX.

Installation

To get started, install dependencies (for an Ubuntu 14.04LTS system, other distros should be very similar):

To use the included build system based on GNU Make:

sudo apt-get install make

For the LaTeX templates:

sudo apt-get install texlive texlive-latex-recommended texlive-science texlive-bibtex-extra imagemagick

To be able to create backup versions of posters (A4) and presentations (Powerpoint):

sudo apt-get install ghostscript posterazor libreoffice

For the plain Markdown templates:

sudo apt-get install pandoc python-pandocfilters

If you use ubuntu 14.04 or older, you need to install the python-pandocfilters package manually from a next release (http://packages.ubuntu.com/search?keywords=python-pandocfilters), e.g.:

wget http://de.archive.ubuntu.com/ubuntu/pool/universe/p/python-pandocfilters/python-pandocfilters_1.2.2-1_all.deb
dpkg -i python-pandocfilters*.deb

To use R/Markdown:

sudo apt-get install r-base-dev r-recommended

You can clone the templates without history with

git clone --depth=1 https://github.com/exporl/kuleuven-templates && rm -rf kuleuven-templates/.git*

Using Make

The included build system automatically transforms R/Markdown → plain Markdown → LaTeX → PDF. Building happens in a temporary directory under /tmp. Any eps/tikz files placed in the root and figures/ directories are automatically converted to pdf files there.

Make configuration

You can slightly configure the build system by copying the included Makefile.local-example to Makefile.local.

  • BUILDDIR=.build: Use a local build dir
  • BIBSOURCE=$(HOME)/path/to/mendeley.bib: Define a bib source to automatically copy the reference database on changes
  • COPYPDF=no: Leave the pdf file in the temp directory and don't copy it to the source directory
  • LATEX=lualatex: Use lualatex instead of pdflatex

Make targets

Several Make targets are available:

  • make, make all, make pdflatex: call make pdflatex-<basename> for all .Rmd, .markdown and .tex found in the current directory
  • make pdfview, make clean, make ondemand: similar as above, for for the pdfview-<basename>, clean-<basename> and ondemand-<basename> targets
  • make <basename>.markdown: convert an R/Markdown file to plain Markdown by evaluating any embedded R code with knitr
  • make <basename>.tex: convert a plain Markdown file to LaTeX with Pandoc; any lines in the Markdown file that start with %% are transformed into options for Pandoc
  • pdflatex-<basename>: convert an R/Markdown, plain Markdown or LaTeX file to PDF by calling pdflatex and bibtex in addition to the appropriate steps above; you might need to call this multiple times to get all references and bib entries resolved correctly
  • ondemand-<basename>: watch for changes to any R/Markdown, plain Markdown or LaTeX files in the current directory and call make pdflatex-<basename> on them
  • handouts-<basename>: create a LaTeX/Beamer handout version of a presentation, check below for how to configure which figures of animations to include
  • ppt-<basename>: create a PowerPoint version of your presentation by creating images for each slide and combining them with LibreOffice
  • a4version-<basename>: create a backup A4 version of your poster in case you forget that poster tube on the plane again with PosteRazor

Windows

While it is possible to use Cygwin to get the Linux setup above working quite well, this is not covered here as most people on Windows do not have experience in a Unix environment.

Installation

Automatic installation

There is an automatic installer available in the windows-installer directory. Make sure to run it as administrator and to restart your session afterwards. You might need to change some of the download locations if newer versions of the dependencies have been released.

Manual installation

You can also manually download them:

Afterwards, add the Python directory to the system PATH variable.

Using the R/Markdown, plain Markdown and LaTeX templates in RStudio

Before you start, switch the default document encoding to UTF-8 with ToolsGlobal OptionsGeneralDefault Text EncodingUTF-8. Now you can compile any R/Markdown (Knit), plain Markdown (Preview), or LaTeX (Compile PDF) file with a click on the corresponding toolbar button. If you create a new project in the upper-right corner, you can use Git version control to keep track of your changes.

Using the LaTeX templates in Texmaker

Open a LaTeX file, and you are good to go.

Online editors

An older version of the templates can be found on ShareLaTeX.

New Pandoc variables

Pandoc variables for presentations

  • sectiontoc: table of contents before each section
  • subsectiontoc: table of contents before each subsection
  • multicolstoc: two-column layout of table of contents
  • sectiontitle: show the slide title and current section
  • subsectiontitle: show the slide title and current section + subsection
  • gridcanvas: centimeter grid in the background

New Markdown commands

Various new Markdown commands (mostly of the form [command=param]) are provided by the Pandoc filters found in templates/*-filters.py. Most of them need to be put in their own paragraph only consisting of the command itself.

Markdown commands for papers/presentations/posters

  • ![*<anim>{option}caption]({options}figure,{options}figure...): figures

    • *: starred figure environment (normally spans 2 columns)
    • <anim>: beamer animation specification: slide to show the figure, starting from 1, if you don't want a figure to appear in the handouts specify slide 0 for handouts with something like <2|handout:0>
    • <option>: LaTeX figure options, use the shortcuts h (horizontal fill), v (vertical fill), f (fill) and s (slide fill) to do the Right Thing

    If multiple animation/option settings are defined next to the caption, they get spread across the figures. Paragraphs that only consist of figures with the same caption get collapsed into one float.

    Examples:

    • ![](figure): basic figure, no float
    • ![{h}](figure): basic figure, no float, scaled to fit slide width
    • ![caption](figure): basic figure, put into a float
    • ![*caption](figure): basic figure, put into a column-spanning float
    • ![{options}caption](figure): basic figure in float, custom options
    • ![{options}caption](figure1,figure2): two figures in one float, custom options for all
    • ![{options1}{options2}caption](figure1,figure2): two figures in one float, custom options per figure
    • ![caption]({options1}figure1,{options2}figure2): two figures in one float, custom options per figure
    • ![<1><2>caption](figure1,figure2): two figures in one float, with animation
    • ![<1><2>caption](figure1)![<1><2>caption](figure2): two figures with same caption in one paragraph get collapsed into one float

Markdown commands for papers

  • ##### header5: draft paragraph heading shown as margin note
  • ##### *header5: draft paragraph heading not shown anywhere
  • [ipe]: start a new in-paragraph enumeration, use \item for the individual items
  • [/ipe]: end an in-paragraph enumeration

Markdown commands for presentations

  • # header1: start a new section
  • ## header1: start a new subjection
  • ### header3: start a new slide
  • [columns=...]: start a new column set with the given number of columns
  • [column]: start a new column with equal width
  • [column=...]: start a new column with given fraction of the line width
  • [/columns]: end a column set

The following commands need to be at the end of a frame.

  • [notoc]: no table of contents before sections/subsections (default)
  • [sectiontoc]: table of contents before each section
  • [subsectiontoc]: table of contents before each subsection
  • [largefooter]: large footer with KU Leuven logo (default)
  • [emptyfooter]: large footer with KU Leuven logo, but no page number
  • [smallfooter]: transparent footer with just a page number
  • [nofooter]: empty footer (no page number)
  • [nosupertitle]: show only the slide title (default)
  • [sectiontitle]: show the slide title and current section
  • [subsectiontitle]: show the slide title and current section + subsection
  • [plaincanvas]: empty background (default)
  • [gridcanvas]: centimeter grid in the background
  • [includeslides=file.pdf]: include fullpage slides from pdf file. Uses \includepdf from pdfpages.

Markdown commands for posters

  • # header1: start a new block
  • ## header1: ignored for compatibility with the presentation template
  • ### header3: start a new structural section (\structure)
  • [columns=...]: start a new column set with the given number of columns
  • [column]: start a new column with equal width
  • [column=...]: start a new column with given fraction of the line width
  • [/columns]: end a column set
  • [ipe]: start a new in-paragraph enumeration, use \item for the individual items
  • [/ipe]: end an in-paragraph enumeration

Further TODOs

  • example sound file
  • restore tikz helpers

About

KU Leuven R/Markdown, plain Markdown and LaTeX templates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TeX 51.4%
  • PostScript 21.1%
  • Python 14.3%
  • Makefile 7.4%
  • Batchfile 3.5%
  • R 1.9%
  • Shell 0.4%