Note: This is effectively a cross post of this post from Mathematics Meta SE.

There are many posts on LaTeX SE about how to add labels to rows/columns of a matrix, e.g. Label rows of a matrix by characters, but all the proposed approaches need some third-party packages unavailable in MathJax (see here for the list of available packages).

The closest thing I have found that uses MathJax is this answer:

 & & \textit{next state}\\
 & & \begin{array}{ccc} 1 & \quad 2 \quad & 3 \end{array}\\
\textit{current state} & \begin{array}{c} 1\\ 2\\ 3\end{array} &
    1/2 & 0 & 1/2\\
    0 & 1/2 & 1/2\\
    1/4 & 1/4 & 1/2

But the drawback of this approach is that once the terms in the matrix get wider, the labels will be misaligned and need manual adjustment of spacing. I also posted an answer on Math Meta SE that needs the physics package:

\mqty{1 & 2 & 3 & 4 & 4}\\
\mqty[h & e & l & l & o \\
m & s & e & * & * \\
m & e & t & a & *]

However, MSE does not seem to include this package in its global configuration.

Question: Does there exist any method to label rows/columns of a matrix in MathJax that:

  • only uses AMS-related packages available in MathJax,
  • automatically adjust spacing of labels and
  • does not need to define a lot of macros?

Thanks in advance.

  • 1
    It's an old questions with many answers, so maybe one will work with MathJaX.. Apr 27 '20 at 14:28
  • 3
    mathjax is off-topic here. Apr 27 '20 at 14:30
  • @UlrikeFischer I didn't know that and why this mathjax exists then? Do you know where this is on-topic? Thanks.
    – Saad
    Apr 27 '20 at 14:32
  • 2
    Note your wording "However, MSE does not seem to include this package in its global configuration" implies that including latex packages into mathjax is an option in general but it is not, mathjax doesn't use tex at all, some javascript emulates some latex packages but any such emulation has to be written from scratch in javascript, it can't use the package code. Apr 27 '20 at 15:17
  • 1
    @Saad it's more of a close reason than an answer I think, your actual question might be better asked on the mathjax tag on the main stackoverflow site (the mathjax developers follow that) Apr 28 '20 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.