-
Notifications
You must be signed in to change notification settings - Fork 0
/
style.tex
87 lines (79 loc) · 4.24 KB
/
style.tex
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
78
79
80
81
82
83
84
85
86
87
% Copyright 20120 Liutao Tian, MIT License
% https://github.com/andy123t/code-latex-style/
\usepackage{listings,color}
% Matlab highlight color settings
%\definecolor{mBasic}{RGB}{248,248,242} % default
\definecolor{mKeyword}{RGB}{0,0,255} % bule
\definecolor{mString}{RGB}{160,32,240} % purple
\definecolor{mComment}{RGB}{34,139,34} % green
\definecolor{mBackground}{RGB}{245,245,245} % lightgrey
\definecolor{mNumber}{RGB}{134,145,148} % gray
\definecolor{Numberbg}{RGB}{237,240,241} % lightgrey
% Python highlight color settings
%\definecolor{pBasic}{RGB}{248, 248, 242} % default
\definecolor{pKeyword}{RGB}{228,0,128} % magenta
\definecolor{pString}{RGB}{148,0,209} % purple
\definecolor{pComment}{RGB}{117,113,94} % gray
\definecolor{pIdentifier}{RGB}{166, 226, 46} %
\definecolor{pBackground}{RGB}{245,245,245} % lightgrey
\definecolor{pNumber}{RGB}{134,145,148} % gray
\lstnewenvironment{Matlab}[1]{
\lstset{language=Matlab, % choose the language of the code
%frame=tlbr,
xleftmargin=30pt,
xrightmargin=10pt,
frame=l,
framesep=15pt,%framerule=0pt, % sets the frame style
%frame=shadowbox,rulesepcolor=\color{red!20!green!20!blue!20},
basicstyle=\small\ttfamily,
keywordstyle={\color{mKeyword}}, % sets color for keywords
stringstyle={\color{mString}}, % sets color for strings
commentstyle={\color{mComment}}, % sets color for comments
backgroundcolor=\color{mBackground}, % choose the background color
title=#1, % \lstname show the filename of files
keywords={break,case,catch,classdef,continue,else,elseif,end,for,
function,global,if,otherwise,parfor,persistent,return,spmd,switch,try,while},
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
tabsize=4, % sets default tabsize to 2 spaces
captionpos=t, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
framexleftmargin=5pt,
fillcolor=\color{Numberbg},
rulecolor=\color{Numberbg},
numberstyle=\tiny\color{mNumber},
numbersep=9pt, % how far the line-numbers are from the code
numbers=left, % where to put the line-numbers
stepnumber=1, % the step between two line-numbers.
}}{\lstname}
\lstnewenvironment{Python}[1]{
\lstset{language=python, % choose the language of the code
xleftmargin=30pt,
xrightmargin=10pt,
frame=l,
framesep=15pt,%framerule=0pt, % sets the frame style
%frame=shadowbox,rulesepcolor=\color{red!20!green!20!blue!20},
%basicstyle=\small\ttfamily, % sets font style for the code
basicstyle=\footnotesize\fontspec{Consolas},
keywordstyle=\color{pKeyword}, % sets color for keywords
stringstyle=\color{pString}, % sets color for strings
commentstyle=\color{pComment}, % sets color for comments
backgroundcolor=\color{pBackground}, % choose the background color
title=#1, %\lstname show the filename of files
emph={format_string,eff_ana_bf,permute,eff_ana_btr},
emphstyle=\color{pIdentifier}
showspaces=false, % show spaces adding particular underscores
showstringspaces=false, % underline spaces within strings
showtabs=false, % show tabs within strings adding particular underscores
tabsize=4, % sets default tabsize to 2 spaces
captionpos=t, % sets the caption-position to bottom
breaklines=true, % sets automatic line breaking
framexleftmargin=5pt,
fillcolor=\color{Numberbg},
rulecolor=\color{Numberbg},
numberstyle=\tiny\color{pNumber},
numbersep=9pt, % how far the line-numbers are from the code
numbers=left, % where to put the line-numbers
stepnumber=1, % the step between two line-numbers.
}}{}