Skip to content

Instantly share code, notes, and snippets.

@himito
Created September 12, 2017 08:15
Show Gist options
  • Save himito/cd47aa3d832a6cc4deadaaf866bf348f to your computer and use it in GitHub Desktop.
Save himito/cd47aa3d832a6cc4deadaaf866bf348f to your computer and use it in GitHub Desktop.
Solarized Listings
\usepackage{fancyvrb}
\usepackage{listings}
\renewcommand{\lstlistingname}{\textsc{Program}}
\definecolor{keywordscolor1}{RGB}{72, 91, 98}
\definecolor{keywordscolor2}{RGB}{133, 153, 3}
\definecolor{keywordscolor3}{RGB}{181, 137, 3}
\definecolor{identifiercolor}{RGB}{37, 116, 206}
\definecolor{commentscolor}{RGB}{130, 144, 144}
\definecolor{attributescolor}{RGB}{203, 75, 22}
\definecolor{numberscolor}{RGB}{101, 123, 131}
\definecolor{stringscolor}{RGB}{48, 145, 134}
\definecolor{backgroundcolor}{RGB}{253, 246, 227}
\newcommand*{\FormatDigit}[1]{\textcolor{numberscolor}{#1}}
\lstset{
basicstyle = \footnotesize\ttfamily, % the size of the fonts that are used for the code
identifierstyle = \color{identifiercolor},
commentstyle = \itshape\color{commentscolor}, % comment style
keywordstyle = \bfseries\color{keywordscolor1}, % keyword style
keywordstyle = {[2]\bfseries\color{keywordscolor2}},
keywordstyle = {[3]\bfseries\color{keywordscolor3}},
keywordstyle = {[4]\bfseries\color{attributescolor}},
stringstyle = \color{stringscolor}, % string literal style
backgroundcolor = \color{backgroundcolor}, % choose the background color; you must add \usepackage{color} or \usepackage{xcolor}
numberstyle = \ttfamily\tiny, % the style that is used for the line-numbers
breakatwhitespace = false, % sets if automatic breaks should only happen at whitespace
breaklines = true, % sets automatic line breaking
captionpos = b, % sets the caption-position to bottom
frame = tb, % adds a frame around the code
rulecolor = \color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here))
xleftmargin = \parindent,
xrightmargin = \parindent,
keepspaces = true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
numbers = left, % where to put the line-numbers; possible values are (none, left, right)
numbersep = 5pt, % how far the line-numbers are from the code
showspaces = false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
showstringspaces = false, % underline spaces within strings only
showtabs = false, % show tabs within strings adding particular underscores
stepnumber = 1, % the step between two line-numbers. If it's 1, each line will be numbered
tabsize = 2, % sets default tabsize to 2 spaces
float = htb,
aboveskip = .5cm,
mathescape = true,
literate = *{0}{{\FormatDigit{0}}}{1}%
{1}{{\FormatDigit{1}}}{1}%
{2}{{\FormatDigit{2}}}{1}%
{3}{{\FormatDigit{3}}}{1}%
{4}{{\FormatDigit{4}}}{1}%
{5}{{\FormatDigit{5}}}{1}%
{6}{{\FormatDigit{6}}}{1}%
{7}{{\FormatDigit{7}}}{1}%
{8}{{\FormatDigit{8}}}{1}%
{9}{{\FormatDigit{9}}}{1}%
{INF}{{\FormatDigit{INF}}}{3},%
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment