Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- documentclass{article}
- usepackage[T1]{fontenc}
- usepackage[lighttt]{lmodern} % bold and italic ttfamily
- usepackage{color}
- usepackage{listings}
- usepackage{setspace}
- definecolor{Code}{rgb}{0.1,0.1,0.1}
- definecolor{Decorators}{rgb}{0.7,0,0.7}
- definecolor{Numbers}{rgb}{0.5,0,0}
- definecolor{MatchingBrackets}{rgb}{0.25,0.5,0.5}
- definecolor{Keywords}{rgb}{0,0,1}
- definecolor{self}{rgb}{.87,.46,0}
- definecolor{Strings}{rgb}{0,0.66,0}
- definecolor{Comments}{rgb}{0.388,0.4705,0.518}
- definecolor{Backquotes}{rgb}{0,0,0}
- definecolor{Classname}{rgb}{0,0,0}
- definecolor{FunctionName}{rgb}{0,0,0}
- definecolor{Operators}{rgb}{0,0,0}
- definecolor{Background}{rgb}{0.99,0.99,0.99}
- lstset{
- language=Python,
- numbers=left,
- numberstyle=footnotesize,
- numbersep=1em,
- xleftmargin=3em,
- linewidth=23cm,
- framextopmargin=1em,
- framexbottommargin=1em,
- showspaces=false,
- showtabs=false,
- showstringspaces=false,
- frame=l,
- tabsize=4,
- % Basic
- basicstyle=ttfamilysmall,
- backgroundcolor=color{Background},
- % Comments
- commentstyle=color{Comments}slshape,
- % Strings
- stringstyle=color{Strings},
- morecomment=[s][color{Strings}]{"""}{"""},
- morecomment=[s][color{Strings}]{'''}{'''},
- % keywords
- keywordstyle={color{Keywords}bfseries},
- % additional keywords
- keywordstyle={[2]color{Decorators}},
- emph={self},
- emphstyle={color{self}slshape},
- }%
- begin{document}
- lstset{language=Python, breaklines=true}
- begin{lstlisting}
- class MyClass:
- def __init__(self):
- print('do a thing')
- foo = MyClass()
- end{lstlisting}
- end{document}
- lstset{moredelim=[s][bfseries]{class }{:},
- moredelim=[s][bfseries]{def }{(},}
Add Comment
Please, Sign In to add comment