# How to typeset a matrix with MathJax?

I need to typeset a matrix with square brackets as delimiters for math.se (I believe they use MathJaX). How would I do that?

• $\begin{bmatrix}a\\b\end{bmatrix}$ works – egreg Feb 4 '12 at 23:22
• @egreg How would I put multiple values in the same row? – Bob Feb 4 '12 at 23:28
• $\begin{bmatrix}a & b\\c & d\end{bmatrix}$, just like LaTeX with amsmath – egreg Feb 4 '12 at 23:44
• You can also find a suitable example and see its source code by clicking edit. Here is an old example that I found at a quick glance to my answers while I was active in there and has many matrices in it. – percusse Feb 5 '12 at 2:09
• You can also right click on an equation, Show Math As → TeX commands. – kennytm Feb 5 '12 at 7:57

MathJax seems to accept the standard amsmath syntax

$\begin{bmatrix}a & b\\c & d\end{bmatrix}$


Rows are terminated with \\ and columns are separated by &

• The Chapter 4.1 matrices of amsmath explains the options for matrices. There is also smallmatrix enviroment which allows to use the matrices inline with text $\begin{bmatrix}a & b\\c & d\end{bmatrix}$ – ecerulm Sep 22 '16 at 8:13

MathJax comes with a configuration file that includes all the most general of the pre-defined configurations. It loads all the important MathJax components, including the TeX and MathML preprocessors and input processors, the AMSmath, AMSsymbols etc. So what you do you write in a similar fashion to a normal TeX file.

  $\begin{matrix} a & b \\ c & d \end{matrix}$


Whenever you get stuck do a search on wikipedia and view the equation in the editor tab. Most of the wiki mark-up will work straight with MathJax.

The curved brace matrix in Mathjax is:

$$\begin{pmatrix}a & b\\\ c & d\end{pmatrix}$$


Note: I used the wrapper \color{#C00}{ <code goes here> } to format it in this dark red color :)