Introduction
- To generate HTML content I rely on org mode's HTML export
functionality.
- I had used pandoc (from John Macfarlane) for converting content
in other formats to org mode
- For a bigger project, I needed Microsoft PowerPoint slides
- As I mostly use org mode for writing, I evaluated pandoc to
generate PowerPoint
pptx
files. Documentation:
Summary
- Using pandoc, you can generate Powerpoint slides easily
- pandoc supports a core set of slide types
- title slide, divider slide
- bulleted lists
- tables
- "stand alone" images and images with text, possibly bulleted
- You might want to use the latest pandoc version (I used 3.1), as
there had been quite some improvements and bug fixes
- More detail at http://web222.webclient5.de/doc/swdev/emacs/orgmode/pandoc
- The test files can be found in a zip file org2pptx.zip
Telling pandoc About Which Template to Use
- You might want to provide a template PowerPoint file to pandoc
- either
pptx
or potx
- pandoc will fill the template with your org mode content.
The command line might look like
pandoc --data-dir=~/pandoc-t -t pptx -o outfile.pptx infile.org
Here, the template files will be found by pandoc in your directory pandoc-t
in your home
pandoc can tell you, where it looks for template files by default:
pandoc -v
Options to Run the Conversion
- I use org-babel to run pandoc directly from the org source file and
invoke PowerPoint to show the result
- For more complex projects, I use a Makefile
As I use windows, I also got a batch file containing the following line
%MYPROGPATH%\pandoc-3.1\pandoc.exe --data-dir=%MYPROGPATH%\pandoc-t -t pptx -o "%~dpn1.pptx" %1
This allows to drop an org file onto the cmd
file in Explorer
Observations
Structure of the Presentation
- Whether or not to generate "divider" slides, is described in the org
manual under "Structuring the slide show"
- To map from org-mode headings to slides, pandoc has the concept of "slide level"
- this is the org-mode heading level that maps to the slide headers
Localised Master Slide Names Need To Be Renamed 1/2
- Per slide, pandoc picks the appropriate template slide from the
slide master in the template file
- pandoc looks for a standard english name of the template slide
- When using a non-English localised version of PowerPoint, you have
to rename the slide master templates slides to:
- Title Slide
- Title and Content
- Section Header
- Two Content
- Content with Caption
- Blank
- Comparison
Localised Master Slide Names Need To Be Renamed 2/2
Showing Source Code or Similar Content
- Code blocks (i.e. with colon,
#+begin_src
, #+begin_example
) are
indented. This might be configurable on the pandoc side
Tables
- pandoc uses the default table layout that you define in the
PowerPoint template file
- org-mode automatically right aligns columns with figures in Emacs,
whereas pandoc needs a first row with
<r>
type hints
- Columns in HTML tables have variable width. pandoc generates
PowerPoint table columns with all the same widths
Images - Shape Types
- An org-mode link to a JPEG file becomes in PowerPoint a shape of
type msoPicture (13), not msoLinkedPicture (11). I.e. the image
becomes embedded in the PPTX file
- Similarely, a linked SVG file becomes msoGraphic (28), not
msoLinkedGraphic (29)
Images - Scaling
- PowerPoint
- uses DPI meta information from the image file when you insert an image
- uses a default of 96 dpi for SVG images, which do not contain DPI information
- pandoc does not seem to use the DPI meta information. It scales
images so that they fully fill the content area
- The aspect ratio of the images is kept
- For some SVG files, the aspect ratio got changed a bit by pandoc.
It turned out, these SVG files had an UTF-8 BOM (byte order mark)
of 0xef 0xbb 0xef as the first three bytes in the SVG file. This
will be fixed in a future version of pandoc
Images - Captions and Links to Images
- Image captions provided in markdown input work, but do not work from
org mode input in V3.1. It did work in V2.9.2.1 though.
- If an image link contains a link text, the image will not be
embedded. Rather a link will be embedded, with an underlined link
text
Images - Limitations
- You cannot have multiple images on the same slide
- If there is text right before before an image link, the image does
not appear in the PPTX
- Text after an image link is put onto another slide. This might be
unavoidable because there seems to be no notion of in-line images in
PowerPoint
Slide Footer
The PowerPoint output contains the footer information as given in the
PowerPoint template file:
- Slide numbers are set automatically.
- The date field is filled with the org-mode #+DATE: field, even if
the date was set to "manual" in the template
- The footer text field is not filled by pandoc. It will have the
content as was provided by the PowerPoint template file, if any.
Footer information does not seem to be part of pandoc's internal
data structure. There has been discussion about this on the
Internet, related to
docx
output. This might apply to pptx
output as well.
Covered Functionality
Scope
Two factors determine, what PowerPoint functionality can be used from
org mode via pandoc conversion:
- What PowerPoint functionality is accessible from pandoc
- What pandoc functionality is accessible from org mode
Regards the PowerPoint output format, the pandoc documentation
elaborates about
- The needed template slide layouts
- "fenced_code_attributes" Extension
- A markdown code example
- Speaker notes
Markdown and Org Mode
- On the Internet, there are often markdown examples to convert using
pandoc
- The pandoc manual itself seems to be written in markdown
- pandoc cannot access Emacs/org mode settings in
init.el
- pandoc might access in-buffer org-mode settings
Because of this, my first attempt to scope the supported functionality
was to convert the provided markdown example to org mode using pandoc.