Fix handing of unbalanced braces in TeX input cause by #1960 (closed) in 2.7.4.
Resolves #2036 (closed).