[yapc] Syntax highlighting for presentations

Ken Williams ken at mathforum.org
Thu Jul 6 20:33:08 PDT 2006


On Jul 6, 2006, at 7:53 PM, Trey Harris wrote:

> I noticed a lot of folks had pretty syntax-highlighted/colored code in
> their presentations.  I've done that too, but I'll bet my process
> (perltidy to HTML, HTML to PDF, dropped and zoomed/cropped into the  
> slide)
> is a lot more laborious than what others have worked out.
>
> If I may ask, does anyone have nice tools for converting a snippet  
> of code
> into a pretty graphic?  I use Keynote, but I could probably adapt  
> certain
> tools that target other presenters.

Since you're on OS X, you could copy a chunk of code to the  
clipboard, then do:

  pbpaste | enscript --color -Eperl -p - > /tmp/code.ps
  open code.ps

then copy the portion of the page that you want, and paste into Keynote.

It ought to be possible to do:

  pbpaste | enscript --color -Eperl -p - | pbcopy -Prefer ps

and get the picture directly on the clipboard, but I couldn't get it  
to work.

  -Ken



More information about the yapc mailing list