forked from Angtrim/alloy-latex-highlighting
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alloy-style.sty
108 lines (103 loc) · 3.13 KB
/
alloy-style.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
% alloy.sty
% Alloy mode for the LaTeX listings package.
% This is public domain
\lstdefinelanguage{alloy}{
keywords={%
assert, pred, all, no, lone, one, some, check, run,
but, let, implies, not, iff, in, and, or, set, sig, Int, int,
if, then, else, exactly, disj, fact, fun, module, abstract,
extends, open, none, univ, iden, seq,
},
literate=%
*{:}{{{\color[HTML]{2835C0}{$\colon$}}}}1
{>}{{{\color[HTML]{2835C0}{>}}}}1
{<}{{{\color[HTML]{2835C0}{<}}}}1
{|}{{{\color[HTML]{2835C0}{|}}}}1
{==}{{{\color[HTML]{2835C0}{$=$}}}}1
{=}{{{\color[HTML]{2835C0}{$=$}}}}1
{!=}{{{\color[HTML]{2835C0}{$\neq$}}}}1
{&&}{{{\color[HTML]{2835C0}{$\land$}}}}1
{||}{{{\color[HTML]{2835C0}{$\lor$}}}}1
{<=}{{{\color[HTML]{2835C0}{$\le$}}}}1
{>=}{{{\color[HTML]{2835C0}{$\ge$}}}}1
{!in}{{{\color[HTML]{2835C0}{$\not\in$}}}}1
{\\in}{{{\color[HTML]{2835C0}{$\in$}}}}1
{=>}{{{\color[HTML]{2835C0}{$\implies$}}}}2
% the following isn't actually Alloy, but it gives the option to produce nicer latex
{|=>}{{{\color[HTML]{2835C0}{$\Rightarrow$}}}}2
{<=set}{{{\color[HTML]{2835C0}{$\subseteq$}}}}1
{+set}{{{\color[HTML]{2835C0}{$\cup$}}}}1
{*set}{{{\color[HTML]{2835C0}{$\cap$}}}}1
{==>}{{{{\color[HTML]{2835C0}$\Longrightarrow$}}}}3
{<==>}{$\Longleftrightarrow$}4
{...}{$\ldots$}1
{\\hl}{$\hline$}1
{\\alpha}{$\alpha$}1
{\\beta}{$\beta$}1
{\\gamma}{$\gamma$}1
{\\delta}{$\delta$}1
{\\epsilon}{$\epsilon$}1
{\\zeta}{$\zeta$}1
{\\eta}{$\eta$}1
{\\theta}{$\theta$}1
{\\iota}{$\iota$}1
{\\kappa}{$\kappa$}1
{\\lambda}{$\lambda$}1
{\\mu}{$\mu$}1
{\\nu}{$\nu$}1
{\\xi}{$\xi$}1
{\\pi}{$\pi$}1
{\\rho}{$\rho$}1
{\\sigma}{$\sigma$}1
{\\tau}{$\tau$}1
{\\upsilon}{$\upsilon$}1
{\\phi}{$\phi$}1
{\\chi}{$\chi$}1
{\\psi}{$\psi$}1
{\\omega}{$\omega$}1
{\\Gamma}{$\Gamma$}1
{\\Delta}{$\Delta$}1
{\\Theta}{$\Theta$}1
{\\Lambda}{$\Lambda$}1
{\\Xi}{$\Xi$}1
{\\Pi}{$\Pi$}1
{\\Sigma}{$\Sigma$}1
{\\Upsilon}{$\Upsilon$}1
{\\Phi}{$\Phi$}1
{\\Psi}{$\Psi$}1
{\\Omega}{$\Omega$}1
{\\EOF}{\;}1
,
sensitive=true, % case sensitive
morecomment=[l]//,%
morecomment=[l]{--},%
morecomment=[s]{/*}{*/},%
morestring=[b]",
numbers=none,
firstnumber=1,
numberstyle=\tiny,
stepnumber=2,
basicstyle=\scriptsize\ttfamily,
commentstyle=\color[HTML]{00A108}\itshape,
keywordstyle=\color[HTML]{2835C0}\bfseries,
ndkeywordstyle=\bfseries,
}
% inline
\def\A{%
\lstinline[language=alloy,basicstyle=\ttfamily,columns=fixed]}
% paragraph
\lstnewenvironment{alloy}[1][]{%
\lstset{language=alloy,
floatplacement={tbp},captionpos=b,
xleftmargin=8pt,xrightmargin=8pt,basicstyle=\ttfamily,#1}}{}
% paragraph from file
\newcommand{\alloyfile}[1]{
\lstinputlisting[language=alloy,%
frame=lines,xleftmargin=8pt,xrightmargin=8pt,basicstyle=\ttfamily,columns=fixed]{#1}
}
\lstset{
%Add this if you want to display border around your code
%frame=single,
breaklines=true,
postbreak=\raisebox{0ex}[0ex][0ex]{\ensuremath{\color{red}\hookrightarrow\space}}
}