Last active
March 21, 2018 19:30
-
-
Save tesu/2af2e4cfa7987e5b0b41b27206840436 to your computer and use it in GitHub Desktop.
katex for facebook messenger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import sys | |
if len(sys.argv) < 2: | |
l = 'sample text' | |
else: | |
l = " ".join(sys.argv[1:]) | |
colors = ['#ff0000', | |
'#ff7f00', | |
'#ffff00', | |
'#00ff00', | |
'#0000ff', | |
'#4b0082', | |
'#9400d3'] | |
print('$$', end='', sep='') | |
for i in range(len(l)): | |
if l[i].isspace(): | |
print('\\text{',l[i],'}', end='', sep='') | |
else: | |
print('\color{',colors[i%len(colors)],'}\\text{',l[i],'}', end='', sep='') | |
print('$$') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment