$30 off During Our Annual Pro Sale. View Details »

Building and presenting slide decks with rst2pdf

Building and presenting slide decks with rst2pdf

I've recently used rst2pdf for building presentation slides. This short talk will show some examples of how I built and presented a slide deck using reStructuredText and rst2pdf.

https://www.oliverdavies.uk/talks/building-presenting-slide-decks-rst2pdf

Oliver Davies

January 28, 2021
Tweet

More Decks by Oliver Davies

Other Decks in Technology

Transcript

  1. Building and
    presenting slide decks
    with rst2pdf
    Oliver Davies (@opdavies)

    View Slide

  2. What have I used before?
    • UI based: Keynote, Google Slides, slides.com
    • HTML/JavaScript: reveal.js
    • Markdown: Deckset, Marp, reveal-md
    @opdavies

    View Slide

  3. What is rst2pdf?
    • "Use a text editor. Make a PDF."
    • reStructuredText to PDF
    • Each slide is a page
    • Page templates for layouts
    • Not just for slide decks
    • Table of contents, page numbers, headers, footers
    @opdavies

    View Slide

  4. Advantages
    • Easy to start a new presentation, or update an existing one
    • Version controllable
    • Portable
    • Content is searchable
    • Easy to re-use content and/or styling
    • Slides uploaded to SpeakerDeck straight away
    @opdavies

    View Slide

  5. @opdavies

    View Slide

  6. Useful reStructuredText
    1 Building and presenting slide decks with rst2pdf
    2 ################################################
    3
    4 .. class:: titleslideinfo
    5
    6 Oliver Davies (@opdavies)
    7
    8
    9 What is rst2pdf?
    10 ================
    11
    12 * "Use a text editor. Make a PDF."
    13 * reStructuredText to PDF
    14 * Each slide is a page
    @opdavies

    View Slide

  7. Useful reStructuredText
    1 .. image:: images/editing.png
    2 :width: 20cm
    3
    4
    5 .. code-block:: php
    6 :startinline: true
    7 :linenos:
    8
    9 echo 'Hello world!';
    10
    11
    12 .. raw:: pdf
    13
    14 TextAnnotation "This is a speaker note."
    @opdavies

    View Slide

  8. Page Templates
    main.style:
    pageTemplates:
    standardPage:
    frames: []
    [3%, 3%, 92%, 92%]
    showFooter: true
    showHeader: false
    slides.rst:
    .. raw:: pdf
    PageBreak standardPage
    @opdavies

    View Slide

  9. Keeping things organised
    Split slides into different sections:
    .. include:: sections/intro.rst
    Including code snippets from separate files:
    .. code-block:: javascript
    :include: code/additional-config-options.txt
    :hl_lines: 2 3 4
    :linenos:
    @opdavies

    View Slide

  10. Styling
    1 linkColor: #24608a
    2
    3 styles:
    4 normal:
    5 fontSize: 24
    6 leading: 32
    7 textColor: #383745
    8
    9 bodytext:
    10 alignment: TA_LEFT
    11
    12 heading:
    13 fontSize: 20
    14 spaceAfter: 16
    @opdavies

    View Slide

  11. 15 textColor: #24608a
    16
    17 title:
    18 fontSize: 300%
    19 parent: heading
    20 textColor: white
    21
    22 bullet-list:
    23 commands: []
    24 [LEFTPADDING, [0, 0], [1, -1], 10]
    25 [RIGHTPADDING, [0, 0], [1, -1], 0]
    26 [VALIGN, [0, 0], [-1, -1], TOP]
    27 colWidths: ["20", null]
    28 textColor: #aaaaaa
    @opdavies

    View Slide

  12. Building
    rst2pdf slides.rst
    rst2pdf slides.rst --break-level 1 --stylesheets main
    rst2pdf slides.rst \
    --output slides.pdf \
    --stylesheets main \
    --break-level 1 \
    --fit-background-mode scale \
    --extension-module preprocess
    @opdavies

    View Slide

  13. Watching
    Re-compiling when something changes.
    nodemon --ext rst,style,txt --exec "
    rst2pdf slides.rst \
    --output slides.pdf \
    --stylesheets main \
    --break-level 1 \
    --fit-background-mode scale \
    --extension-module preprocess
    "
    @opdavies

    View Slide

  14. Presenting
    pdfpc - PDF presenter console
    pdfpc slides.pdf
    @opdavies

    View Slide

  15. @opdavies

    View Slide

  16. @opdavies

    View Slide

  17. Thanks!
    References:
    • https://rst2pdf.org
    • https://github.com/rst2pdf/rst2pdf
    • https://github.com/opdavies/talks
    • https://oliverdavies.link/lorna-rst2pdf-talk
    Me:
    • https://www.oliverdavies.uk
    @opdavies

    View Slide