Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
LaTex settings for embedding Python with Monokai theme
\usepackage{listings}
\usepackage{fontspec}
\setmonofont{Consolas}
\definecolor{background}{RGB}{39, 40, 34}
\definecolor{string}{RGB}{230, 219, 116}
\definecolor{comment}{RGB}{117, 113, 94}
\definecolor{normal}{RGB}{248, 248, 242}
\definecolor{identifier}{RGB}{166, 226, 46}
\lstset{
language=python, % choose the language of the code
numbers=left, % where to put the line-numbers
stepnumber=1, % the step between two line-numbers.
numbersep=5pt, % how far the line-numbers are from the code
numberstyle=\tiny\color{black}\ttfamily,
backgroundcolor=\color{background}, % choose the background color. You must add \usepackage{color}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
tabsize=4, % sets default tabsize to 2 spaces
captionpos=b, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
breakatwhitespace=true, % sets if automatic breaks should only happen at whitespace
title=\lstname, % show the filename of files included with \lstinputlisting;
basicstyle=\color{normal}\ttfamily, % sets font style for the code
keywordstyle=\color{magenta}\ttfamily, % sets color for keywords
stringstyle=\color{string}\ttfamily, % sets color for strings
commentstyle=\color{comment}\ttfamily, % sets color for comments
emph={format_string, eff_ana_bf, permute, eff_ana_btr},
emphstyle=\color{identifier}\ttfamily
}
@nhtranngoc
Copy link
Author

nhtranngoc commented Nov 26, 2016

Change emph={} to include all functions you will be using, since LaTex can't tell functions from variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment