-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlge.py
30 lines (24 loc) · 933 Bytes
/
lge.py
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
# Creates a full Latex Glossary Entry (LGE) code by the arguments
import sys
import pyperclip
# Check arguments
if len(sys.argv) != 4:
print("\nThree string arguments are required!\nFirst the words, second their abbreviation, and third their description but without the words and their abbreviation at the start.\n")
sys.exit()
# Create string
abbrv = sys.argv[2].upper()
index = abbrv + "G"
first = sys.argv[1] + " " + "(" + abbrv + ") "
entry = "\\newglossaryentry{" + index + "}{\n" \
" name={" + abbrv + "},\n" \
" description={" + first + sys.argv[3] + "}\n" \
"}\n" \
"\\newglossaryentry{" + abbrv + "}{\n" \
" type=\\acronymtype,\n" \
" name={" + abbrv + "},\n" \
" description={" + sys.argv[1] + "},\n" \
" first={" + first + "\\glsadd{" + index + "}},\n" \
" see=[Glossary:]{" + index + "}\n" \
"}"
pyperclip.copy(entry)
print("\n" + entry + "\n")