-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_sheet.py
More file actions
33 lines (25 loc) · 977 Bytes
/
make_sheet.py
File metadata and controls
33 lines (25 loc) · 977 Bytes
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
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
def make_sheet( name, cname, u1, u2 ):
u2=u2+1;
f=open(name+".inc","w")
f.write( "\\begin{{tabular}}{{|l|*{{{num}}}{{c|}}}}\n".format(num=u2-u1) )
f.write( "\\hline\n" )
f.write( "&" )
f.write( "&".join("\\textbf{{{i:03X}}}".format(i=i) for i in range(u1,u2)) )
f.write( "\\\\\n")
f.write( "\\hline\n")
for j in range(0x00, 0x10):
f.write( "\\textbf{{{j:1X}}}&\n".format(j=j))
f.write( "&".join( "\\utfchar{{{utf}}}{{{cp:4x}}}"\
.format(cp=0x10*i+j,utf=unichr(0x10*i+j)) \
for i in range(u1,u2)) )
f.write( "\\\\\n" )
f.write( "\\hline\n" )
f.write( "\\end{tabular}\n" )
f.close()
make_sheet( "u0370", "greek", 0x037, 0x03F );
#make_sheet( "u2190", "arrows", 0x219, 0x21F );
make_sheet( "u2190", "arrows", 0x219, 0x21A );
make_sheet( "u2200", "math ops", 0x220, 0x22F );