forked from sarl/sarl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sarl-beamer-listing.sty
85 lines (85 loc) · 4.25 KB
/
sarl-beamer-listing.sty
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
%
% $Id$
%
% File is automatically generated by the Xtext language generator.
% Do not change it.
%
% SARL is an general-purpose agent programming language.
% More details on http://www.sarl.io
%
% Copyright (C) 2014-2018 the original authors or authors.
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{sarl-beamer-listing}[2018/05/28]
\newif\ifusesarlcolors\usesarlcolorstrue
\DeclareOption{sarlcolors}{\global\usesarlcolorstrue}
\DeclareOption{nosarlcolors}{\global\usesarlcolorsfalse}
\ProcessOptions*
\RequirePackage{algpseudocode}
\RequirePackage{listings}
\RequirePackage{xspace}
\RequirePackage{xcolor}
\definecolor{SARLblue}{RGB}{43,88,121}
\definecolor{SARLdarkgray}{RGB}{99,104,110}
\definecolor{SARLgreen}{RGB}{0,128,0}
\definecolor{SARLlightblue}{RGB}{0,123,191}
\definecolor{SARLlightestblue}{RGB}{223,239,247}
\definecolor{SARLlightestmagenta}{RGB}{250,240,246}
\definecolor{SARLlightmagenta}{RGB}{204,122,170}
\definecolor{SARLmagenta}{RGB}{153,30,102}
\colorlet{SARLcomment}{SARLgreen}
\colorlet{SARLstring}{SARLmagenta}
\colorlet{SARLkeyword}{SARLblue}
\colorlet{SARLidentifier}{SARLdarkgray}
\colorlet{SARLlinenumber}{SARLblue}
\lstdefinelanguage{SARL}{%
morecomment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]",
morekeywords={abstract,agent,annotation,artifact,as,assert,assume,behavior,boolean,break,byte,capacity,case,catch,char,class,continue,def,default,dispatch,do,double,else,enum,event,extends,extension,false,final,finally,fires,float,for,if,implements,import,instanceof,int,interface,it,long,native,new,null,occurrence,on,override,package,private,protected,public,requires,return,short,skill,space,static,strictfp,super,switch,synchronized,this,throw,throws,transient,true,try,typeof,uses,val,var,void,volatile,while,with},
}
\lstset{%
basicstyle=\usebeamertemplate{code basic style}, % the size of the fonts that are used for the code
breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace
breaklines=true, % sets automatic line breaking
captionpos=b, % sets the caption-position to bottom
deletekeywords={filter}, % if you want to delete keywords from the given language
escapeinside={(*@}{@*)}, % if you want to add LaTeX within your code
extendedchars=true, % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8
frame=none, % no frame around the code
keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible)
identifierstyle=\usebeamertemplate{code identifier style},
commentstyle=\usebeamercolor[fg]{code comment},
stringstyle=\usebeamercolor[fg]{code string},
keywordstyle=\usebeamertemplate*{code keyword style}\usebeamercolor[fg]{code keyword}, % keyword style
language=SARL, % the default language of the code
showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces'
showstringspaces=false, % underline spaces within strings only
showtabs=false, % show tabs within strings adding particular underscores
tabsize=2, % sets default tabsize to 2 spaces
title=\lstname, % show the filename of files included with \lstinputlisting; also try caption instead of title
frameround=fttt, % If framed, use this rounded corner style
xleftmargin=20pt,
numberstyle=\color{SARLlinenumber}\tiny,
}
\newcommand{\code}[1]{\ifmmode\text{\lstinline[basicstyle=\usebeamertemplate{code inline style}]{#1}}\else\lstinline[basicstyle=\usebeamertemplate{code inline style}]{#1}\fi}
\newcommand{\sarl}{\mbox{SARL}\xspace}
\newcommand{\sarlversion}{0.8}
\ifusesarlcolors
\setbeamercolor*{code keyword}{fg=SARLkeyword}
\setbeamercolor*{code string}{fg=SARLstring}
\setbeamercolor*{code comment}{fg=SARLcomment}
\fi
\endinput