Skip to content

Instantly share code, notes, and snippets.

@FelipeCortez
Last active March 14, 2024 16:35
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save FelipeCortez/10729134 to your computer and use it in GitHub Desktop.
Save FelipeCortez/10729134 to your computer and use it in GitHub Desktop.
LaTeX pretty listings
\usepackage{listings}
\usepackage{lstautogobble} % Fix relative indenting
\usepackage{color} % Code coloring
\usepackage{zi4} % Nice font
\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\footnotesize,
frame=l,
framesep=12pt,
xleftmargin=12pt,
tabsize=4,
captionpos=b
}
@mcraveiro
Copy link

Used this in an emacs org-mode file and it worked out of the box! Thanks very much!

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