SmartPy@OCaml2020: The Making Of

A quick experience report …
Tools used for the paper, the slides, and the video.

In the tradition of my previous life in academia, a Friday evening in confinement I decided to submit something to OCaml 2020, a few hours before the deadline.

The thing got accepted, cf. the workshop-page and the program.

And the content:

The following is an experience report on the tooling; in case it's useful.

The Paper

A.k.a. the “easy part” … getting the most of LaTeX without wasting time on formatting.

pandoc all the way, everything in one single shell command.

It ended up in this gist: https://gist.github.com/smondet/03cc91336253233d6141cc2980ac3333; “anybody with the link” can review the markdown, and I have a nice PDF to submit without tweaking overfull hboxes.

The interesting part is actually at the beginning of the markdown file:


Build command:

  pandoc -t latex --pdf-engine=xelatex \
          -V links-as-notes=true \
          -V fontsize=10pt \
          -V mainfont="FreeSerif" \
          -V monofont="Liberation Mono" \
          -V monofontoptions="Scale=0.7" \
          -V linkcolor=BlueViolet \
          -V urlcolor=BlueViolet \
          -V linestretch=0.7 \
          -V classoption=twocolumn \
          -V listings=true \
          smartpy-ocaml-2020.md -o smartpy-ocaml-2020.pdf


Worth noting that, like everything “LaTeX”, the final result is quite dependent on the installation of the various pieces of software. Here, it's Linux Mint's APT repositories.

The Slides

Then came the panic of the video-presentation.

Kept using Pandoc for the slides, since I already had some content from a previous talk. It still makes you focus on content with a decent editing setup (a.k.a. Emacs) and hacking layouts & fonts somewhat separately.

But this was for a video, not a live semi-improvised talk …
⇒ One wants to improve and speed up the speaking flow.

Hereby came the need for speaker notes, and that's when this thing becomes a glorious hack:

build () {
    sed 's/<!-- *(\*/{< let () = cmt {cmt|/g' slides.md | \
        sed 's/\*) *-->/|cmt} >}/g'  | \
        mpp -l ocaml -so '{:' -sc ':}' > $tmpml
    export with_comments=true
    ocaml $tmpml | pandoc --self-contained -s -o $name.html \
                          --number-sections \
                          --css quick.css
    echo "HTML-Done: file://$PWD/$name.html"
    export with_comments=false
    ocaml $tmpml | pandoc -t beamer \
           -V fontsize:11pt \
           -V colorlinks:true \
           --highlight-style tango \
           -V monofont:DejaVuSansMono \
           -V monofontoptions:'Scale=0.8' \
           -V theme:Rochester \
           -V colortheme:dove \
           -V aspectratio=169 \
           --pdf-engine=xelatex \
           -s \
           -o $name.pdf
    echo "Pandoc done."
    exiftool -Title="SmartPy 20200828 @smondet " \
             -Author="Seb Mondet" \
             -Subject="Slides for OCaml 2020, Aug 28" \
             -Keywords="smartpy;python;ocaml" \
             -Creator="@smondet" \
             -Producer="@smondet" \
    pdftoppm $name.pdf $name -png
    echo "Done: file://$PWD/$name.pdf"
  • Using mpp, a.k.a. ocaml/MPP-language-blender, as the glue it's meant to be.
  • Some sed to transform special markdown/HTML comments, like <!--(* ... *)--> into mpp's “guest language” syntax: let () = cmt {cmt| ... |cmt}.
  • There is exiftool which is nice for publishing PDFs on the Web without having to figure out Pandoc's templating.
  • And pdftoppm produces the images that are then manually included in the video.

It's processed once with "with_comments" set to true to generate the speaker script in HTML and once with false to generate the PDF slides and the PNG images.

Here is how it looks, with the implementation of the cmt function:

% ![SmartPy smondet](./img/intro-page.png){ width=55% }
% OCaml Workshop 2020-08-28
% [Seb Mondet](https://seb.mondet.org), [TQ Tezos](https://tqtezos.com/)

{< let cmt s =
     match Sys.getenv "with_comments" with
    | "true" -> Printf.printf "*``(* %s *)``*" s
    | _ -> ()
    | exception _ -> () >}

# Slide 0

Bla bla <!--(* Those are speaker notes *)--> more content

The Video


I went with Audacity because I thought it would be more practical compared to Ardour that I know better:

  • Avoids having to start/stop Jack.
  • The “region based” very manual/destructive editing seemed like a good idea for quick and dirty effects and cuts.

It was a bad choice, it is quite more painful to use than I thought; the UI does not seem designed for a long-ish recording (20 min) and it crashed on me a couple of times. I should have stayed with Ardour.


Used Kdenlive.

A couple of years before, I had tried all the Linux video editing applications I could find, it always quickly ended up in seg-faults or gigantic Python stack traces and me wanting to throw my laptop out the window … Except for Kdenlive which is slow and has a lots of very weird UI quirks but at least seems somewhat stable.

One nice “feature” of Kdenlive worth mentioning is that content “clips” remain pointers to external files ⇒ it's nice to be able to change the slides with the build system above while they stay anchored to their position in the video timeline.

I also used SimpleScreenRecorder to record the demo, and Cheese to add a little video of me say “Hi” to the webcam.

Future Work

I may re-re-re-re-learn Blender one day, to use it as a video editor, and may report back.

After 8 years of blograstination, this is post #7 of my attempt at using the #100DaysToOffload completely unrealistic “challenge” to remind me to write stuff once in a while … Let's see where this goes.