%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode

\documentclass[a4paper, 11pt]{scrartcl}

\usepackage[english]{babel}
\usepackage{xcolor}
\usepackage{xltxtra}
\usepackage{fontspec}
\usepackage{listings}

% COLORS (Tango)
\definecolor{LightButter}{rgb}{0.98,0.91,0.31}
\definecolor{LightOrange}{rgb}{0.98,0.68,0.24}
\definecolor{LightChocolate}{rgb}{0.91,0.72,0.43}
\definecolor{LightChameleon}{rgb}{0.54,0.88,0.20}
\definecolor{LightSkyBlue}{rgb}{0.45,0.62,0.81}
\definecolor{LightPlum}{rgb}{0.68,0.50,0.66}
\definecolor{LightScarletRed}{rgb}{0.93,0.16,0.16}
\definecolor{Butter}{rgb}{0.93,0.86,0.25}
\definecolor{Orange}{rgb}{0.96,0.47,0.00}
\definecolor{Chocolate}{rgb}{0.75,0.49,0.07}
\definecolor{Chameleon}{rgb}{0.45,0.82,0.09}
\definecolor{SkyBlue}{rgb}{0.20,0.39,0.64}
\definecolor{Plum}{rgb}{0.46,0.31,0.48}
\definecolor{ScarletRed}{rgb}{0.80,0.00,0.00}
\definecolor{DarkButter}{rgb}{0.77,0.62,0.00}
\definecolor{DarkOrange}{rgb}{0.80,0.36,0.00}
\definecolor{DarkChocolate}{rgb}{0.56,0.35,0.01}
\definecolor{DarkChameleon}{rgb}{0.30,0.60,0.02}
\definecolor{DarkSkyBlue}{rgb}{0.12,0.29,0.53}
\definecolor{DarkPlum}{rgb}{0.36,0.21,0.40}
\definecolor{DarkScarletRed}{rgb}{0.64,0.00,0.00}
\definecolor{Aluminium1}{rgb}{0.93,0.93,0.92}
\definecolor{Aluminium2}{rgb}{0.82,0.84,0.81}
\definecolor{Aluminium3}{rgb}{0.73,0.74,0.71}
\definecolor{Aluminium4}{rgb}{0.53,0.54,0.52}
\definecolor{Aluminium5}{rgb}{0.33,0.34,0.32}
\definecolor{Aluminium6}{rgb}{0.18,0.20,0.21}

% HYPERREF
\usepackage[dvipdfm, bookmarks, colorlinks, breaklinks, pdftitle={Glare},
    pdfauthor={Philipp Bunge}]{hyperref}
\hypersetup{
	linkcolor=DarkSkyBlue,
	citecolor= DarkSkyBlue,
	filecolor= DarkSkyBlue,
	urlcolor= DarkSkyBlue
}


% FONTS
\setromanfont[Ligatures={Common},Numbers={Lining}]{Adobe Caslon Pro}
\setmonofont[Scale=0.8]{Liberation Mono}
\setsansfont[Scale=0.9]{Optima Regular}

% TYPEAREA
\typearea[12mm]{11}

% LISTINGS
\lstdefinelanguage{Smalltalk}{
	% classes:
	morekeywords=[1]{Transcript},
	% variables:
	morekeywords=[2]{},
	% method definitions:
	morekeywords=[3]{},
	% keywords:
	morekeywords=[4]{true,false,nil},
	morekeywords=[5]{self,super},
	sensitive=true,
	morecomment=[s]{"}{"},
	morestring=[d]',
	alsoletter={:}
}

\lstset{
	keywordstyle=[1]{\color{DarkSkyBlue}},
	keywordstyle=[2]{\color{DarkScarletRed}},
	keywordstyle=[3]{\bfseries},
	keywordstyle=[4]{\color{DarkPlum}},
	keywordstyle=[5]{\color{SkyBlue}},
	commentstyle={\color{Aluminium4}},
	stringstyle={\color{Chocolate}},
	tabsize=4,
	breaklines=true,
	basicstyle={\ttfamily},
	xleftmargin=21pt,
	xrightmargin=11pt,
	frame=single,
	rulecolor=\color{black!30},
	captionpos=b,
	framesep=10pt,
	framexleftmargin=18pt,
	numbers=none,
	numberstyle={\tiny},
	stepnumber=1,
	numbersep=15pt
}

\begin{document}

\title{Listing with Tango Colors}
\author{Philipp Bunge}
\date{}

\maketitle

\setlength{\parskip}{1em}
\setlength{\parindent}{0pt}



The following shows an example of a source code listing highlighted with colors from the \href{http://tango.freedesktop.org/}{Tango theme}. This document is set with \XeLaTeX, uses some non–default fonts and uses the \emph{listings} package for setting the source code listings.


\vspace{4em}

\begin{lstlisting}[%
	language=Smalltalk,%
	morekeywords={Transcript},%
	classoffset=1,%
	morekeywords={x,y,:each,each},%
	classoffset=2,%
	morekeywords={exampleWithNumber:}%
]
exampleWithNumber: x
	"A method that illustrates every part of Smalltalk method syntax
	except primitives. It has unary, binary, and key word messages,
	declares arguments and temporaries (but not block temporaries),
	accesses a global variable (but not and instance variable),
	uses literals (array, character, symbol, string, integer, float),
	uses the pseudo variable true false, nil, self, and super,
	and has sequence, assignment, return and cascade. It has both zero
	argument and one argument blocks. It doesn't do anything useful,
	though"
	|y|
	true & false not & (nil isNil) ifFalse: [self halt].
	y := self size + super size.
	#($a #a 'a' 1 1.0)
		do: [:each | Transcript
			show: (each class name);
			show: (each printString);
			show: ' '].
	^ x < y
\end{lstlisting}

\newpage
\section*{Source of this file}

For reference, here is the sourcecode of this file:

\lstinputlisting[language=tex,numbers=left]{tango.tex}

\end{document}
