I am trying to represent a basic vector, the following code works in Visual Studio Code.
I am using the following line $begin{bmatrix}X\Yend{bmatrix}$
All whitespace removed. It should look like this,
https://i.stack.imgur.com/kDxdg.png
However, when pushed to Github it does not render correctly and instead just renders to entire text letter for letter like it is unsupported. Does anybody know how to get get the following vector to display correctly?
3
Answers
The GitHub implementation of MathJax has a number of problems, and it does not seem to want to process some commands in in-line mode. In particular arrays and matrices don’t seem to be processed in in-line math on GitHub. I could not find a work-around that would process your expression, however, an alternative for this matrix would be to use
$left[Xatop Yright]$
instead. A bit more awkward, but perhaps that will be sufficient for your needs. I do wish GitHub would improve their processing of math.One solution is to use the code block highlighting like so,
You can see how this looks in a gist I created below.
Resources
The GitHub/MathJax implementation seems to be lacking. I couldn’t get column vectors or matrices to render correctly unless I added whitespace and split rows over multiple lines.
I think using the
\
as an instruction to move onto the next row followed byend
to finish the matrix confuses MathJax when it attempts to render the matrix, with the whitespace it seems to render correctly on GitHub.Row Vector Example:
This seems to work without whitespace.
Column Vector Example:
If all whitespace is removed, this doesn’t render…
Matrix Example:
If all whitespace is removed, this doesn’t render…