beautiful code listings

This commit is contained in:
Marvin Schlegel 2024-07-05 09:43:37 +02:00
parent 574628d3f7
commit a64d732fa4

View File

@ -16,6 +16,39 @@
filecolor=magenta,
urlcolor=cyan,
}
%for code listings
\usepackage{listings}
\usepackage{xcolor}
\definecolor{ListingBackground}{HTML}{F8F8F8}
\lstdefinestyle{mystyle}{
language=Java, % default language
numbers=left, % position of line numbers (left, right)
stepnumber=1, % set number to each line
numbersep=5pt, % 5pt between number and source code
numberstyle=\tiny, % letter size of numbers
breaklines=true, % break lines if necessary (true, false)
breakautoindent=true, % indenting after break line (true, false)
postbreak=\space, % break line after space
tabsize=2, % tabulator size
basicstyle=\ttfamily\footnotesize, % font style
showspaces=false, % show space (true, false)
extendedchars=true, % show all Latin1 characters (true, false)
captionpos=b, % sets the caption-position to bottom
backgroundcolor=\color{ListingBackground}, % source code background
xleftmargin=10pt, % margin left
xrightmargin=5pt, % margin right
frame=single, % border settings
frameround=ffff,
rulecolor=\color{darkgray}, % border color
fillcolor=\color{ListingBackground},
aboveskip=20pt,
keywordstyle=\color[rgb]{0.133,0.133,0.6},
commentstyle=\color[rgb]{0.133,0.545,0.133},
stringstyle=\color[rgb]{0.627,0.126,0.941}
}
\lstset{style=mystyle}
\let\clearpage\relax
\begin{document}