summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/stex/tex/etc/lststex.sty
blob: 2b0f7a9b2e9590d52cd0c650c4747975986d7bfd (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
\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]definiendum,definame,symref,symname,comp,
      importmodule,usemodule
      symdef,symdecl,notation,sref},
   morekeywords={smodule,sdefinition,sassertion,sparagraph,
     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