This is something I had up on this forum since last summer, but it was in a question thread so I thought I should share this here in the proper category as well.

Current version: v1.2

This LaTeX listings template will color your Processing code as you see them in the Processing editor. You can just post your code like you normally would using the listings package, and you will automatically get your code in the proper colors. Except one minor inconvenience, that I will explain here.

For a function name that is the same as an already defined keyword (Such as "boolean" and "boolean()"), you have to use [escapechar = "char"] and \color{"color"}{"text"} to color them properly. Example:

\begin{lstlisting}[escapechar = ?] boolean; ?\color{function}{boolean}?(1); \end{lstlisting}

Copy and paste the below template if you want to use it. Alternatively, you can copy only the necessary parts. If in that case, note that \usepackage{listings} and \usepackage{color} is a must for this to work.

Also note, I have licensed this work with CreativeCommons license CC-BY-SA, so please remember to give some credit to me ;)

If you find any typos or any other errors, please tell me and I'll try to fix them as much as possible.

Download version:

http://www.mediafire.com/file/cw861uy156xftkv/article_listing_Processing_v1.2.tex

GitHub Gist:

https://gist.github.com/ebigunso/af355220e932f72d03289c576622aa29

Full template below: