Return to Snippet

Revision: 22908
at January 25, 2010 14:35 by jonathanbp


Updated Code
\title{Nice Code}
\author{Jonathan Bunde-Pedersen}

\documentclass[12pt]{article}

\usepackage{color}
\usepackage{fancyvrb}
\usepackage{listings}

% include the lines below to use a nicer fixed-width font than the default one
\usepackage{fontspec}
\setmonofont[Scale=0.8]{Consolas} 

\lstset{fancyvrb=true}
\lstset{
	basicstyle=\small\tt,
	keywordstyle=\color{blue},
	identifierstyle=,
	commentstyle=\color{green},
	stringstyle=\color{red},
	showstringspaces=false,
	tabsize=3,
	numbers=left,
	captionpos=b,
	numberstyle=\tiny
	%stepnumber=4
	}

\begin{document}
\maketitle

\section{Some nice Java code}

\begin{figure}[h]
\lstset{language=java,caption=Nicely formatted code.,label=lst:nicecode}
\begin{lstlisting}
public class Whatever {
	public static void main(String[] args) {
		// whatever
		System.out.println("Hello, world!");
	}	
}
\end{lstlisting}
\end{figure}


\end{document}

Revision: 22907
at January 25, 2010 14:34 by jonathanbp


Initial Code


Initial URL


Initial Description


Initial Title
latex source code formatting

Initial Tags
textmate, java, code

Initial Language
LaTeX