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 $\nabla$ and $\mathbb{F}$ and $\mathcal{S}$ are loaded by default.

As an example, I was trying to implement this table as would appea

 & \multicolumn{2}{c}{W=0} & \multicolumn{2}{c}{W=1}& \\
 & X & \bar{X} & X & \bar{X} \\ \hline
Y & a & b & r & s \\
\bar{Y} & c & d & u & v \\

So that it was clear we depicted an X-Y relation stratified by groups according to W=0 and W=1, like this:

Desired output

  • 4
    $\begingroup$ tex.stackexchange.com/q/313635/23242 $\endgroup$ Commented Oct 21, 2022 at 17:24
  • $\begingroup$ @Scortchi-ReinstateMonica interesting and creative examples. Maybe I misunderstand they look like they span a whole row, or at least from a particular column until the end. I need two text displays to hover over two columns specifically. I gave my "want" example as would be rendered as desired in my standard tex compiler. $\endgroup$
    – AdamO
    Commented Oct 21, 2022 at 18:20
  • 4
    $\begingroup$ Sorry, I didn't bother to compile & see how it's supposed to look. But you'll need some workaround, as \multicolumn isn't supported by MathJax: docs.mathjax.org/en/latest/input/tex/macros/index.html. (MathJax is an external service which converts a subset of LaTeX into MathML, so S.E. can't add functionality without writing & hosting its own extensions.) $\endgroup$ Commented Oct 22, 2022 at 9:14
  • 3
    $\begingroup$ Unrelatedly, I don't think you need the $$'s when you start & end the mathjax w/ \begin{} ... \end{}. $\endgroup$ Commented Oct 22, 2022 at 12:16
  • $\begingroup$ In light of @Scortchi-ReinstateMonica's comment, it might be worth trying to figure out if it can be done purely via MathML. $\endgroup$ Commented Oct 22, 2022 at 12:16
  • 2
    $\begingroup$ @gung-ReinstateMonica: Even if it can, you'll still have to persuade S.E. to enable MathML markup in posts. $\endgroup$ Commented Oct 22, 2022 at 20:20


You must log in to answer this question.

Browse other questions tagged .