Skip to content

Instantly share code, notes, and snippets.

@monadplus
Created March 9, 2020 16:10
Show Gist options
  • Save monadplus/45fa6238af6e4698ae0a6d94bc65e075 to your computer and use it in GitHub Desktop.
Save monadplus/45fa6238af6e4698ae0a6d94bc65e075 to your computer and use it in GitHub Desktop.
Code listing with package listings
\usepackage{xcolor}
\definecolor{codegreen}{rgb}{0,0.5,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\usepackage{listings}
\lstset{
backgroundcolor=\color{backcolour},
basicstyle=\small\sffamily,
commentstyle=\it\color{codegray},
stringstyle=\mdseries\rmfamily\color{codegreen},
keywordstyle=\bfseries\rmfamily\color{codegreen},
frame=single, % none
xleftmargin=2pt,
stepnumber=1,
numbers=left,
numbersep=5pt,
numberstyle=\ttfamily\tiny\color[gray]{0.3},
belowcaptionskip=\bigskipamount,
captionpos=b,
%escapeinside={*'}{'*},
language=haskell,
tabsize=2,
emphstyle={\bf},
columns=flexible,
showspaces=false,
showstringspaces=false,
showtabs=false, % show tabs within strings adding particular underscores
morecomment=[l]\%,
rulecolor=\color{black} % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
}
\begin{document}
\begin{lstlisting}
class Classifier c where
-- | Given a training set returns a trained classifier
train :: [(Sample, Class)] -> c
-- | Given a random sample, predict a class
predict :: Sample -> c -> [(Class, Probability)]
\end{lstlisting}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment