I came across this awesome gist explaining how to syntax highlight code in Keynote. The same trick works for Powerpoint. Mac only.
- Install homebrew if you don’t have it already and brew install highlight.
- highlight -O rtf myfile.ext | pbcopyto highlight code to a formatted text converter in RTF output format, and copy the result to the system clipboard.
- Paste into Keynote or Powerpoint.
If I’ve got some code in a file called 
eset_pca.R:
I can simply 
highlight -O rtf eset_pca.R | pbcopy and then paste it right into Keynote or Powerpoint.
 
