box.matto.nl
Enjoying Open Source Software

Create presentation slides with Groff and mom

Groff and mom

Groff provides an excellent and fast way to produce nice documents from a flat text file.

Mom Macros for GNU Troff is a nice toolbox to create beautiful documents.

Groff is fast

One of the great advantages of using Groff is the almost instantaneous speed.

Of course you can create beautiful slides with LaTeX and Beamer, but the processing of LaTeX takes some time. Groff on the other hand, is lightning fast!

Presentation slides with Groff and mom

We can use Groff and mom to generate presentation slides.

The result is a PDF file that can be used with a advanced PDF viewer like qpdfview to present slides on a beamer.

In qpdfview use F12 to go full screen, and use the arrow keys to go forward or backward through the slides.

The mom format is not that complicated so you can learn it quickly.

Groff and mom is capable

The mom package provides for a step by step build up of the page, so that first some lines are shown, and the press of a button, additional lines comes up, and so on. See the documentation, look for the code word "PAUSE".

No UTF-8

One of the restrictions of Groff is, as far as I know, that it only supports standard ASCII. So you can't use UTF-8 characters.

No frills, simple setup

I don't need any fancy formatting stuff and prefer a simple way to create my slides.

I tried to create a sample mom file with as little as frills as possible. I started from an example file, see: https://lists.gnu.org/archive/html/groff/2018-03/pdfSryOlhMjrh.pdf

When reduced to the max, the slides are monochrome, just black and white. This was a bit too minimalist for me, so I went back one step and kept the colors.

This is a minimal example for a few slides:

.\"----------------------------------------------------------------
.\" Make first slide black.  Remove if printing to save ink.
.po 0
.ll 11i
.DBX SOLID 0 \n[.l]u \n[.p]u
.\"----------------------------------------------------------------

.TITLE "Title of the presentation"
.ds VENUE Event or venue\"
.ds DATE  2022-09-23\"
.ds AUTHOR T.Alker\"
.
.PDF_TITLE "\*[$TITLE]"
.
.DOCTYPE SLIDES \
  ASPECT 16:9 \
  HEADER "\*[VENUE]" "\*[$TITLE]" "\*[DATE]" \
  FOOTER "" "" "\*S[+2]\*[SLIDE#]\*S[-2]" \
  TRANSITION "Box 1 . O" \
  PAUSE "Wipe 1"
.
.PARA_SPACE .75v
.SS +3
.HYPHENATION off
.
.NEWCOLOR darkred #aa0000
.NEWCOLOR darkred1 #900000
.NEWCOLOR blue1 #00007b
.NEWCOLOR blue2 #00006f
.NEWCOLOR code-grey GRAY 0.3
.XCOLOR cyan4
.XCOLOR green4
.
.HEADER_COLOR      darkred1
.HEADER_RULE_COLOR blue1
.FOOTER_RULE       off
.
.COVER_STYLE \
  LEAD +8 \
  COLOR white
.HEADING_STYLE 1 \
  COLOR blue2
.CODE_STYLE \
  FONT B \
  SIZE 115 \
  COLOR code-grey
.QUOTE_STYLE \
  QUAD LEFT
.CONDENSE 90
.
.PDF_IMAGE_FRAME "" 1 blue1
.
.COVERTITLE \
  "\*[$TITLE]" \
  "\*[VENUE], \*[DATE] \
  "\*[AUTHOR]
.
.COVER_START_POS 15P
.COVER COVERTITLE
.
.STRING hand \*[darkred]\[rh]\*[black]
.
.START
.
.ADD_SPACE 9p
.IB 8P
.
.HEADING 1 "First Slide"
.PP

Some text followed by an unordered list.

.SP .25v
.LIST
.ITEM
First item
.ITEM
Second item
.ITEM
Third item
.ITEM
Last item
.LIST OFF
.SP .25v

.NEWSLIDE
.
.HEADING 1 "Second slide"

.HEADING 2 "With a subtitle"

Some line of text, explaining something.

Another line of text, just for fun.

.NEWSLIDE
.
.HEADING 1 "Last slide"

.HEADING 2 "Also with a subtitle"

.HEADING 3 "And even with a sub-subtitle !"

That was all! Now you have a minimal working set, to
start from.

Have fun !

Just put this in a file, let's say "minimal-slided.mom".

Now run the command:

pdfmom minimal-slided.mom > minimal-slided.pdf

And open the file "minimal-slided.pdf" in qpdfview.

The format is clear and easy. And of course, it is very easy to write an awk-script that converts a simple Markdown-ish or org-mode-ish file into a .mom file :)

Tags:

⇽ Texinfo as Personal Knowledge Base Set filedate on photo according to EXIF ⇾