# merge cells of arrays in math mode

Is there a way to type an array with certain cells merged in math mode on StackExchange?

I tried to use multirow and multicolumn commands within array environment, but apparently MathJax does not support those.

• You may find these threads relevant (esp. links given in comments): Loading LaTeX packages, What latex packages are used this site? – CiaPan Jul 13 '15 at 17:04
• Just for background. MathJax currently lacks such macros because our underlying MathML implementation does not yet support the corresponding column/row-spanning constructs. Once these are done, such macros are easy. – Peter Krautzberger Jul 24 '15 at 20:37

Too few reputation points to edit someone else's post, so I post a follow-up to Américo Tavares answer as my own answer — here's a cell split into rows

$$\begin{array}{c|c} a^2-b^2 & \begin{array}{ccc} 1+i & 1-i & \frac{1}{\sqrt{2}} \end{array} \\\hline \color{green}{\begin{array}{c}a-b \\ a+b \end{array}} & \sqrt {2} \end{array}$$

$$\begin{array}{c|c} a^2-b^2 & \begin{array}{ccc} 1+i & 1-i & \frac{1}{\sqrt{2}} \end{array} \\\hline \color{green}{ \begin{array}{c}a-b \\ a+b \end{array} } & \sqrt {2} \end{array}$$


The real problem is cross-row or cross-column alignment:

$$\begin{array}{c|c} a^2-b^2 & \begin{array}{ccc} 1+i & 1-i & \frac{1}{\sqrt{2}} \end{array} \\\hline \begin{array}{c} \color{green}{1+\cfrac 1 {1+\cfrac 1 {1+\cfrac 1\dots}} } \\ \color{blue}{aaaaaaa} \end{array} & \begin{array}{c} \color{green}{bbbbbbb} \\ \color{blue}{2+\cfrac 2 {2+\cfrac 2 {2+\cfrac 2\dots}} } \end{array} \end{array}$$

$$\begin{array}{c|c} a^2-b^2 & \begin{array}{ccc} 1+i & 1-i & \frac{1}{\sqrt{2}} \end{array} \\\hline \begin{array}{c} \color{green}{1+\cfrac 1 {1+\cfrac 1 {1+\cfrac 1\dots}} } \\ \color{blue}{aaaaaaa} \end{array} & \begin{array}{c} \color{green}{bbbbbbb} \\ \color{blue}{2+\cfrac 2 {2+\cfrac 2 {2+\cfrac 2\dots}} } \end{array} \end{array}$$


You might split cells instead by using nested arrays, as in the following example

$$\begin{array}{c|c} a^2-b^2 & \begin{array}{ccc} 1+i & 1-i & \frac{1}{\sqrt{2}} \end{array} \\\hline \begin{array}{cc}a-b & a+b \end{array} & \sqrt {2} \end{array}$$

It is generated by

$$\begin{array}{c|c} a^2-b^2 & \begin{array}{ccc} 1+i & 1-i & \frac{1}{\sqrt{2}} \end{array} \\\hline \begin{array}{cc}a-b & a+b \end{array} & \sqrt {2} \end{array}$$