
sawine@0: % Python listing setup
sawine@0: 
sawine@0: \usepackage{color}
sawine@0: \usepackage[procnames]{listings}
sawine@0: \usepackage{textcomp}
sawine@0: \usepackage{setspace}
sawine@0: \usepackage{palatino}
sawine@0: \renewcommand{\lstlistlistingname}{Code Listings}
sawine@0: \renewcommand{\lstlistingname}{Code Listing}
sawine@0: \definecolor{gray}{gray}{0.5}
sawine@0: \definecolor{green}{rgb}{0,0.5,0}
sawine@0: \definecolor{lightgreen}{rgb}{0,0.7,0}
sawine@0: \definecolor{purple}{rgb}{0.5,0,0.5}
sawine@0: \definecolor{darkred}{rgb}{0.5,0,0}
sawine@0: \definecolor{orange}{rgb}{1,0.5,0} 
sawine@0: \lstnewenvironment{python}[1][]{
sawine@0: \lstset{
sawine@0: language=python,
sawine@0: basicstyle=\ttfamily\small\setstretch{1},
sawine@0: stringstyle=\color{green},
sawine@0: showstringspaces=false,
sawine@0: alsoletter={1234567890},
sawine@0: otherkeywords={\ , \}, \{},
sawine@0: keywordstyle=\color{blue},
sawine@0: emph={access,and,as,break,class,continue,def,del,elif,else,%
sawine@0: except,exec,finally,for,from,global,if,import,in,is,%
sawine@0: lambda,not,or,pass,print,raise,return,try,while,assert},
sawine@0: emphstyle=\color{orange}\bfseries,
sawine@0: emph={[2]self},
sawine@0: emphstyle=[2]\color{gray},
sawine@0: emph={[4]ArithmeticError,AssertionError,AttributeError,BaseException,%
sawine@0: DeprecationWarning,EOFError,Ellipsis,EnvironmentError,Exception,%
sawine@0: False,FloatingPointError,FutureWarning,GeneratorExit,IOError,%
sawine@0: ImportError,ImportWarning,IndentationError,IndexError,KeyError,%
sawine@0: KeyboardInterrupt,LookupError,MemoryError,NameError,None,%
sawine@0: NotImplemented,NotImplementedError,OSError,OverflowError,%
sawine@0: PendingDeprecationWarning,ReferenceError,RuntimeError,RuntimeWarning,%
sawine@0: StandardError,StopIteration,SyntaxError,SyntaxWarning,SystemError,%
sawine@0: SystemExit,TabError,True,TypeError,UnboundLocalError,UnicodeDecodeError,%
sawine@0: UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,%
sawine@0: UserWarning,ValueError,Warning,ZeroDivisionError,abs,all,any,apply,%
sawine@0: basestring,bool,buffer,callable,chr,classmethod,cmp,coerce,compile,%
sawine@0: complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,%
sawine@0: execfile,exit,file,filter,float,frozenset,getattr,globals,hasattr,%
sawine@0: hash,help,hex,id,input,int,intern,isinstance,issubclass,iter,len,%
sawine@0: license,list,locals,long,map,max,min,object,oct,open,ord,pow,property,%
sawine@0: quit,range,raw_input,reduce,reload,repr,reversed,round,set,setattr,%
sawine@0: slice,sorted,staticmethod,str,sum,super,tuple,type,unichr,unicode,%
sawine@0: vars,xrange,zip},
sawine@0: emphstyle=[4]\color{purple}\bfseries,
sawine@0: upquote=true,
sawine@0: morecomment=[s][\color{lightgreen}]{"""}{"""},
sawine@0: commentstyle=\color{red}\slshape,
sawine@0: literate={>>>}{\textbf{\textcolor{darkred}{>{>}>}}}3%
sawine@0:          {...}{{\textcolor{gray}{...}}}3,
sawine@0: procnamekeys={def,class},
sawine@0: procnamestyle=\color{blue}\textbf,
sawine@0: framexleftmargin=1mm, framextopmargin=1mm, frame=shadowbox,
sawine@0: rulesepcolor=\color{gray},#1
sawine@0: }}{}
sawine@0: 




