If you look at most of my slides that I have created for my talks, you will find that whenever I have code, I always try to syntax highlight it.

It is very easy to comprehend code that is syntax highlighted and I always make it a point to do that, so that it is easy for my audience.

Recently a couple of people asked me how I do it and I thought of writing about it, so that you can also do it in your slides 🙂

No screenshots, please

I find that most people take the easy route and just put a screenshot of the code from an IDE. Please don’t do it. It defeats the entire purpose of posting code in the slide, since people can’t copy it. And also it becomes extremely difficult for you update it at a latter point.

So friends, don’t let friends do it 🙂

Rich Text Format (RTF)

Now that we have decided not to post screenshot, the next thing we need to do is to convert the code to RTF format.

Most IDE’s support copying the code in RTF format, so first check whether your favorite IDE supports it. If not there are many tools that are available that can do it.

If your editor is Vim

If you are like me and your favorite editor is Vim and you are using Mac, then you can use an addon called copy as rtf. This addon gives you a simple command :CopyRTF which will convert the entire buffer (or highlighted lines) to RTF, including the background and foreground color and copy it to buffer.

So, next time you show code in your slides, make sure you convert them to RTF, instead of placing a screenshot.