\RequirePackage{listings}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Listings
% 
% we define our own dialects for omdoc in listings.sty
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\lstdefinelanguage{DTD}%
  {morekeywords={ATTLIST,ELEMENT,EMPTY,ANY,ID,%
      IDREF,IDREFS,ENTITY,ENTITIES,NMTOKEN,NMTOKENS,NOTATION,%
      INCLUDE,IGNORE,SYSTEM,PUBLIC,NDATA,%
      PCDATA,REQUIRED,IMPLIED,FIXED},%%% preceded by #
   alsoother=$,%
   alsoletter=:,%
   showstringspaces=false,
   sensitive=true}

\lstdefinelanguage{RNC}%
  {morekeywords={default,namespace,=,start,attribute,include,element,notallowed},
   alsoother=$,%
   alsoletter=:,%
   showstringspaces=false,
   sensitive=true}

\lstdefinelanguage{DublinCore}[]{XML}%
  {morekeywords={Contributor,Creator,Title,Subject,Description,Publisher,Type,Format,Source,Language,Relation,Rights,Date,Identifier},
   sensitive=true}

\lstdefinelanguage{OpenMath}[]{XML}%
  {morekeywords={OMS,OMV,OMI,OMB,OMSTR,OMF,OMA,OMBIND,OMBVAR,OME,OMATTR,OMATP,OMR,OMOBJ,OMFOREIGN},
   sensitive=true}

\lstdefinelanguage[om]{OpenMath}[]{XML}{keywordsprefix={om:},sensitive=true}

\lstdefinelanguage{omCD}[]{XML}%
  {morekeywords={CD,CDBase,CDName,CDURL,CDDate,CDReviewDate,CDStatus,CDVersion,CDRevision,CDUses,
                 CDDefinition,Name,Description,Role,CMP,FMP},
   sensitive=true}

\lstdefinelanguage{MathML}[]{XML}%
{morekeywords={math,semantics,annotation-xml,annotation,share,
               maction,mspace,
               msub,msup,msubsup,
               mrow,mo,mi,mn,mfrac,mfenced,
               apply,bvar,ci,cn,sep,csymbol,
               condition,domainofapplication,lowlimit,uplimit,degree,
               interval,inverse,lambda,compose,ident,domain,codomain,image,
               piecewise, piece, otherwise,
               quotient,factorial,divide,max,min,minus,plus,power,rem,times, root,gcd,lcm,
               and,or,xor,not,implies,forall,exists,
               abs,conjugate,arg,real,imaginary,floor,ceiling,
               sin,cos,tan,sec,csc,cot,sinh,cosh,tanh,sech,csch,coth,
               arcsin,arccos,arctan,arccosh,arccot,arccoth,arccsc,arccsch,arcsec,arcsech,arcsinh,arctanh,
               eq,neq,gt,lt,geq,leq,equivalent,approx,factorof,
               int,diff,partialdiff,divergence,grad,curl,laplacian,
               set,list,union,intersect,in,notin,subset,prsubset,notsubset,notprsubset,setdiff,card,cartesianproduct,
               sum,product,limit,tendsto,exp,ln,log,mean,sdev,variance,median,mode,moment,momentabout,
               vector,matrix,matrixrow,determinant,transpose,selector,vectorproduct,scalarproduct,outerproduct,
               integers,reals,rationals,naturalnumbers,complexes,primes,
               exponentiale,imaginaryi,notanumber,true,false,emptyset,pi,eulergamma,infinity,
               mstack,msgroup,msrow,msline,mscarries,mscarry,mlongdiv,
               reln,fn,declare},
   sensitive=true}

\lstdefinelanguage[m]{MathML}[]{XML}{keywordsprefix={m:},sensitive=true}

\lstdefinelanguage[codeml]{XML}[]{XML}%
  {morekeywords={cpg,cpb,cpo,cpi,cpbr,cptype,cpt,cpd,cpc,cpstyle,apply,bind,bvar,ccv,ccb,ccsym,ccdef,symbol,type,semantics,pcode,rawcode,code},
   morekeywords=[2]{id,xlink:xref,xlink:type,xlink:role,open,close,separator,type,xml:lang,name,cd,format,href,breaks},
   sensitive=true}

\lstdefinelanguage[1.2]{OMDoc}[]{XML}%
  {morekeywords={omdoc,catalogue,loc,ignore,with,ref,omgroup,adt,sortdef,insort,constructor,
                 recognizer,argument,destructor,morphism,inclusion,theory-inclusion,decomposition,
                 axiom-inclusion,path-just,obligation,omlet,private,code,input,output,effect,data,
                 metadata,extradata,proof,proofobject,metacomment,derive,conclude,hypothesis,
                 method,premise,presentation,use,omstyle,xslt,style,element,attribute,text,
                 value-of,recurse,exercise,hint,solution,mc,choice,answer,CMP,p,omtext,term,phrase,symbol,
                 commonname,type,FMP,assumption,conclusion,symbol,axiom,definition,requation,pattern,
                 value,measure,ordering,assertion,alternative,example,theory,imports,
                 narrative,tableofcontents,authorindex,content,pcontext,pc,
                 map,separator,operator,lbrack,rbrack,
                 OMS,OMV,OMI,OMB,OMSTR,OMF,OMA,OMBIND,OMBVAR,OME,OMATTR,OMATP,OMR,OMOBJ,OMFOREIGN,
                 dc:contributor,dc:creator,dc:title,dc:subject,dc:description,dc:publisher,dc:type,
                 dc:format,dc:source,dc:language,dc:relation,dc:rights,dc:date,dc:identifier,
                cc:license,cc:permissions,cc:prohibitions,cc:requirements},
   sensitive=true}
\lstdefinelanguage[1.3]{OMDoc}[1.2]{OMDoc}%
{morekeywords={meta,link,resource,notation,prototype,expr,rendering,render}}

\lstdefinelanguage[1.6]{OMDoc}[]{XML}%
  {morekeywords={omdoc,catalogue,loc,ignore,with,ref,omgroup,adt,sortdef,insort,constructor,
                 recognizer,argument,destructor,omlet,private,code,input,output,effect,data,
                 metadata,extradata,proof,proofobject,metacomment,derive,conclude,hypothesis,
                 method,premise,presentation,use,omstyle,xslt,style,element,attribute,text,
                 value-of,recurse,exercise,hint,solution,mc,choice,answer,CMP,p,omtext,term,phrase,object,
                 commonname,type,FMP,assumption,conclusion,symbol,axiom,definition,requation,pattern,
                 value,measure,ordering,assertion,alternative,example,theory,imports,
                 narrative,tableofcontents,authorindex,content,pcontext,pc,
                 map,separator,operator,lbrack,rbrack,
                 OMS,OMV,OMI,OMB,OMSTR,OMF,OMA,OMBIND,OMBVAR,OME,OMATTR,OMATP,OMOBJ,OMFOREIGN,
                 om:OMS,om:OMV,om:OMI,om:OMB,om:OMSTR,om:OMF,om:OMA,om:OMBIND,om:OMBVAR,
                 om:OME,om:OMATTR,om:OMATP,om:OMFOREIGN,
                 dc:contributor,dc:creator,dc:title,dc:subject,dc:description,dc:publisher,dc:type,
                 dc:format,dc:source,dc:language,dc:relation,dc:rights,dc:date,dc:identifier,
                 cc:license,cc:permissions,cc:prohibitions,cc:requirements,
                 % now the new stuff
                 link,meta,resource,
                 view,structure,maps,metamorphism,constant,conass,
                 notation,prototype,expr,rendering,render},
   sensitive=true}

\lstdefinelanguage{XMLSchema}[]{XML}{keywordsprefix={xs:},sensitive=true}

\lstdefinelanguage{sTeX}[LaTeX]{TeX}
  {morekeywords={module,importmodule,importOMDocmodule,metalanguage,
      symdef,defpath,keydef,
     assertion,axiom,definition,omtext,definiendum}}

\lstdefinestyle{inline}{basicstyle=\normalsize}
\lstset{language=[1.2]OMDoc,basicstyle=\scriptsize,showstringspaces=false}

% LocalWords:  morekeywords ATTLIST IDREF IDREFS NMTOKEN NMTOKENS NDATA PCDATA
% LocalWords:  alsoother alsoletter showstringspaces RNC notallowed XSLT xsl ci
% LocalWords:  DublinCore OMV OMI OMSTR OMF OMA OMBIND OMBVAR OME OMATTR OMATP
% LocalWords:  omCD CDName CDURL CDReviewDate CDStatus CDVersion CDRevision eq
% LocalWords:  CDUses CDDefinition forall bvar mrow codeml cpg cpb cpo cpi cpbr
% LocalWords:  cptype cpt cpc cpstyle ccv ccb ccsym ccdef pcode rawcode xlink
% LocalWords:  lang cd omdoc loc omgroup adt sortdef insort destructor omlet mc
% LocalWords:  metadata extradata proofobject metacomment omstyle xslt recurse
% LocalWords:  omtext commonname requation XMLSchema keywordsprefix xs xslt sty
% LocalWords:  basicstyle DTD OpenMath OMS OMB OMOBJ CMP FMP MathML mo mi xml
% LocalWords:  cpd xref href catalogue ref inline namespace tableofcontents pc
% LocalWords:  authorindex pcontext lbrack rbrack mn cn sep csymbol lowlimit lt
% LocalWords:  domainofapplication uplimit ident gcd lcm arg csc sinh tanh sech
% LocalWords:  csch coth arcsin arccos arctan arccosh arccot arccoth arccsc neq
% LocalWords:  arccsch arcsec arcsech arcsinh arctanh geq leq factorof notin ln
% LocalWords:  partialdiff laplacian prsubset notsubset notprsubset setdiff fn
% LocalWords:  cartesianproduct tendsto sdev momentabout matrixrow outerproduct
% LocalWords:  vectorproduct scalarproduct naturalnumbers exponentiale emptyset
% LocalWords:  imaginaryi notanumber eulergamma reln conass expr maction gt exp
% LocalWords:  lstdefinelanguage approx OMFOREIGN importOMDocmodule symdef def
% LocalWords:  defpath keydef indextt tt mylstref lst mylstsref mylstlref
% LocalWords:  lstdefinestyle normalsize lstinline ttfamily snippetin lstset
% LocalWords:  scriptsize
