Published 2020-08-15T20:50:00.001Z by Physics Derivation Graph
I'm assuming there's an interactive feedback loop with the user in the Physics Derivation Graph, whereas that's not the case for bulk content like arXiv. How to respond to ambiguity depends on whether we can assume the user is available for clarifications.
Given an input string to parse,
Is the string valid Latex? If yes, continue; if no, return to user with complaint
Is the string valid mathematical Latex? If yes, continue; if no, return to user with complaint
Can the mathematical Latex be parsed without ambiguity? If yes, return SymPy to user; if no, continue
If there is ambiguity, can the ambiguity be resolved by used a different flavor of the grammar? If no, return the options to the user so they can select the right parsing.
Removing markup specific to display may be relevant. For example, replacing "\ " with " " and replacing "\quad" with " " and replacing "\qquad" with " " and replacing "\left(" with "(" would reduce the parser workload.