Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %import these packages at the top of your tex file
- \usepackage{listings}
- \usepackage{xcolor}
- %define this color scheme for syntax coloring
- \definecolor{codegreen}{rgb}{0,0.6,0}
- \definecolor{codegray}{rgb}{0.5,0.5,0.5}
- \definecolor{codepurple}{rgb}{0.58,0,0.82}
- \definecolor{backcolour}{rgb}{0.95,0.95,0.92}
- %set this preamble in for the lstlisting preamble
- \lstdefinestyle{mystyle}{
- backgroundcolor=\color{backcolour},
- commentstyle=\color{codegreen},
- keywordstyle=\color{magenta},
- numberstyle=\tiny\color{codegray},
- stringstyle=\color{codepurple},
- basicstyle=\ttfamily\footnotesize,
- breakatwhitespace=false,
- breaklines=true,
- captionpos=b,
- keepspaces=true,
- numbers=left,
- numbersep=2pt,
- showspaces=false,
- showstringspaces=false,
- showtabs=false,
- tabsize=2
- }
- \lstset{style=mystyle}
- %finally put this in Exercise 2 b
- \begin{lstlisting}[language=Python]
- %your python code goes here
- \end{lstlisting}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement