2

Youtrack and many other web apps use KaTeX to render mathematical notation and markdown for all other things.

However markdown parser treats certain characters in a special way and interferes with KaTeX.

For example the following equation

\begin{equation}
X_i = \begin{cases}
0, t_i < t_{i-1} \\
1, (t_i - t_{i-1}) > t_0 \\
X_{i-1}, otherwise
\end{cases}
\end{equation}

Would render incorrectly as

incorrect rendering

Note the missing line.

The reason is that < and > and the text between are treated as an HTML tag and thus ignored.

The intended rendering would instead look like

correct rendering

Reordering the cases resolves the issue as well as replacing < with \leq and > with \geq. But both solutions seem incomplete and in the latter case change the meaning of the equation.

In LaTeX there are no predefined commands for < and > and KaTeX currently does not support \newcommand yet.

Dima Chubarov
  • 16,199
  • 6
  • 40
  • 76

1 Answers1

2

I have posted a similar question on tex stackexchange. And while it was closed there as off-topic, users provided a solution in comments. Using \lt for < and \gt for > is supported in KaTeX. So the equation should be typed as

\begin{equation}
X_i = \begin{cases}
0, t_i \lt t_{i-1} \\
1, (t_i - t_{i-1}) \gt t_0 \\
X_{i-1}, otherwise
\end{cases}
\end{equation}
Dima Chubarov
  • 16,199
  • 6
  • 40
  • 76