| 1 |
|
| 2 |
\usepackage{listings} |
| 3 |
\usepackage{color} |
| 4 |
|
| 5 |
\definecolor{hellgelb}{rgb}{1,1,0.9} |
| 6 |
\definecolor{colKeys}{rgb}{0,0,1} |
| 7 |
\definecolor{colIdentifier}{rgb}{0,0,0} |
| 8 |
\definecolor{colComments}{rgb}{1,0,0} |
| 9 |
\definecolor{colString}{rgb}{0,0.5,0} |
| 10 |
|
| 11 |
% Symbol to put when line wraps |
| 12 |
\newcommand{\wrapsign}{\hbox{\rm\ensuremath\hookleftarrow}} |
| 13 |
|
| 14 |
% |
| 15 |
% Default verbatim layout used if \lstparamset not defined |
| 16 |
% |
| 17 |
\@ifundefined{lstparamset}{ |
| 18 |
\lstset{% |
| 19 |
basicstyle=\ttfamily\small, % |
| 20 |
identifierstyle=\color{colIdentifier}, % |
| 21 |
keywordstyle=\color{colKeys}, % |
| 22 |
stringstyle=\color{colString}, % |
| 23 |
commentstyle=\color{colComments}, % |
| 24 |
tabsize=2, % |
| 25 |
frame=single, % |
| 26 |
framerule=0pt, % |
| 27 |
extendedchars=true, % |
| 28 |
showspaces=false, % |
| 29 |
showlines=true, % |
| 30 |
showstringspaces=false, % |
| 31 |
numberstyle=\tiny, % |
| 32 |
breaklines=true, % |
| 33 |
prebreak={\space\wrapsign}, % |
| 34 |
backgroundcolor=\color[gray]{0.95}, % |
| 35 |
breakautoindent=true, % |
| 36 |
captionpos=b% |
| 37 |
} |
| 38 |
}{ |
| 39 |
% Call the user macro that defines the layout |
| 40 |
\lstparamset |
| 41 |
} |
| 42 |
|
| 43 |
% |
| 44 |
% GAP language, derivated from Pascal, has more keywords to highlight |
| 45 |
% |
| 46 |
\lstdefinelanguage[]{GAP}[]{Pascal}{% |
| 47 |
morekeywords={od,fi,alias}% |
| 48 |
} |
| 49 |
|
| 50 |
% Lengths to compute the listing width from the number of characters |
| 51 |
\newlength{\lstcharwidth} |
| 52 |
\newlength{\lstcharwidthb} |
| 53 |
\newlength{\lstframesep} |
| 54 |
\newlength{\lstwidth} |
| 55 |
\setlength{\lstcharwidth}{\lst@width} |
| 56 |
%\let\lstcharwidth\lst@width |
| 57 |
\setlength{\lstframesep}{\lst@frametextsep} |
| 58 |
|
| 59 |
% Setup to compute a char width |
| 60 |
\def\lstsetup{\sbox{\z@}{\lstinline!x!}% |
| 61 |
\settowidth{\lstcharwidth}{\usebox{\z@}}% |
| 62 |
\sbox{\z@}{\lstinline[basicstyle=\ttfamily]!x!} |
| 63 |
\settowidth{\lstcharwidthb}{\usebox{\z@}}} |
| 64 |
|
| 65 |
% Environment to render fancyvrb like listings does |
| 66 |
\newenvironment{fvlisting}[1][] |
| 67 |
{\lstset{fancyvrb,#1}} |
| 68 |
{\lstset{fancyvrb=false}} |