The minted package provides automatic syntax highlighting for source code listings. It uses the excellent pygments highlighter, which provides very high quality highlighting for a wide range of languages.
This example also shows how you can use minted to typeset LaTeX math embedded in your source code.
By adapting a previously written percolation model in C, the threshold probabilities for square, triangular, and cubic lattice types were confirmed. An algorithm to count the distribution of cluster sizes at a variety of percolation probabilities was developed, and the expected trends towards the so called infinite cluster was achieved. An equivalent bond percolation model was adapted to the original site algorithm, and by treating occupied bonds as springs, a total compression trend for the model was constructed, which implied that structures under the boundary conditions that were imposed does not have behavior that changes the total compression constant significantly at the percolation threshold.\\