Remove space between log-like functions and sub/superscripts
Allow escaping curly brackets
Deal with mis-matched brackets