Jens Nöckel's Homepage

Computer notes home

Scientific Presentations

Table of contents

Native LaTeX support in Keynote and the iWork suite

As of summer 2018, Keynote supports mathematical typesetting natively — you can choose between LaTeX or MathML code to enter equations. To find out exactly what subsets of these languages are supported, consult the Apple support pages.
Most of the info below is still valid, but if your presentations only require a few equations then this new built-in functionality may be "good enough" for you!

For more than a decade, the main equation-editing tool for Keynote has been LaTeXit, and I would still recomment it to anyone who wants advanced functionality such as a formula library, easy control over fonts and dimensions, and the ability to copy/paste equations in numerous different formats (one of which I contributed to, as you can see in the LaTeXiT help document). I personally use it, although this page goes through various other (potentially simpler) alternatives before discussing LaTeXit (because it requires a complete TeX installation, which is overkill for casual users).

Native equation functionality in Keynote (and Pages) at long last gives us formula support without having to install any other software — in particular, there's no need for an external TeX distribution. This also means that LaTeX and MathML typesetting are immediately available on the iPad and even iPhone platforms, as well (no more detour via cloud-based services needed).

You can easily make the round-trip from LaTeX source to PDF image back to source code in Keynote, by simply double-clicking any formula that was created with the built-in editor. In LaTeXit, there is a similar workflow: just copy the PDF back and forth between the two applications.

The ouput of the native equation editor is a PDF image of the typeset formula using the STIX fonts. The overall color and font size of the output can be manipulated via Keynote's Style panel, but the font is not under the user's control. The overall color setting can be overridden with LaTeX commands such as \color{DarkOrchid}, and the formula size can also be fine-tuned by resizing the output like any other image.

As with the other PDF-based solutions below, the equation is embedded in Keynote as an image and not as part of the text. This has the drawback that equations don't flow with the text, and can't reposition themselves autmatically if you rearrange the text boxes on the slide.

Starting point

Keynote works nicely with PDF, but has no math support beyond the ability to embed formulas as PDF images. What this means in practice is that you can get beautiful math display in Keynote, but unfortunately it's not as easy as it should be for day-to-day use in science and education. Because of this, I'm starting a separate page on a different approach that I believe will very soon rival products such as Keynote (and even PDF) as the medium of choice for equation-rich presentations: web-standards based slides.

Mathematics is commonly typeset using LaTeX, but (La)TeX doesn't come pre-installed with Mac OS X. Since the typesetting requirements for a computer presentation are different from those of a scientific paper, some of the suggestions on this page are also intended for people who don't want to install TeX. However, when I think about math content, I usually think about it as originating from some LaTeX process.

The good thing is that under Mac OS X Aqua, many applications can be made to support LaTeX indirectly via the PDF format. If you don't want to install LaTeX, you may find it easier to use dedicated equation editors. Here are some choices:

Now back to the main topic: LaTeX in presentations. If you don't know LaTeX but want to know more about it, you may want to look at my LaTeX page first.

At the bottom of this page I'll refer to some nice free tools that rely essentially on LaTeX and PDF alone to create presentations. This is OK for many occasions, and it's commendable to go with open-source software all the way. And for a LaTeX writer like me, that's still the fastest way to make a no-frills presentation. But in the end you'll probably have more fun if you give in to the temptations of commercial software. In fact, the open-source route can drive you to despair if your next presentation is your thesis defense and you can't get that Quicktime movie to work on the punchline slide (it's all doable, but with a bit more work, as I describe here).

The beauty of Mac OS X is that PDF is the native format in which things are displayed. This is also true for the commercial program I'm talking about here: Apple's Keynote. The most recent version as of this writing is 8.1.

You get it as part of the iWork bundle which includes Pages, a nice word processor and layout application for non-science writing; for additional comments see the Pages pages.

Back to Keynote:

Objectives

I've had some people ask me question about Keynote's features as compared to other presentation software, e.g. Powerpoint. This is not the kind of question I'm focusing on here, though. I'm pushing Keynote here for a very particular type of use, but don't want to tell anyone what to buy, in particular if their intended usage is very different from mine: in short, Keynote functions as a media integration platform, allowing you to put materials produced in various other applications into one package for full-screen presentations, possibly with some nice transition effects added.

To what extent you find Keynote useful or wanting depends on how much you rely on Keynote for actual content production. My general advice would be that content is best produced with other dedicated applications such as Mathematica, a LaTeX system, a graphics program etc. This is the way I use Keynote, and this page is about one aspect of this work flow: the use of LaTeX typesetting with Keynote.

Putting LaTeX into Keyote is a piece of cake. Three different scenarios occur quite frequently:

  1. You have only a PDF file without LaTeX source but want to use parts of it in Keynote
  2. You have a LaTeX document and want to to pick out some equations or text to paste into Keynote
  3. You're making a slide and want to type an equation "on the fly" for use in Keynote

In Powerpoint and Keynote alike, one can always achieve these tasks by going through the first case: create a PDF file, display it in Acrobat Reader (now Adobe Reader), and copy selected parts as bitmaps to paste into the presentation software. To prevent the result from looking grainy, one should first zoom in in the PDF viewer before selecting and copying the desired part (using the graphics copy tool). In the presentation software, you then scale down the pasted image. This creates bitmaps with acceptable resolution but large file size.

Solutions

In Keynote, you can do much better than this. How much better, may depend on your OS version (Jaguar versus Panther). Let's go through the above cases:

  1. The main thing you need is a PDF viewer from which you can copy as PDF, instead of just bitmap format. Adobe Reader does not allow this, but the built-in Preview application does. In Preview version 2.1.0 and above (comes with Tiger), you can actually select arbitrary rectangles within the PDF page and copy them. This, together with its ability to display postscript files as PDF, makes the new version of Preview immensely useful. With the release of Tiger, Preview is at version 3.0. Adobe Reader 7 and 8 have comparable features, but in addition can launch plugins to display additional multimedia content embedded in the file. For this reason, it is still useful to have Adobe Reader installed (in particular if you want to do PDF presentations with Beamer, see below).
    How it ought to work:
    Shown in the screen shot is an arbitrary area selected in an arbitrary PDF document in the Preview Application (version 2.1.0). To do this, make sure you first activate the Select Tool (press Command-3 or click on the box icon at the top right of the toolbar). If you paste the result into Keynote, it will be in true PDF format. In other words, copying a formula this way, you can scale it, change its opacity, give it shadows, etc.
    However, there's a glitch on Leopard:
    If you've upgraded to OS X "Leopard", then you're in for an unpleasant surprise: The cropping isn't preserved when pasting into Keynote '08 - this bug is fixed in Keynote '09. For those who still use Keynote '08, I've come up with a work-around for this annoying bug on a separate page. It requires one additional mouse click after copying from Preview, to fix the format of the copied selection.

    The screenshot from Keynote shows that the rectangle is faithfully cropped; the result was also scaled and rotated.
    Although only the selected part of the original PDF page is displayed in Keynote, the pasted object still contains some information about the discarded parts, so in some cases (for small areas) it can still be more memory-efficient to just copy rectangles as bitmap images (either by screenshot or out of Adobe Reader). The background of a PDF paper often appears transparent in Keynote, meaning that you can choose your own background color by placing a suitably filled rectangle underneath the copied PDF.
    In principle, one can also do such manipulations in an automated way. That's particluarly useful if you are copying lots of formulas from a paper but want all of them to appear with the same colored background. The key is that all your copied equations are actually stored in the file that's created when you save the Keynote presentation. For more details, see my remarks on how to change the background color on the LaTeX page.
  2. To put LaTeX into Keynote (as PDF), you need a LaTeX compiler and a Cocoa-based previewer for PDF (this rules out Xwindow programs like gv, but also means you should avoid Adobe Reader). Here are some solutions:
    • The path that always works for me starts by compiling a document with PDFLaTeX and opening the result in Preview ≥2.1, and then continuing as in case 1.
    • Another path that you may choose is to use the LaTeX environment TeXShop from right here at the University of Oregon (or through the porting system fink). The TexShop Previewer allows you to copy rectangles just as in Preview ≥2.1, and the pasted result in Keynote is a PDF object with all the great advantages like scalability etc.
  3. For immediate editing of formulas "on the fly", there is a great little tool that can use any existing LaTeX installation on your system:

    LaTeXiT

    1. It's intended to let you type LaTeX source either in a text box or in another prgram (like Pages or TextEdit), and quickly get the typeset result in a variety of useful formats. LaTeXiT tries to inherit the text properties (e.g., color, baseline) of the parent document if one invokes it from the Services menu.
    2. Also worth mentioning is the fact that LaTeXiT is linkback aware. What this means can best be seen by experimenting with the Keynote Linkback Plugin written by King Chung Huang. The download location can be found on the main web site of the Linkback Project. After installing this plugin, Keynote 4 (or 3) shows a new menu item "Edit (or refresh) in LaTeXiT" in the Edit menu, whenever you highlight an equation that has been dragged into Keynote from LaTeXiT. If this doesn't show up, make sure you log out and back in again. By using this function from within Keynote, you recover the LaTeX source code for an existing PDF equation in LaTeXit; the modfied PDF will automatically replace the old version on the Keynote slide.

      Warning:
      The linkback plugin may cause problems, and a fix is described below.

      Best solution:
      For most purposes, LinkBack no longer offers any advantages with Keynote, because LaTeXiT as of version 1.15.0 has the ability to recover the original LaTeX source from a PDF that you paste into it. I.e., you can do the following:

      1. Make an equation in LaTeXiT and copy it into Keynote.
      2. Revisit the Keynote slide at a later time and select that PDF equation again.
      3. Copy the PDF and paste it into the LaTeXiT window. If this PDF was created in LaTeXiT, its original source code re-appears in the editor panel, ready to be modified and copied back to Keynote.
    3. Pierre Chatelier, the author of LaTeXiT, also responded very quickly to my requests and comments. The latest addition in response to one of my requests is a keyboard shortcut allowing you to copy the PDF output of LaTeXiT to the Clipboard. LaTeXit is discussed under a different aspect on my Scientific Illustrations page: My contribution to LaTeXit (back in 2006) is an algorithm that converts a typeset formula into an outlined (i.e., font-safe) PDF object that will look the same in any application, including Keynote or Adobe Illustrator (I also helped a little with the Pasteboard code).

In conclusion, Apple's Keynote 4 (or 3) comes close to realizing a free-form layout and presentation system in which LaTeX can be integrated almost seamlessly via tools like LaTeXiT. The main gap between the LaTeX and iWork worlds is that styles of the parent document (such as font size) are not inherited by the embedded LaTeX object, so one has to specify them separately on the LaTeX side (which is easy enough to do in the two utilities I mentioned). The LaTeXiT application actually does the best job so far of bridging this gap - at least for Pages, but not yet for Keynote. This is of course a limitation of Keynote, not of LaTeXiT. More on this in the following section.

Caveats, additional utilities

Keynote is a commercial product, and you may or may not feel that you get your money's worth. Keynote essentially serves as a canvas on which many different media styles (text, math, images and movies) can be integrated and presented, as well as exports in various useful formats (e.g., as movies, PDFs or HTML). The added value provided by these programs lies partly in their professional layout and design templates, but that may not be so important to everyone.

However, there are some drawbacks of Keynote. In general, one gets the feeling that Apple is continuing the philosophy of the one-button mouse (adored by some, despised by many) by making the user interface of Keynote really simple-looking. This simplicity sometimes comes at a price when you want to do more complex tasks. Below are some issues that I came across.

  1. A remark about Services: All the nice features of LaTeXiT Services work in Mail or Pages, but not with Keynote: you cannot use the typesetting service within a Keynote text field directly! It's not clear to me why this works in Pages but not in Keynote. The unfortunate consequence of this is that the LaTeX image generated by LaTeXiT (or any other application) does not flow with the regular text in a Keynote slide, and hence formulas have to be repositioned separately from the text if you change, e.g., the width or height of a text field.
    There are two ways around this problem:
    1. Either type your text together with the formulas in LaTeX - then you don't need Keynote's text fields.
    2. Or type simple inline formulas within Keynote by using Unicode characters from a symbol palette. There are several ways to access suitable palettes:
      • Use Keynote's own symbol lists (under the Edit menu) or consult the Character Palette after enabling the International menu bar item.
      • Copy symbols from Mathematica. To make the Unicode symbols work smoothly, it's good to choose Arial Unicode as the text font (if you have it), or stick with something standard like Helvetica.
      • Inline equations without two-dimensional formatting (such as fractions etc.) can also be copied from PDF files directly by using the text selection tool in Preview. The same is true, and increasingly more relevant, for MathML viewed in a browser. The result can be pasted into RTF-capable applications, such as TextEdit, Mail and also Keynote's text fields. This provides a way to get some special symbols into Keynote without using graphics objects. However, since some symbols such as ħ don't get copied properly, you may still have to resort to one of the other options above (or, with a dismissive gesture, claim you've set ħ ≡ 1).
      • Sven Kreiss and Kyle Cranmer recently created a bona fide Service that actually works inside Keynote (and other applications) and can convert LaTeX symbols to Unicode characters on the fly: UnicodeIt.
  2. Problems with the Keynote Linkback Plugin

    The Linkback Plugin I downloaded from the official web site caused a severe problem with the positioning of grouped objects in Keynote, which showed up only after re-opening a saved presentation.
    Solution:
    This may have been fixed by the time you read this, but if it isn't, there are instructions for how to fix the problem in this email discussion thread. The culprit is inside the Keynote application bundle, at Keynote.app/Contents/Resources/Animations/K2LinkBackSupport.sfxplugin/Contents/MacOS/K2LinkBackSupport. You should replace this file by a new version which I've archived here. Make sure to download the correct one for your specific processor architecture:

    After installing this fix, I no longer have any problems with misplaced object positions after saving a file.
  3. Problem: There are tools for making drawings within Keynote, but you may want more capabilities
    Solution: Some suggestions for software that can fill this gap are
    1. Use Adobe Illustrator or a similar graphics application to get all the bells and whistles. This includes the ability to copy and paste directly from Illustrator to Keynote.
    2. As a bitmap drawing application, get Seashore, a free program that supports some essential features like gradients and transparency, and is Mac OS X native. If you need a more mature program, consider learning The Gimp (it's now a Mac OS X native application). This and other alternatives are discussed on a separate page.
    3. If you can't make up your mind which program to use for graphics work, don't worry: no matter how you produce your graphics, there is always the screen capture function. Use either the Grab application or the keyboard shortcut keys listed in the OS X System Preferences, as shown here (for Panther):

      The first of these options is an ancient trick from as far back as Mac OS 6 or 7. It creates a file on the Desktop called "Picture 1". The most convenient of these screen capture shortcuts is the last one. It lets you select areas by dragging cross-hairs; and there is a specialized but undocumented bonus feature: when the cross-hairs show up, try pressing the SPACE bar! You suddenly get a "focus-follows-mouse" behavior that highlights any windows or icons you hover over. A mouse click then captures exactly the highlighted object, preserving its dimensions and even its opacity.
      Copying selections to the clipboard produces bitmap images. But under Tiger, you have additional options that let you choose PDF format.
      Here are two ways to get PDF screen shots:
      • If your preferred default setting is bitmap (PNG is the factory setting), you can do PDF screenshots on a case-by-case basis from the Terminal: type screencapture -i -c -t PDF after making sure that the screen area to be captured isn't obscured by the Terminal window. This will launch the screen-capture crosshairs which you drag over the desired rectangle to be copied. The PDF screenshot will be on the Clipboard and can be pasted to Keynote, Preview, GraphicConverter etc.
      • If you want to make PDF format the default screen capture format, then type the following in the Terminal: defaults write com.apple.screencapture type pdf. This can be undone by typing defaults write com.apple.screencapture type png. Other permitted graphics formats are JPG and TIF.

It should be kept in mind that comparisons with Powerpoint (or even OpenOffice) are not really fair because Keynote relies fundamentally on scalable objects both for its fonts and graphics, and if you have worked with vector graphics you know that they are generally a bit harder to manipulate than bitmaps. But this fundamental difference is precisely what makes Keynote superior in the final analysis.

Other presentation tools

Of course I've used other software, and the Keynote solution put forward here is perhaps not to everyone's taste. I've made heavy use of Powerpoint, and played around with OpenOffice/NeoOfficeJ. But I can never get used to their equation editors.

Why use other tools for presentations?

There is one important reason why one may not want to use Keynote: the technological infrastructure at conferences and meetings is typically centered around Powerpoint and PDF. At some conferences the organizers, in an honest attempt to reduce technical delays during presentations, require you to upload your talks onto some Windows machine prior to the session. This usually means you need to convert from Keynote either to Powerpoint or PDF.

Keynote does not keep animations in the PDF it exports (although this is technically possible). So only Powerpoint remains. But if you've ever tried to transfer a presentation from Mac Powerpoint to PC Powerpoint, you know you can't trust the results unless you double-check every slide on a PC. Now add the extra step of starting from Keynote instead of Mac Powerpoint, and it's clear that there's reason to be worried.

What other solutions are there?

Abusing Keynote

Before giving up on Keynote because of the above problems, it may be worth mentioning one other export format that could be the ultimate solution: Interactive Quicktime Movie. Although Quicktime is not guaranteed to be installed on all Windows machines, it is certainly available. Before exporting a presentation in this format, make sure that you set a slide size of at least 1024×768 in the Document Inspector menu of your Keynote presentation. Exporting as an "Interactive Slide Show" in "Full Quality, Large" format yields a Quicktime movie that can be opened in any Quicktime-enabled movie player. If that player has a full-screen mode, the result looks almost exactly like the original Keynote presentation, except that everything (including fonts) is now in bitmap format. In other words, you have reduced the visual quality of your presentation to Powerpoint level...

Exporting as SWF (Flash) is also an option, but with a big presentation I ended up getting an error message asking me to remove some transition effects because the file became too complex. Quicktime didn't encounter this problem.

Emulating Powerpoint

There are open-source presentation tools that position themselves as more or less direct competitors of Powerpoint.

LaTeX-based presentations

If you don't want to stoop this low, a viable alternative is to do presentations purely in PDF using the full screen mode of Adobe Reader. This allows many transition effects and even animations, all built from a LaTeX source. If you consider Keynote to be mainly a media integration platform, then any PDF-based substitute has to address multimedia content. This is the topic of my page on LaTeX-generated PDF with movies.

A somewhat separate issue is the formatting and book-keeping that is specific to computer-presentations: e.g., the incremental building of pages, item-lists or formulas. Here are some links to packages that deal with these tasks:


noeckel@uoregon.edu
Last modified: Fri Jun 22 11:47:33 PDT 2018