Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

build open-axiom

54437 views
1
%% Copyright (C) 2009, Gabriel Dos Reis
2
%% All rights reserved.
3
%% Redistribution and use in source and binary forms, with or without
4
%% modification, are permitted provided that the following conditions are
5
%% met:
6
%%
7
%% - Redistributions of source code must retain the above copyright
8
%% notice, this list of conditions and the following disclaimer.
9
%%
10
%% - Redistributions in binary form must reproduce the above copyright
11
%% notice, this list of conditions and the following disclaimer in
12
%% the documentation and/or other materials provided with the
13
%% distribution.
14
%%
15
%% - Neither the name of The Numerical Algorithms Group Ltd. nor the
16
%% names of its contributors may be used to endorse or promote products
17
%% derived from this software without specific prior written permission.
18
%%
19
%% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20
%% IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21
%% TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22
%% PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
23
%% OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
%% EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
%% PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
%% PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
%% LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
%% NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
%% SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
31
32
\NeedsTeXFormat{LaTeX2e}
33
\ProvidesPackage{open-axiom}[2009/10/11 OpenAxiom LaTeX package]
34
35
%% We build on top of the listings package
36
\RequirePackage{listings}
37
38
39
%% The base Spad language
40
\lstdefinelanguage{Spad}{%
41
keywords={add,and,break,case,else,false,for,has,if,import,%
42
in,is,isnt,iterate,macro,mod,or,pretend,%
43
quot,rem,rule,repeat,return,then,true,with,where,while},%
44
otherkeywords={->,<,<=,>,>=,=,==,~=,=>,\#,::,\@,\$,|},%
45
alsoletter={\%},%
46
comment=[l]{++},%
47
morecomment=[l]{--},%
48
morestring=[b]",%
49
sensitive=true
50
}
51
52
%% OpenAxiom's Spad
53
\lstdefinelanguage[OpenAxiom]{Spad}[]{Spad}{%
54
morecomment=[l][\itshape\bfseries]{++}
55
}
56
57
\lstdefinestyle{spad}{%
58
language=[OpenAxiom]spad,%
59
basicstyle=\renewcommand{\ttdefault}{txtt}\footnotesize\ttfamily,%
60
columns=flexible,%
61
showstringspaces=false
62
}
63
64
%% Inline Spad code
65
%% FIXME: This definition prohibits '!' as valid identifier
66
%% in inline Spad code. That is unfortunate.
67
\newcommand{\OpenAxiomCode}[1]{\lstinline[style=Spad]!#1!}
68
69
%% The main inout environment
70
\lstnewenvironment{OpenAxiomInput}{\lstset{style=spad}}{}
71
72
%% Include a whole Spad file
73
\newcommand{\OpenAxiomFile}[1]{\lstinputlisting[style=Spad]{#1}}
74
75
%% Some legacy commands
76
\newcommand{\spad}[1]{\ensuremath{\mathtt{#1}}}
77
78