Katex fails to render fractions in conjunction with macro definitions
Summary
Katex math blocks are rendered with There was an error rendering this math block when using macro definitions in conjunction with \frac and \over.
This issue appears to affect markdown files in projects, and to affect comments/issues/wiki pages too. It also affects all the different styles of macro definition, including \def, \gdef, and \newcommand are affected by this issue.
Demo
With macros, without \frac:
\def\code#1{\texttt{#1}}
\def\eenv{\varepsilon} % empty type environment
\def\hastype#1#2#3{#1 \vdash #2 : #3} % type judgement
\hastype{\eenv}{\code{8}}{\code{int}}
Without macros, with \frac:
\frac{}{\varepsilon \vdash \texttt{8} : \texttt{int}}
With macros, with \frac:
\def\code#1{\texttt{#1}}
\def\eenv{\varepsilon} % empty type environment
\def\hastype#1#2#3{#1 \vdash #2 : #3} % type judgement
\frac{}{\hastype{\eenv}{\code{8}}{\code{int}}}
View Source
```math
\def\code#1{\texttt{#1}}
\def\eenv{\varepsilon} % empty type environment
\def\hastype#1#2#3{#1 \vdash #2 : #3} % type judgement
\hastype{\eenv}{\code{8}}{\code{int}}
```
Without macros, with `\frac`:
```math
\frac{}{\varepsilon \vdash \texttt{8} : \texttt{int}}
```
With macros, with `\frac`:
```math
\def\code#1{\texttt{#1}}
\def\eenv{\varepsilon} % empty type environment
\def\hastype#1#2#3{#1 \vdash #2 : #3} % type judgement
\frac{}{\hastype{\eenv}{\code{8}}{\code{int}}}
```
Steps to reproduce
- Create a new snippet
- Paste the given markdown source
- Click Preview
- See bug
What is the current bug behavior?
Katex blocks that use both fractions and macro definitions render with There was an error rendering this math block.
What is the expected correct behavior?
Katex blocks that use both fractions and macro definitions should render as expected. katex.org shows what the proper output should look like:
Edited by MyriaCore

