Skip to content

Commit

Permalink
Consistent use of comments between arguments to \lstdefinelanguage
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikt-ma committed Oct 6, 2020
1 parent b28a00f commit a8f3b96
Showing 1 changed file with 28 additions and 28 deletions.
56 changes: 28 additions & 28 deletions preamble.tex
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,10 @@
% Note that Integer is both a predefined type and a function; we cannot treat them differently.
% Another solution would be to remove this completely.
\lstdefinelanguage{modelica}{% Language for use with the lstlisting environment.
basicstyle=\upshape\small\ttfamily, % Font size for displayed code listings.
alsoletter={...},%
%otherkeywords={-, =, +, [, ], (, ), \{, \}, :, *, !},%
morekeywords=[1]{},% blue Keywords
basicstyle=\upshape\small\ttfamily, % Font size for displayed code listings.
alsoletter={...},
% otherkeywords={-, =, +, [, ], (, ), \{, \}, :, *, !},%
morekeywords=[1]{}, % blue Keywords
morekeywords=[2]{% blue + bold keywords
annotation,assert,block,break,class,connector,constant,constrainedby,discrete,%
each,encapsulated,else,elseif,elsewhen,end,exit,expandable,extends,external,final,flow,for,%
Expand All @@ -202,7 +202,7 @@
Real,Integer,Boolean,String},%
comment=[l]{//}, % comment lines
morecomment=[s]{/*}{*/}, % comment blocs
morestring=[b]{'}, %
morestring=[b]{'},
morestring=[b]{"},
}[keywords,comments,strings]

Expand Down Expand Up @@ -242,15 +242,15 @@
stringstyle=\color{black}, % string literal style
language=[short]modelica, % Language that will be used by default, in particluar by plain \lstinline.
showstringspaces=false,
frame=lrtb, %
xleftmargin=\fboxsep, %
xrightmargin=-\fboxsep, %
belowskip=0pt, %
frame=lrtb,
xleftmargin=\fboxsep,
xrightmargin=-\fboxsep,
belowskip=0pt,
}

% Duplicate this definition here to avoid issue - and name it "fortran77" to avoid problem in LatexML
\lstdefinelanguage{fortran77}{%
basicstyle=\upshape\small\ttfamily, % size of fonts used for the code
basicstyle=\upshape\small\ttfamily, % size of fonts used for the code
morekeywords={%
ASSIGN,BACKSPACE,CALL,CHARACTER,%
CLOSE,COMMON,COMPLEX,CONTINUE,DATA,DIMENSION,DO,DOUBLE,%
Expand All @@ -259,41 +259,41 @@
INQUIRE,INTEGER,INTRINSIC,LOGICAL,%
OPEN,PARAMETER,PAUSE,PRECISION,PRINT,PROGRAM,READ,REAL,%
RETURN,REWIND,STOP,SUBROUTINE,THEN,%
WRITE,SAVE},%
WRITE,SAVE},
morekeywords=[2]{%
ACCESS,BLANK,BLOCK,DIRECT,EOF,ERR,EXIST,%
FMT,FORM,FORMATTED,IOSTAT,NAMED,NEXTREC,NUMBER,OPENED,%
REC,RECL,SEQUENTIAL,STATUS,TYPE,UNFORMATTED,UNIT},%
REC,RECL,SEQUENTIAL,STATUS,TYPE,UNFORMATTED,UNIT},
morekeywords=[3]{%
INT,DBLE,CMPLX,ICHAR,CHAR,AINT,ANINT,% left out real
NINT,ABS,MOD,SIGN,DIM,DPROD,MAX,MIN,AIMAG,CONJG,SQRT,EXP,LOG,%
LOG10,SIN,COS,TAN,ASIN,ACOS,ATAN,ATAN2,SINH,COSH,TANH,LGE,LLE,LLT,%
LEN,INDEX},%
LEN,INDEX},
morekeywords=[4]{AND,EQ,EQV,FALSE,GE,GT,OR,LE,LT,NE,NEQV,NOT,TRUE},%
sensitive=f,%% not Fortran-77 standard, but allowed in Fortran-95 %%
morecomment=[f]*,%
morecomment=[f]C,%
morecomment=[f]c,%
morestring=[d]",%% not Fortran-77 standard, but allowed in Fortran-95 %%
morestring=[d]'%
sensitive=f, % not Fortran-77 standard, but allowed in Fortran-95 %%
morecomment=[f]*,
morecomment=[f]C,
morecomment=[f]c,
morestring=[d]", % not Fortran-77 standard, but allowed in Fortran-95 %%
morestring=[d]'
}[keywords,comments,strings]

\lstdefinelanguage{C}{%
basicstyle=\upshape\small\ttfamily, % size of fonts used for the code
basicstyle=\upshape\small\ttfamily, % size of fonts used for the code
morekeywords={%
auto,break,case,char,const,continue,default,do,double,%
else,enum,extern,float,for,goto,if,int,long,register,return,%
short,signed,sizeof,static,struct,switch,typedef,union,unsigned,%
void,volatile,while},%
sensitive,%
morecomment=[s]{/*}{*/},%
morecomment=[l]//,% nonstandard
morestring=[b]",%
morestring=[b]',%
moredelim=*[directive]\#,%
void,volatile,while},
sensitive,
morecomment=[s]{/*}{*/},
morecomment=[l]//, % nonstandard
morestring=[b]",
morestring=[b]',
moredelim=*[directive]\#,
moredirectives={%
define,elif,else,endif,error,if,ifdef,ifndef,line,%
include,pragma,undef,warning}%
include,pragma,undef,warning}
}[keywords,comments,strings,directives]

% Note: \lstinline!...! used for inline Modelica using [short]modelica
Expand Down

0 comments on commit a8f3b96

Please sign in to comment.