Webpresence of Philip Kaludercic

Introduction to slides, a Clean Presentation Tool

02 October, 2019

I always enjoyed giving talks and preparing presentations, and while a few years ago I put much more effort into micro-designing slides1, I have since grown more to admire the simpler Takahashi method. The basic idea behind this form of slideshows is to occupy the most space with the least amount of text. Basically just a word to something more like a headline on one page. The original slides that gave this style it’s name can be found here (warning, Japanese).

There have been multiple implementations of this concept, Wikipedia references a few. The main ones I payed attention to were a Beamer package (ie. for the LaTeX class Beamer), and suckless’ attempt named sent. The downsides of the one, are the benefits of the other, and vice versa:

Unsatisfied, I decided to reinvent the wheel.

What I came up with is a small Go2 program named slides. It’s mode of operation is mostly similar to sent, but differs in that it generates PostScript3, instead of opening a window. This PostScript code can then be converted into a regular PDF file. I’ve already prepared one small slide-set for university, that I have uploaded here (warning, German). Another example is shown below.

The rest of this text will be devoted to giving a brief, simple but complete (as of v1.0) introduction to how slides can be used.

Installation

All one requires is having the Go toolchain installed, and then running

$ go install git.sr.ht/~pkal/slides

if $GOPATH/bin is in your $PATH, you’ll be able to run all the following examples. Otherwise copy the binary or adjust your path.

File Format

Similar to sent, all one needs to write is a plaintext file. New slides are created by starting a new paragraph. So

intro to slides

this is an introduction
to the slides program

will result in two pages, both centred vertically, and left-aligned (the default mode). The second slide had two lines, but compared to HTML or Markdown, the text will not be reflown. The number of empty lines is irrelevant.

This is all there is to slide creation. Text will be copied verbatim, and no inline markup exists. The only exceptions are lines beginning with # and \. The former either starts a comment, or a command, while the latter escapes a line, effectively making sent ignore the first character (such as a #, or a newline4).

Comments and commands do not appear, and don’t use up any space in the resulting slides. So

first line
# a comment
# that will
# be ignored
second line

will appear just like

first line
second line

Other than that, comments are mostly uninteresting. Commands on the other hand deserve some more attention. Their general form is

#+name arg1 arg2 arg3

but slides is rather flexible in it’s parsing. So for example,

#+NAME: arG1 Arg2 aRg3   

will have the same effect (meaning the commands are case insensitive, trailing white space is ignored and accept an optional colon). Note that while it seems like three distinct arguments are passed, it’s entirely up to the option to parse everything after the option name, so all it sees is arg1 arg2 arg3.

When a command is invoked, the default behaviour is that it’s effect is active for only the next slide (ie. until the next empty line). To have a more permanent effect, one would add an exclamation mark after the command name, but before the optional colon.

So to change the font to a monospaced font5 one could write

#+font! mono
$ ls

$ whatis ls

$ man ls

instead of

#+font mono
$ ls

#+font mono
$ whatis ls

#+font mono
$ man ls

What now follows is a list of commands:

size

set the current font size. slides doesn’t automatically rescale to text size to fill the entire screen, as would traditional Takahashi Method software, so one had to do this manually.

The size option only recognises four valid arguments: huge, large, small and tiny. Anything else will reset it to it’s default size! This is a common behaviour for commands to come.

font

sets the font family. Will be a sans serif font by default, but can be changed using the self-explaining arguments mono and serif. Anything else will reset it to sans serif6.

style

For any font family, one can set it’s style. Currently these are bold or italic, or no styling.

height and width

These two related commands change the dimensions of the slide. Currently the default slide is 400x300 points, which is fit for 4:3 screens. This option should ideally be applied before the first slide, as permanent commands (using a !). Both commands take integers as their arguments, and if these cannot be parsed, a warning it printed, and nothing is changed.

center

A boolean option that decides changes the mode from left-aligned text to centred. Use any text to start centring (such as #+center t) and no argument to undo it (such as #+center, followed by EOL).

indent

For left-aligned slides, one might want to push the text a bit to the right. This can be done wit this boolean option (see center for usage).

image

If an image is inserted, it and only it will appear on the next slide. The argument has to be the relative path to a PNG, JPEG or GIF. As far as possible, slides will attempt to occupy the entire slide with the image. Compared to other commands, mentioning #+image will produce a slide even if no “real” text is given.

padding

This option modifies the behaviour of image, by forcing slides to reserve some space around the image, as specified by it’s integer argument.

There is also an aggregate option, title that is a shorthand for a couple of other commands just discussed (center to t, style to bold and size to large).

Please note that I, as developer, make no promise that these commands will behave the same way across versions. Changes may come, some more radical than others that might break a slideshow – although I don’t indent to change anything as just to annoy someone.

Usage

Having have written a presentation, generating the slides is the easy part. Using a shell, type

$ slides presenation.sl > slides.ps

and the file slides.ps should contain the PostScript description of the slide show. Feel free to tweak and edit the resulting code.

In case one needs a PDF file, just pipe the output into ps2pdf, as so

$ slides presentation.sl | ps2pdf - slides.pdf

Example

Take this file, and run it through slides. It will produce this PDF, which is also shown here:

Limitations

While slides currently works well for my use cases, there are a few points I feel obligated in mentioning, before someone chooses to also use the tool:

  1. Images are blown up. PostScript is a bit difficult with images, and my first approach was to use ImageMagick to create EPS images. The downside was the dependency on an external program and that some part of the file system was cluttered with EPS files that couldn’t be automatically deleted7.

    Instead, I used Go’s image library to read images into memory and then re-create them, uncompressed in postscript. This results in larger postscript files, but luckily converting the slides to PDF shrinks the file again.

  2. No complex markup. Let’s say one writes the following

    #+font serif
    why?
    \
    #+font sans
    I don't know

    contrary to the design choice to make most things intuitive, slides (currently) will only notice the last command. This means that everything will appear as sans serif text (ie. the default), instead of two font families being used.

  3. Displayable characters are limited. Postscript has issues with Unicode, but since I needed a few German characters I found this translation table, that instructs slides to treat certain letters such as “ç” and “ß” differently, as to be displayed correctly. Sadly this also means that most other characters are not supported, as in Cyrillic, eastern scripts and other complex characters.

Having have said this, I hope that maybe someone might find this tool helpful, to create a quick and clean slideshow. The code is public, and I am open to suggestions, questions or criticism


  1. Here are a few examples from when I was in school, of which I am still somewhat proud: Das Epos (“The Epic Poem”, Latin), Opiate (“Opiates”, Biology), L’ Orfeo (“The Opera ‘L’ Orfeo’”, Music), Spezielle Relativitätstheorie (“Einsteins Theory of Special Relativity”, Physics) (warning Google, warning German)↩︎

  2. I tried C at first, but handeling images and unicode (see Limitations) just was too much of a burden.↩︎

  3. The code that is generated is more or less clean and comprehensible by anyone who understands the basics of PostScript. A month ago I didn’t know anything about it, other than that it had similarities to Forth.↩︎

  4. Escaping newlines allows the user to have an empty line in a slide.↩︎

  5. Currently Courier.↩︎

  6. Note also that this means that the empty argument, as in #+font will “reset” the font. So in the example showcasing #+font! mono, one could just write #+font! to revert to the default font.↩︎

  7. The reason for this was that slides doesn’t know if the output is piped into ps2pdf or stored on a disk, for later post-processing. Cleaning up files from previous runs or even starting a daemon all seemed too impolite.↩︎