gb-java-devel/fancy-listings-preamble.tex

134 lines
3.4 KiB
TeX

\usepackage{listings}
\definecolor{codekeywords}{rgb}{0.1,0.4,0.4}
\definecolor{codecomments}{rgb}{0,0.6,0}
\definecolor{codenumbers}{rgb}{0.4,0.4,0.4}
\definecolor{codestring}{rgb}{0.85,0.2,0.1}
\definecolor{backcolour}{rgb}{0.95,0.95,0.92}
\definecolor{codefine}{rgb}{0.7,0.5,0.3}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}
\lstdefinestyle{JCodeStyle}{
frame=single,
language=Java,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle=\scriptsize\ttfamily,
numbers=left,
numberstyle=\tiny\color{gray},
keywordstyle=\color{blue},
commentstyle=\color{dkgreen},
stringstyle=\color{mauve},
breaklines=true,
breakatwhitespace=true,
tabsize=4,
escapeinside={<@}{@>}
}
\lstdefinestyle{PyCodeStyle}{
frame=single,
commentstyle=\color{codecomments},
numberstyle=\tiny\color{codenumbers},
stringstyle=\color{codestring},
basicstyle=\ttfamily\footnotesize,
keywordstyle=\color{codekeywords},
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=4,
escapeinside={<@}{@>}
}
% \DeclareCaptionFormat{listing}{
% \parbox{\textwidth}{\centering#1 - #3}
% }
% \captionsetup[lstlisting]{ format=listing, singlelinecheck=false, margin=0pt }
\lstdefinestyle{CCodeStyle}{
frame=single,
commentstyle=\color{codecomments},
morecomment=[l][\color{codefine}]{\#},
numberstyle=\tiny\color{codenumbers},
stringstyle=\color{codestring},
basicstyle=\ttfamily\footnotesize,
keywordstyle=\color{codekeywords},
emph={int,char,double,float,unsigned,void,bool},
emphstyle={\color{blue}},
breakatwhitespace=false,
breaklines=true,
captionpos=t,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=4,
escapeinside={<@}{@>}
}
\lstdefinestyle{ASMStyle}{
frame=single,
numberstyle=\tiny\color{codenumbers},
commentstyle=\color{codecomments},
keywordstyle=\color{codekeywords},
morecomment=[l]{;}, % l is for line comment
morecomment=[s]{/*}{*/}, % s is for start and end delimiter
basicstyle={\ttfamily\scriptsize},
morekeywords={
bset, macr,
add,addi,and,andi,
bge,beq,bne,br,
cmpeqi,cmpgei,cmplti,cmpnei,
ldhu,ldw,ldwio,
mov,movi,movhi,muli,
nop,nor,
ret,
slli,srai,srli,stw,stwio},
breakatwhitespace=false,
breaklines=true,
captionpos=t,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showtabs=false,
tabsize=4,
escapeinside={<@}{@>}
}
\lstdefinestyle{VerilogStyle}{
frame=single,
numberstyle=\tiny\color{codenumbers},
commentstyle=\color{codecomments},
keywordstyle=\color{codekeywords},
morecomment=[l]{//}, % l is for line comment
morecomment=[s]{/*}{*/}, % s is for start and end delimiter
basicstyle={\ttfamily\footnotesize},
morekeywords={
logic, always_ff, always_comb
},
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showtabs=false,
tabsize=2,
escapeinside={<@}{@>}
}
\lstset{escapeinside={<@}{@>}}