Tips for presenting code in Keynote

Tip 0: Syntax Highlighting

Alex Bucknall
Feb 19, 2017 · 1 min read

Here’s a nice trick you can use for formatting code within a keynote presentation.

Step 0:

Install Homebrew on your mac if you don’t already have it.

Step 1:

Install highlight.

brew install highlight

(This installs Lua and Boost as well)

Step 2:

Highlight your source.

highlight -O rtf myfile.py | pbcopy 

This will highlight the source code in RTF format and copy the result of that operation to your Mac’s clipboard.

Step 3:

Paste into your slide in Keynote. Keynote will create a new text box containing your highlighted code. You can adjust the width as needed, and adjust the font size with cmd+ and cmd-

Finish!

Image for post
Image for post
Beautifully highlighted code!

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store