Skip to content

Instantly share code, notes, and snippets.

@kroger
Last active August 29, 2015 14:03
Show Gist options
  • Save kroger/ec493cdc24dff6ec5e37 to your computer and use it in GitHub Desktop.
Save kroger/ec493cdc24dff6ec5e37 to your computer and use it in GitHub Desktop.
Printing Python Code With Latex
\newcommand{code}[2]{
hrulefill
subsection*{#1}
lstinputlisting{#2}
vspace{2em}
}
documentclass[10pt]{article}
usepackage[T1]{fontenc}
usepackage[scaled]{beramono}
renewcommand*familydefault{ttdefault}
usepackage{listings}
\lstset{
language=Python,
showstringspaces=false,
formfeed=newpage,
tabsize=4,
commentstyle=itshape,
basicstyle=ttfamily,
morekeywords={models, lambda, forms}
}
\code{Models}{../testapp/models.py}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment