10
0
mirror of https://github.com/LCPQ/QUESTDB_website.git synced 2024-12-25 13:53:48 +01:00

Print error message when Latex cannot be parsed for state

This commit is contained in:
Mickaël Véril 2020-02-05 20:03:51 +01:00
parent 96428182c3
commit 9bc755fed5

View File

@ -44,7 +44,12 @@ class dataFileBase(object):
math=TexState.find("$") math=TexState.find("$")
lst=list(math.contents) lst=list(math.contents)
mystr=str(lst[0]) mystr=str(lst[0])
mathsoup=None
try:
mathsoup=TexSoup(mystr) mathsoup=TexSoup(mystr)
except:
print(f"Error when parsing latex state: {mystr}")
exit(-1)
newCommand.runAll(mathsoup,commands) newCommand.runAll(mathsoup,commands)
st=str(mathsoup) st=str(mathsoup)
m=re.match(r"^\^(?P<multiplicity>\d)(?P<symm>[^\s\[(]*)\s*(?:\[(?:\\mathrm{)?(?P<special>\w)(?:})\])?\s*(:?\((?P<type>[^\)]*)\))?",st) m=re.match(r"^\^(?P<multiplicity>\d)(?P<symm>[^\s\[(]*)\s*(?:\[(?:\\mathrm{)?(?P<special>\w)(?:})\])?\s*(:?\((?P<type>[^\)]*)\))?",st)