-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpython.tex
More file actions
77 lines (75 loc) · 3.96 KB
/
python.tex
File metadata and controls
77 lines (75 loc) · 3.96 KB
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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% ~ Arduino Language - Arduino IDE Colors ~ %%%
%%% %%%
%%% YidongQIN | 06/20/2019 | No Licence given %%%
%%% https://gist.github.com/YidongQIN/a10dd4f72381362aff4257e7a5541d86 %%%
%%% -------------------------------------------------------------------------- %%%
%%% %%%
%%% Place this file in your working directory (next to the latex file you're %%%
%%% working on). To add it to your project, place: %%%
%%% \input{pythonCodeHighLighting.tex} %%%
%%% somewhere before \begin{document} in your latex file. %%%
%%% %%%
%%% In your document, place your arduino code between: %%%
%%% \begin{lstlisting}[language=Arduino] %%%
%%% and: %%%
%%% \end{lstlisting} %%%
%%% %%%
%%% Or create your own style to add non-built-in functions and variables. %%%
%%% %%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% color def
\usepackage{color}
\definecolor{darkred}{rgb}{0.6,0.0,0.0}
\definecolor{darkgreen}{rgb}{0,0.50,0}
\definecolor{lightblue}{rgb}{0.0,0.42,0.91}
\definecolor{orange}{rgb}{0.99,0.48,0.13}
\definecolor{grass}{rgb}{0.18,0.80,0.18}
\definecolor{pink}{rgb}{0.97,0.15,0.45}
% listings
%\usepackage{listings}
% General Setting of listings
\lstset{
aboveskip=1em,
breaklines=true,
abovecaptionskip=-6pt,
captionpos=b,
escapeinside={\%*}{*)},
frame=single,
numbers=left,
numbersep=15pt,
numberstyle=\tiny,
}
% 0. Basic Color Theme
\lstdefinestyle{colored}{ %
basicstyle=\ttfamily,
backgroundcolor=\color{white},
commentstyle=\color{green}\itshape,
keywordstyle=\color{blue}\bfseries\itshape,
stringstyle=\color{red},
}
% 1. General Python Keywords List
\lstdefinelanguage{PythonPlus}[]{Python}{
morekeywords=[1]{,as,assert,nonlocal,with,yield,self,True,False,None,} % Python builtin
morekeywords=[2]{,__init__,__add__,__mul__,__div__,__sub__,__call__,__getitem__,__setitem__,__eq__,__ne__,__nonzero__,__rmul__,__radd__,__repr__,__str__,__get__,__truediv__,__pow__,__name__,__future__,__all__,}, % magic methods
morekeywords=[3]{,object,type,isinstance,copy,deepcopy,zip,enumerate,reversed,list,set,len,dict,tuple,range,xrange,append,execfile,real,imag,reduce,str,repr,}, % common functions
morekeywords=[4]{,Exception,NameError,IndexError,SyntaxError,TypeError,ValueError,OverflowError,ZeroDivisionError,}, % errors
morekeywords=[5]{,ode,fsolve,sqrt,exp,sin,cos,arctan,arctan2,arccos,pi, array,norm,solve,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,}, % numpy / math
}
% 2. New Language based on Python
\lstdefinelanguage{PyBrIM}[]{PythonPlus}{
emph={d,E,a,Fc28,Fy,Fu,D,des,supplier,Material,Rectangle,PyElmt},
}
% 3. Extended theme
\lstdefinestyle{colorEX}{
basicstyle=\ttfamily,
backgroundcolor=\color{white},
commentstyle=\color{darkgreen}\slshape,
keywordstyle=\color{blue}\bfseries\itshape,
keywordstyle=[2]\color{blue}\bfseries,
keywordstyle=[3]\color{grass},
keywordstyle=[4]\color{red},
keywordstyle=[5]\color{orange},
stringstyle=\color{darkred},
emphstyle=\color{pink}\underbar,
}