New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create syntax-highlighted RTF snippets for pasting into, e.g., Keynote #26

jennybc opened this Issue Nov 18, 2015 · 4 comments


None yet
4 participants

jennybc commented Nov 18, 2015

I bet reprex could package this up nicely ... a gist tweeted by @AmeliaMN on code highlighting for Keynote presentations:

I'm going to paste the body here in case the gist goes away. But the comments look pretty useful, e.g. using alternative highlighters like Pygments..

Step 0:

Get Homebrew installed on your mac if you don't already have it

Step 1:

Install highlight. "brew install highlight". (This brings down Lua and Boost as well)

Step 2:

Highlight your source. "highlight -O rtf myfile.php | 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 with your highlighted code. You can adjust the width as needed, and adjust the font size with cmd+ and cmd-


This comment has been minimized.

AmeliaMN commented Nov 18, 2015



This comment has been minimized.


jennybc commented Sep 18, 2017

@yihui Do you have any thoughts on the basic problem? Which is creating syntax highlighted snippets that are convenient to paste into, say, Keynote. I frequently render to Word, so I can copy and paste with style. And then I still have to fiddle with the text background. It feels ridiculous.


This comment has been minimized.

yihui commented Sep 18, 2017

I have never used Keynote myself, but I think this is definitely doable (I don't know how to solve the background issue, though; will highlight -O html work?). It is possible to write to the clipboard in R (see the "Clipboard" section in ?clipboard). I don't know if pygments is better than highlight.

@jennybc jennybc changed the title from Create syntax-highlighted snippets for pasting? to Create syntax-highlighted RTF snippets for pasting into, e.g., Keynote Dec 20, 2017


This comment has been minimized.


romainfrancois commented Jun 30, 2018

@jennybc jennybc closed this in 032dc11 Jul 24, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment