Skip to content

Instantly share code, notes, and snippets.

@katrinafyi
Forked from FelipeCortez/listings.tex
Created April 4, 2020 02:10
Show Gist options
  • Save katrinafyi/a5ccfc9ee609c16a68dcfb1ca58e1aa9 to your computer and use it in GitHub Desktop.
Save katrinafyi/a5ccfc9ee609c16a68dcfb1ca58e1aa9 to your computer and use it in GitHub Desktop.
LaTeX pretty listings
\usepackage{listings}
\usepackage{lstautogobble} % Fix relative indenting
\usepackage{color} % Code coloring
\definecolor{bluekeywords}{rgb}{0.13, 0.13, 1}
\definecolor{greencomments}{rgb}{0, 0.5, 0}
\definecolor{redstrings}{rgb}{0.9, 0, 0}
\definecolor{graynumbers}{rgb}{0.5, 0.5, 0.5}
\usepackage{listings}
\lstset{
autogobble,
columns=fullflexible,
showspaces=false,
showtabs=false,
breaklines=true,
showstringspaces=false,
breakatwhitespace=true,
escapeinside={(*@}{@*)},
commentstyle=\color{greencomments},
keywordstyle=\color{bluekeywords},
stringstyle=\color{redstrings},
numberstyle=\color{graynumbers},
basicstyle=\ttfamily\small,
frame=l,
framesep=12pt,
xleftmargin=12pt,
tabsize=4,
captionpos=b
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment