Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ReST, Pandoc, Beamer: My Slideshow Toolchain - ...

ReST, Pandoc, Beamer: My Slideshow Toolchain - BFPG

Video: https://www.youtube.com/watch?v=vE7cNe44l-4

Giving technical presentations is a worthwhile and satisfying endeavour, but producing a quality slide deck can be a frustrating and time consuming activity. It needn't be.

In this talk I will show you my slide toolchain which, in brief, turns ReStructuredText (a lightweight markup format) into a PDF via Pandoc (a "universal document converter" written in Haskell), allowing me to focus on the structure and content of my presentations and not worry about formatting.

We will cover basic formatting, math, code, images, Unicode, foreign scripts, slide appearance and themes, and how to escape from ReST and access the full power of LaTeX when needed. There will also be a brief detour into Pandoc internals and a discussion of ways to vary the toolchain for alternative markup language preferences or output formats.

Fraser Tweedale

March 09, 2016
Tweet

More Decks by Fraser Tweedale

Other Decks in Technology

Transcript

  1. [Pan]Dr. Slidelove or: How I Learned to Stop Worrying and

    Love the Beamer Fraser Tweedale @hackuador March 8, 2016
  2. Motivation I do technical presentations I want nice looking presentations

    I want to focus on slide content—not formatting!
  3. Toolchain Write slides in ReStructuredText format Fall back to L

    A TEX if/when needed Convert to PDF slideshow using Pandoc
  4. Pandoc - running File ./build.sh: #!/bin/sh pandoc talk.rst --to=beamer -o

    slides.pdf \ --template=my.beamer \ --highlight-style=pygments \ --variable=title:"Dr. Slidelove" \ -V subtitle:"or: How I Learned to Stop Worrying and Love the Beamer" \ -V author:"Fraser Tweedale" \ -V date:"\\today" \ ...
  5. Pandoc - templates Each Pandoc writer has a default template

    pandoc --print-default-template=beamer > ... pandoc --template="my.beamer" Upgrades
  6. Hyperlinks (source) Hyperlinks (output) =================== - https://foo.com/ - Embedded link

    <https://bar.com/> _ - External link _ .. _External link: https://baz.com/
  7. Code (source) Code (output) ============= - Syntax highlighting via Pygments

    - >300 supported languages - http://pygments.org/docs/lexers/ .. code:: haskell -- | -- prop> rev [x] == [x] -- prop> rev (xs ++ ys) == rev ys ++ rev xs rev :: [a] -> [a] rev = foldl (flip (:)) []
  8. Code (output) Syntax highlighting via Pygments >300 supported languages http://pygments.org/docs/lexers/

    -- | -- prop> rev [x] == [x] -- prop> rev (xs ++ ys) == rev ys ++ rev xs rev :: [a] -> [a] rev = foldl (flip (:)) []
  9. Math - standalone (source) Math - standalone (output) ========================== ..

    math:: x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{a_3 + \cfrac{1}{a_4} } } }
  10. Math - inline (source) Math - inline (output) ====================== -

    math role can be used inline - Like so: :math: {n! \over k!(n-k)!} = {n \choose k}
  11. Raw L A TEX - standalone (source) Raw :latex: {\LaTeX}

    - standalone (output) =========================================== .. raw:: latex \centering \begin{tabular}{|r|l|} \hline 7C0 & hexadecimal \\ 3700 & octal \\ \cline{2-2} 11111000000 & binary \\ \hline \hline 1984 & decimal \\ \hline \end{tabular}
  12. Raw L A TEX - standalone (output) 7C0 hexadecimal 3700

    octal 11111000000 binary 1984 decimal
  13. Raw L A TEX - inline (source) .. role:: latex(raw)

    :format: latex Raw :latex: {\LaTeX} - inline (output) ======================================= - Water = :latex: H\textsubscript{2}O - :latex: {\LaTeX} is \textnumero 1 \checkmark
  14. Unicode \usepackage[utf8]{inputenc} (Pandoc default) map Unicode characters to arbitrary L

    A TEX \DeclareUnicodeCharacter{2200}{$\forall$} \usepackage[utf8x]{inputenc} (edit template) loads a library of many predefined mappings LuaL A TEX supports direct UTF-8 input some “math” characters missing from text environment
  15. Beamer - title page Pandoc variables title, subtitle, author, date

    Can use raw L A TEX in values pandoc ... -V date:"\\today" Automatically added iff title variable is defined
  16. Beamer - appearance Use serif typeface for math \usefonttheme[onlymath]{serif} Colour

    hyperlinks \hypersetup{colorlinks,linkcolor=,urlcolor=purple} Include a logo \logo{\includegraphics[height=0.5cm]{logo.png}} Aspect ratio class option aspectratio={43,169,...}
  17. Beamer - themes Beamer has themes (layout) and colour themes

    https://www.hartwork.org/beamer-theme-matrix/ Pandoc variables: theme, colortheme
  18. Speaker notes (source) Speaker notes (output) ====================== - This slide

    has speaker notes - Compile with class option notes={show,only} .. class:: notes - This is a speaker note - Don t forget to mention X
  19. Speaker notes (output) This slide has speaker notes Compile with

    class option notes={show,only} 2016-03-08 [Pan]Dr. Slidelove Examples Speaker notes (output) • This is a speaker note • Don’t forget to mention X
  20. Other approaches Other markup formats Raw Beamer with great power

    comes. . . more boilerplate! HTML+JS slideshows
  21. Fin Copyright 2016 Fraser Tweedale This work is licensed under

    the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/. Slides https://speakerdeck.com/frasertweedale Twitter @hackuador Email [email protected]