Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6ff73a1

Browse files
committed
Add script for sort+format dict
1 parent 9ff3e8f commit 6ff73a1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/_mathtext_data.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,18 @@
460460

461461
uni2type1 = {v: k for k, v in type12uni.items()}
462462

463+
# The script below is to sort and format the tex2uni dict
464+
465+
## For decimal values: int(hex(v), 16)
466+
# newtex = {k: hex(v) for k, v in tex2uni.items()}
467+
# sd = dict(sorted(newtex.items(), key=lambda item: item[0]))
468+
#
469+
## For formatting the sorted dictionary with proper spacing
470+
## the value '24' comes from finding the longest string in
471+
## the newtex keys with len(max(newtex, key=len))
472+
# for key in sd:
473+
# print("{0:24} : {1: <s},".format("'" + key + "'", sd[key]))
474+
463475
tex2uni = {
464476
'#' : 0x23,
465477
'$' : 0x24,

0 commit comments

Comments
 (0)