6
6
%
7
7
\def\@lstbasicstyle {\small\color {listing-text-color}\linespread {1.0}\lst@ifdisplaystyle\small \fi \ttfamily {}}%
8
8
%
9
- \lstdefinestyle {python_style}{%
10
- %
9
+ \lstdefinestyle {basic_style}{%
11
10
backgroundcolor=\color {listing-background},%
12
11
numbers=left,%
13
12
frame=single,%
14
13
rulecolor=\color {listing-rule},%
15
14
frameround=ffff,%
16
- %
17
15
breaklines=true,%
18
16
tabsize=4,%
19
- %
20
- language=Python,%
21
17
sensitive=true,%
22
- %
23
18
basicstyle=\@lstbasicstyle ,%
24
19
identifierstyle=\color {listing-identifier},%
25
20
numberstyle=\color {listing-line-numbers},%
26
- %
27
- otherkeywords={\% ,\} ,\{ ,\& ,\| },%
28
21
keywordstyle=\color {listing-keyword-1}\bfseries ,%
29
- %
30
- emph={and,break,class,continue,def,yield,del,elif,else,except,exec,finally,for,from,global,if,import,in,lambda,not,or,pass,print,raise,return,try,while,assert,with},%
31
22
emphstyle=\color {listing-emph-1}\bfseries ,%
32
- %
33
- emph={[2]True,False,None},%
34
23
emphstyle=[2]\color {listing-emph-2},%
35
- %
36
- emph={[3]object,type,isinstance,deepcopy,zip,enumerate,reversed,list,set,len,dict,tuple,xrange,append,execfile,real,imag,reduce,str,repr},%
37
24
emphstyle=[3]\color {listing-emph-3},%
38
- %
39
- emph={[4]Exception,NameError,IndexError,SyntaxError,TypeError,ValueError,OverflowError,ZeroDivisionError},%
40
25
emphstyle=[4]\color {listing-emph-4}\bfseries ,%
41
- %
42
- emph={[5]ode,fsolve,sqrt,exp,sin,cos,arctan,arctan2,arccos,pi,array,norm,dot,arange,isscalar,max,sum,flatten,shape,reshape,find,any,all,abs,plot,linspace,legend,quad,polyval,polyfit,hstack,concatenate,vstack,column_stack,empty,zeros,ones,rand,vander,grid,pcolor,eig,eigs,eigvals,svd,qr,tan,det,logspace,roll,min,mean,cumsum,cumprod,diff,vectorize,lstsq,cla,eye,xlabel,ylabel,squeeze},%
43
26
emphstyle=[5]\color {listing-emph-5},%
44
- %
45
- emph={[6]__init__,__add__,__mul__,__div__,__sub__,__call__,__getitem__,__setitem__,__eq__,__ne__,__new__,__nonzero__,__rmul__,__radd__,__repr__,__str__,__get__,__truediv__,__pow__,__name__,__future__,__all__},%
46
27
emphstyle=[6]\color {listing-emph-6},%
47
- %
48
- emph={[7]assert,yield},%
49
28
emphstyle=[7]\color {listing-emph-7}\bfseries ,%
50
- %
51
- emph={[8]range},%
52
29
emphstyle={[8]\color {listing-emph-8}\bfseries },%
53
- %
54
30
keywordstyle={[2]\color {listing-keyword-2}\bfseries },%
55
31
keywordstyle={[3]\color {listing-keyword-3}\bfseries\itshape },%
56
- %
57
32
commentstyle=\itshape\color {listing-comment},%
58
- %
59
33
stringstyle=\color {listing-string},%
60
34
showstringspaces=false,%
61
- morestring=[s]{"""}{""" },%
35
+ postbreak= \mbox { \textcolor {red}{ $ \hookrightarrow $ } \space },%
62
36
%
63
37
literate=%
64
38
{á}{{\' a}}1 {é}{{\' e}}1 {í}{{\' i}}1 {ó}{{\' o}}1 {ú}{{\' u}}1%
@@ -76,25 +50,28 @@ literate=%
76
50
{…}{{\ldots }}1 {≥}{{>=}}1 {≤}{{<=}}1 {„}{{\glqq }}1 {“}{{\grqq }}1%
77
51
{”}{{''}}1 {π}{{$ \pi $ }}1%
78
52
}%
53
+ %
54
+ \lstdefinestyle {python_style}{%
55
+ style=basic_style,%
56
+ language=Python,%
57
+ otherkeywords={\% ,\} ,\{ ,\& ,\| },%
58
+ emph={and,break,class,continue,def,yield,del,elif,else,except,exec,finally,for,from,global,if,import,in,lambda,not,or,pass,print,raise,return,try,while,assert,with},%
59
+ emph={[2]True,False,None},%
60
+ emph={[3]object,type,isinstance,deepcopy,zip,enumerate,reversed,list,set,len,dict,tuple,xrange,append,execfile,real,imag,reduce,str,repr},%
61
+ emph={[4]Exception,NameError,IndexError,SyntaxError,TypeError,ValueError,OverflowError,ZeroDivisionError},%
62
+ emph={[5]ode,fsolve,sqrt,exp,sin,cos,arctan,arctan2,arccos,pi,array,norm,dot,arange,isscalar,max,sum,flatten,shape,reshape,find,any,all,abs,plot,linspace,legend,quad,polyval,polyfit,hstack,concatenate,vstack,column_stack,empty,zeros,ones,rand,vander,grid,pcolor,eig,eigs,eigvals,svd,qr,tan,det,logspace,roll,min,mean,cumsum,cumprod,diff,vectorize,lstsq,cla,eye,xlabel,ylabel,squeeze},%
63
+ emph={[6]__init__,__add__,__mul__,__div__,__sub__,__call__,__getitem__,__setitem__,__eq__,__ne__,__new__,__nonzero__,__rmul__,__radd__,__repr__,__str__,__get__,__truediv__,__pow__,__name__,__future__,__all__},%
64
+ emph={[7]assert,yield},%
65
+ emph={[8]range},%
66
+ morestring=[s]{"""}{"""},%
67
+ }%
79
68
\lstset {style=python_style}%
80
69
%
81
70
%
82
71
\lstdefinestyle {text_style}{%
83
- %
84
- backgroundcolor=\color {listing-background},%
85
- numbers=left,%
86
- frame=single,%
87
- rulecolor=\color {listing-rule},%
88
- frameround=ffff,%
89
- %
90
- breaklines=true,%
91
- tabsize=4,%
92
- %
72
+ style=basic_style,%
93
73
language={},%
94
- sensitive=true,%
95
- %
96
74
basicstyle=\@lstbasicstyle ,%
97
- numberstyle=\color {listing-line-numbers},%
98
75
identifierstyle=\@lstbasicstyle ,%
99
76
keywords={},%
100
77
otherkeywords={},%
@@ -122,27 +99,15 @@ emph={[7]},%
122
99
emphstyle={[7]\@lstbasicstyle },%
123
100
emph={[8]},%
124
101
emphstyle={[8]\@lstbasicstyle },%
125
- breaklines=true,%
126
- postbreak=\mbox {\textcolor {red}{$ \hookrightarrow $ }\space },%
127
- %
128
- literate=%
129
- {á}{{\' a}}1 {é}{{\' e}}1 {í}{{\' i}}1 {ó}{{\' o}}1 {ú}{{\' u}}1%
130
- {Á}{{\' A}}1 {É}{{\' E}}1 {Í}{{\' I}}1 {Ó}{{\' O}}1 {Ú}{{\' U}}1%
131
- {à}{{\` a}}1 {è}{{\' e}}1 {ì}{{\` i}}1 {ò}{{\` o}}1 {ù}{{\` u}}1%
132
- {À}{{\` A}}1 {È}{{\' E}}1 {Ì}{{\` I}}1 {Ò}{{\` O}}1 {Ù}{{\` U}}1%
133
- {ä}{{\" a}}1 {ë}{{\" e}}1 {ï}{{\" i}}1 {ö}{{\" o}}1 {ü}{{\" u}}1%
134
- {Ä}{{\" A}}1 {Ë}{{\" E}}1 {Ï}{{\" I}}1 {Ö}{{\" O}}1 {Ü}{{\" U}}1%
135
- {â}{{\^ a}}1 {ê}{{\^ e}}1 {î}{{\^ i}}1 {ô}{{\^ o}}1 {û}{{\^ u}}1%
136
- {Â}{{\^ A}}1 {Ê}{{\^ E}}1 {Î}{{\^ I}}1 {Ô}{{\^ O}}1 {Û}{{\^ U}}1%
137
- {œ}{{\oe }}1 {Œ}{{\OE }}1 {æ}{{\ae }}1 {Æ}{{\AE }}1 {ß}{{\ss }}1%
138
- {ç}{{\c c}}1 {Ç}{{\c C}}1 {ø}{{\o }}1 {å}{{\r a}}1 {Å}{{\r A}}1%
139
- {€}{{\EUR }}1 {£}{{\pounds }}1 {«}{{\guillemotleft }}1%
140
- {»}{{\guillemotright }}1 {ñ}{{\~ n}}1 {Ñ}{{\~ N}}1 {¿}{{?`}}1%
141
- {…}{{\ldots }}1 {≥}{{>=}}1 {≤}{{<=}}1 {„}{{\glqq }}1 {“}{{\grqq }}1%
142
- {”}{{''}}1 {π}{{$ \pi $ }}1%
102
+ breaklines=true%
143
103
}%
144
104
%
145
105
%
106
+ \lstdefinestyle {bash_style}{%
107
+ style=basic_style,%
108
+ language=bash,%
109
+ }%
110
+ %
146
111
%
147
112
% % the box around the inline listings
148
113
\protected\gdef\inlinelistingbox #1{\bgroup %
@@ -167,7 +132,7 @@ literate=%
167
132
% % #1 the optional args
168
133
% % #2 the code to be printed inline
169
134
\gdef\bashil #1{%
170
- \inlinelistingbox {\lstinline [language=bash ]$#1$}}%
135
+ \inlinelistingbox {\lstinline [style=bash_style ]$#1$}}%
171
136
%
172
137
\newlength\@lstbasicstylesheight %
173
138
\settoheight {\@lstbasicstylesheight }{\mbox {\bgroup\@lstbasicstyle {s}\egroup }}%
@@ -188,9 +153,9 @@ literate=%
188
153
% % #6 the style to use
189
154
\protected\gdef\gitCode #1#2#3#4#5#6{%
190
155
\gitLoad {#1}{#2}{#3}%
191
- \expandafter\expandafter\expandafter\edef\expandafter \csname @pwp@gitUrl:lst:#5 \endcsname {\gitUrl }%
192
- \expandafter\expandafter\expandafter\edef\expandafter \csname @pwp@gitFile:lst:#5 \endcsname {\gitFile }%
193
- \lstinputlisting [float,label={lst:#4}#6,caption={#5~(\href {\csname @pwp@gitUrl:lst:#5 \endcsname}{src})}]{\csname @pwp@gitFile:lst:#5 \endcsname }%
156
+ \expandafter\expandafter\expandafter\edef\expandafter \csname @pwp@gitUrl:lst:#4 \endcsname {\gitUrl }%
157
+ \expandafter\expandafter\expandafter\edef\expandafter \csname @pwp@gitFile:lst:#4 \endcsname {\gitFile }%
158
+ \lstinputlisting [float,label={lst:#4}#6,caption={#5~(\href {\csname @pwp@gitUrl:lst:#4 \endcsname}{src})}]{\csname @pwp@gitFile:lst:#4 \endcsname }%
194
159
}%
195
160
%
196
161
% %
0 commit comments