<p>I am not sure how LaTeX packages are loaded into StackExchanges like Stats, but I'm curious whether the multicolumn functionality can be added for arrays? I know some of the amsmath symbols are loaded since characters like <span class="math-container">$\nabla$</span> and <span class="math-container">$\mathbb{F}$</span> and <span class="math-container">$\mathcal{S}$</span> are loaded by default.</p>
<p>As an example, I was trying to implement this table as would appea</p>
<pre><code><span class="math-container">$$ 
\begin{array}{c|cccc}
 &amp; \multicolumn{2}{c}{W=0} &amp; \multicolumn{2}{c}{W=1}&amp; \\
 &amp; X &amp; \bar{X} &amp; X &amp; \bar{X} \\ \hline
Y &amp; a &amp; b &amp; r &amp; s \\
\bar{Y} &amp; c &amp; d &amp; u &amp; v \\
\end{array}$$</span>
</code></pre>
<p>So that it was clear we depicted an X-Y relation stratified by groups according to W=0 and W=1, like this:</p>
<p><a href="https://i.stack.imgur.com/7W9aA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7W9aA.png" alt="Desired output" /></a></p>
