-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathpy2tex.sty
More file actions
128 lines (102 loc) · 3.94 KB
/
py2tex.sty
File metadata and controls
128 lines (102 loc) · 3.94 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
% chktex-file 37
% chktex-file 44
% chktex-file 17
% chktex-file 36
% chktex-file 13
% chktex-file 15
% chktex-file 29
% chktex-file 40
% chktex-file 1
% chktex-file 8
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{py2tex}[09/05/2019 v0.0 Macros for py2tex]
%~~~~~New commands~~~~~%
%For bold sans serif
\newcommand \textbs[1]{\textsf{\textbf{#1}}}
%For large font for Italian keywords decomment the following
%\algrenewcommand\algorithmicprocedure{{\large\textbf{procedura}}}
%\algrenewcommand\algorithmicfunction{{\large \textbf{funzione}}}
%\algrenewcommand\algorithmicif{{\large \textbf{se}}}
%\algrenewcommand\algorithmicthen{{\large \textbf{allora}}}
%\algrenewcommand\algorithmicelse{{\large \textbf{altrimenti}}}
%\algrenewcommand\algorithmicwhile{{\large \textbf{finchè}}}
%\algrenewcommand\algorithmicdo{{\large \textbf{ripeti}}}
%\algrenewcommand\algorithmicend{{\large \textbf{fine}}}
%\algrenewcommand\algorithmicrepeat{{\large \textbf{ripeti}}}
%\algrenewcommand\algorithmicuntil{{\large \textbf{finchè}}}
%For Italian keywords decomment the following
%\algrenewcommand\algorithmicprocedure{{\textbf{procedura}}}
%\algrenewcommand\algorithmicfunction{{\textbf{funzione}}}
%\algrenewcommand\algorithmicif{{\textbf{se}}}
%\algrenewcommand\algorithmicthen{{\textbf{allora}}}
%\algrenewcommand\algorithmicelse{{\textbf{altrimenti}}}
%\algrenewcommand\algorithmicwhile{{\textbf{finchè}}}
%\algrenewcommand\algorithmicdo{{\textbf{ripeti}}}
%\algrenewcommand\algorithmicend{{\textbf{fine}}}
%\algrenewcommand\algorithmicrepeat{{\textbf{ripeti}}}
%\algrenewcommand\algorithmicuntil{{\textbf{finchè}}}
%\algrenewcommand\algorithmicreturn{\State{{\textbf{restituisci}}}}
\algrenewcommand\algorithmicprocedure{{\textbs{procedure}}}
\algrenewcommand\algorithmicfunction{{\textbs{function}}}
\algrenewcommand\algorithmicif{{\textbs{if}}}
\algrenewcommand\algorithmicthen{{\textbs{then}}}
\algrenewcommand\algorithmicelse{{\textbs{else}}}
\algrenewcommand\algorithmicwhile{{\textbs{while}}}
\algrenewcommand\algorithmicdo{{\textbs{do}}}
\algrenewcommand\algorithmicend{{\textbs{end}}}
\algrenewcommand\algorithmicrepeat{{\textbs{do}}}
\algrenewcommand\algorithmicuntil{{\textbs{while}}}
\algrenewcommand\algorithmicreturn{\State{{\textbs{return}}}}
\algblock[Name]{Start}{End}
\algblockdefx[NAME]{START}{END}%
[2][Unknown]{Start #1(#2)}%
{Ending}
\algblockdefx[NAME]{}{OTHEREND}%
[1]{Until (#1)}
%~~~~~Operators~~~~~%
\newcommand{\PyAdd}[0]{+}
\newcommand{\PyAnd}[0]{\textbf{ and }}
\newcommand{\PyAnnotation}[2]{\ensuremath{\textbs{variable }#1\colon \texttt{#2}}}
\newcommand{\PyArg}[1]{\texttt{#1}}
\newcommand{\PyArgAnnotation}[2]{\ensuremath{\texttt{#1} \colon \texttt{#2}}}
\newcommand{\PyArgSep}[0]{,~}
\newcommand{\PyAssign}[2]{\ensuremath{#1 \gets #2}}
\newcommand{\PyAssignSep}[0]{,~}
\newcommand{\PyCall}[2]{
\ifnum\pdfstrcmp{#1}{print}=0
\textbs{output~} { \tt#2}
\else
\textsc{#1}( {\tt#2} )
\fi
}
\newcommand{\PyCallSep}[0]{,~}
\newcommand{\PyDiv}[0]{\mathop{\texttt{/}}}
\newcommand{\PyEq}[0]{=}
\newcommand{\PyExpr}[1]{\ensuremath{#1}}
\newcommand{\PyFalse}[0]{\texttt{false}}
\newcommand{\PyGt}[0]{>}
\newcommand{\PyGtE}[0]{\ge}
%\newcommand{\PyIn}[0]{}
%\newcommand{\PyIs}[0]{}
%\newcommand{\PyIsNot}[0]{}
\newcommand{\PyList}[1]{[#1]}
\newcommand{\PyListSep}[0]{, }
\newcommand{\PyLt}[0]{<}
\newcommand{\PyLtE}[0]{\le}
\newcommand{\PyMod}[0]{\mathop{\textsc{ mod }}}
\newcommand{\PyMult}[0]{\times}
\newcommand{\PyOr}[0]{\textbf{ or }}
\newcommand{\PyName}[1]{\texttt{#1}}
%\newcommand{\PyNone}[0]{\textt{}}
\newcommand{\PyNot}[1]{\textbf{ not }#1}
\newcommand{\PyNotEq}[0]{\neq}
%\newcommand{\PyNotIn}[0]{}
\newcommand{\PyNum}[1]{\texttt{#1}}
\newcommand{\PyPar}[1]{\left ( #1 \right )}
\newcommand{\PyPow}[0]{\texttt{^}}
\newcommand{\PyStr}[1]{\texttt{``#1''}}
\newcommand{\PySub}[0]{-}
\newcommand{\PySubscript}[2]{#1[#2]}
\newcommand{\PyTrue}[0]{\texttt{true}}
\newcommand{\PyUAdd}[1]{+ #1}
\newcommand{\PyUSub}[1]{- #1}