summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/stex/tex/etc/lststex.sty
blob: e3865cb464d7e3db613519e2fcbab85ee00c3bff (plain)
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
\RequirePackage{xcolor}
\RequirePackage{listings}

\lstdefinelanguage{pseudocode}
{morekeywords={procedure,function,end,loop,return,to,local,Value,fail,if,then,do,for,else,elif,foreach,in,true,false,
 inputs,returns,persistent,repeat,until,while},
  morecomment=[s]{(*}{*)},
  morecomment=[s]{/*}{*/},   % preferred over (* ... *)
  morecomment=[s][\sl]{<}{>}
}

\lstdefinelanguage[sTeX]{TeX}[LaTeX]{TeX}%
  {moretexcs={[2]defin,twindef,atwindef,definalt,twindefalt,atwindefalt,definiendum,
      importmodule,usemodule,importmhmodule,usemhmodule,gimport,guse,
      symdef,symvariant,symtest,
      defi,defii,defiii,adefi,adefii,adefiii,defis,defiis,defiiis,
      trefi,trefii,trefiii,atrefi,atrefii,atrefiii,mtrefi,mtrefii,mtrefiii,
      trefis,trefiis,trefiiis,atrefis,atrefiis,atrefiiis,
      symi,symii,symiii,
      termref,sref},
   morekeywords={module,definition,axiom,assertion,omtext,
     mhmodule,mhmodsig,mhmodnl,modsig,modnl,
     inputref,
     sproof,spfstep,spfcases,spfcase,justification,premise}}

\definecolor{backcolor}{gray}{.96}

\lstset{columns=fullflexible,basicstyle=\ttfamily}
\lstset{frame=none,numbers=none,lineskip=-.7ex}%,aboveskip=-1em,belowskip=-2em}
\lstset{keywordstyle=[2]\color{red},keywordstyle=[3]\color{blue}}
\lstset{keywordstyle=[4]\color{green},keywordstyle=[5]\color{magenta}}
\lstset{emphstyle=[2]\color{red},emphstyle=[3]\color{blue}}
\lstset{emphstyle=[4]\color{green},emphstyle=[5]\color{magenta}}
\lstset{commentstyle=\color{brown}}
\lstset{backgroundcolor=\color{backcolor}}
\newcommand{\lstkeycolor}[2]{\ifcase#1\textbf{#1}\or\red{#2}\or\blue{#2}\or\green{#2}\or\magenta{#2}\fi}
\define@key{stexlisting}{id}{\def\sref@id{#1}}
\define@key{stexlisting}{id}{\def\stexlst@id{#1}}

% LocalWords:  lstdefinelanguage morekeywords morecomment moretexcs defin sref
% LocalWords:  twindef atwindef definalt twindefalt atwindefalt termref lstset
% LocalWords:  basicstyle scriptsize fullflexible lineskip aboveskip belowskip
% LocalWords:  keywordstyle keywordstyle newcommand lstkeycolor ifcase textbf
% LocalWords:  stexlisting stexlst sproof spfstep symdef spfcases spfcase tt
% LocalWords:  texcsstyle emphstyle emphstyle ttfamily