Katex: Cannot render expression for Meijer G-function

Created on 13 Sep 2016  Â·  3Comments  Â·  Source: KaTeX/KaTeX

This LaTeX:

        G_{p,q}^{m,n} \left(\begin{matrix}a_1, \dots, a_n & a_{n+1}, \dots, a_p \\
                                        b_1, \dots, b_m & b_{m+1}, \dots, b_q
                          \end{matrix} \middle| z \right).

does not render at https://khan.github.io/KaTeX/. It works fine in MathJax and regular LaTeX.

The error in the console is

katex.min.js:1 Uncaught Error: KaTeX parse error: Expected & or \\ or \end at position 53: in{matrix}a_1, ̲\dots, a_n & a(…)

However, I can't figure out how to reduce it to an expression that works. It seems it does not like the matrix (I don't know why). If I put the matrix by itself it still fails. Additionally, it doesn't support \middle (even \left(x \middle | y \right) fails with katex.min.js:1 Uncaught Error: KaTeX parse error: Expected '\right', got '\middle' at position 29: \left(x \middle̲ | y \right)}(…)).

Most helpful comment

Also, it's funny, 5 years ago I reported \middle not working to MathJax, and they gave a similar response.

All 3 comments

Looks like there's two issues, which can both be worked around for now:

  • We don't support \dots: it depends on observing the environment that it's in, so it's non-trivial to implement correctly. This can be replaced with \ldots, since that's what \dots would turn into in this case.
  • We don't support \middle: I didn't even know that \middle existed! You can approximate it by doing something like \bigg| or \Big| in your case.

So, with those two things fixed,

  G_{p,q}^{m,n} \left(\begin{matrix}a_1, \ldots, a_n & a_{n+1}, \ldots, a_p \\
                                        b_1, \ldots, b_m & b_{m+1}, \ldots, b_q
                          \end{matrix} \bigg| z \right).

ends up rendering fine. :)

image

Hopefully this is helpful! I'll file some issues for the missing features.

I didn't notice it was using \dots instead of \ldots. Perhaps there should be a third issue about the error message. If I replace \dots with a fake command, like \dts, LaTeX gives me this message:

! Undefined control sequence.
l.131 ...{p,q}^{m,n} \left(\begin{matrix}a_1, \dts
                                                  , a_n & a_{n+1}, \dots, a_...
!  ==> Fatal error occurred, no output PDF file produced!

And MathJax renders the whole equation with a red \dts. The KaTeX error message doesn't indicate what went wrong.

At any rate, \dots doesn't sound like something you should ever use.

Also, it's funny, 5 years ago I reported \middle not working to MathJax, and they gave a similar response.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sophiebits picture sophiebits  Â·  3Comments

pvnr0082t picture pvnr0082t  Â·  4Comments

HughGrovesArup picture HughGrovesArup  Â·  4Comments

hagenw picture hagenw  Â·  3Comments

fabiospampinato picture fabiospampinato  Â·  4Comments