2

In my first encounter with multicolumn and multirow, I have attempted to make a table containing math, including matrices.

Firstly, I have an error in my column names; I'm unsure where I am going wrong and have been unable to find similar problems. I wish for my titles to be "Design" and then "Results" as my multicolumn heading, but they both sit in the same box. (Edit: I'm also getting an error "Extra alignment tab has been changed to \cr." which I think may be the source of this problem?)

Secondly, the matrices in the cells seem crowded, is it possible to modify the cell size whilst retaining centering?

Finally, in my first column I have two matrices which sit each in their own multirow, they are currently left aligned (or aligned with each other) is it possible again to have them centered within their (multiple) cell?

I appreciate any help but will continue to attempt to resolve the issues. Please see the code below:

\documentclass{article}
\usepackage{multirow}
\usepackage{amsmath}
\begin{document}

\begin{center}
\begin{tabular}{ c|c c }
Design &\multicolumn{4}{c|}{Results}\\
\hline
\multirow{2}{11em}{$\xi_3 =  \begin{Bmatrix}
                        -1  &0      &1      \\
                        1/3 &1/3    &1/3    \\
                        \end{Bmatrix}$}
&$M(\xi_3)=\begin{bmatrix}
3   &0  \\
0   &2
\end{bmatrix}$
    &$d(x,\xi_3)= 1+\frac{3x^2}{2}$ \\
&$\begin{vmatrix}M(\xi_{3})\end{vmatrix}=6$
    &$d(x,\xi_{3})=2.5$\\
\multirow{2}{11em}{$\xi_3^{'} = \begin{Bmatrix}
                        -1  &1      \\
                        1/2 &1/2    \\
                        \end{Bmatrix}$}
&$M(\xi_3^{'})=\begin{bmatrix}
3   &0  \\
0   &2
\end{bmatrix}$
    &$d(x,\xi_3^{'})= 1+\frac{3x^2}{2}$ \\
&$\begin{vmatrix}M(\xi_{3}^{'})\end{vmatrix}=8$
    &$d(x,\xi_{3}^{'})=3$\\
\end{tabular}
\end{center}

\end{document}

3 Answers 3

1

You do not have to take into account the number pf columns of the matrices inside the tabular. I propose here some simplifications of the code and some improvemennts to the layout, using the array environment, and the makecell and nccmath packages:

\documentclass{article}
\usepackage{amsmath, nccmath}
\usepackage{multirow, makecell}

\begin{document}

\[
\begin{array}{c|cc}
\text{Design} &\multicolumn{2}{c|}{\text{Results}}\\%
\hline
\multirowcell{3}{ \xi_3 = \begin{Bmatrix}
                        -1 &0 &1 \\
                        1/3 &1/3 &1/3 \\
                        \end{Bmatrix} }
&\Gape[6pt][2pt]{M(\xi_3)=\begin{bmatrix}
3 &0 \\
0 &2
\end{bmatrix}}
    & d(x,\xi_3)= 1+\mfrac{3x^2}{2} \\[1ex]%
& \begin{vmatrix}M(\xi_{3})\end{vmatrix}=6
 & d(x,\xi_{3})=2.5 \\
\multirowcell{3}{\xi'_3 = \begin{Bmatrix}
 -1 &1 \\
 1/2 &1/2 \\
 \end{Bmatrix}}
&\Gape[10pt][2pt]{M(\xi'_3)=\begin{bmatrix}
3 &0 \\
0 &2
\end{bmatrix}}
 &d(x,\xi_3')= 1+\mfrac{3x^2}{2} \\%
&\begin{vmatrix}M(\xi'_{3})\end{vmatrix}=8
 &d(x,\xi'_{3})=3 \\
\end{array} \]

\end{document} 

enter image description here

2

I would avoid \multirow altogether. With array the entries are automatically typeset in math mode, to which I add \displaystyle.

Note that x_{3}^{'} is wrong and it should be x_{3}'.

\documentclass{article}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{array}

\begin{document}

\begin{center}
$\begin{array}{ *{3}{>{\displaystyle}l} }
\toprule
\multicolumn{1}{c}{\text{Design}} & \multicolumn{2}{c}{\text{Results}} \\
\midrule
\smash[b]{\xi_{3} = \begin{Bmatrix}
                    -1  &0      &1      \\
                    1/3 &1/3    &1/3    \\
                    \end{Bmatrix}}
&M(\xi_{3})=\begin{bmatrix}
            3   &0  \\
            0   &2
            \end{bmatrix}
&d(x,\xi_{3})=1+\frac{3x^2}{2}
\\ \addlinespace
&\lvert M(\xi_{3})\rvert=6
&d(x,\xi_{3})=2.5
\\ \midrule
\smash[b]{\xi_{3}' = \begin{Bmatrix}
                     -1  &1      \\
                     1/2 &1/2    \\
                     \end{Bmatrix}}
&M(\xi_{3}')=\begin{bmatrix}
             3   &0  \\
             0   &2
             \end{bmatrix}
&d(x,\xi_{3}')=1+\frac{3x^2}{2}
\\ \addlinespace
&\lvert M(\xi_{3}')\rvert=8
&d(x,\xi_{3}')=3
\\
\bottomrule
\end{array}$
\end{center}

\end{document}

enter image description here

0

With booktabs and {NiceTabular} of nicematrix.

\documentclass{article}
\usepackage{amsmath, nccmath}
\usepackage{nicematrix}
\usepackage{booktabs}

\begin{document}

\[
\begin{NiceArray}{ccc}[cell-space-limits=3pt]
\toprule
\text{Design} &\Block{1-2}{\text{Results}}\\
\midrule
\Block{2-1}{ \xi_3 = \begin{Bmatrix}
                     -1 &0 &1 \\
                     1/3 &1/3 &1/3 \\
                     \end{Bmatrix} }
& M(\xi_3) = \begin{bmatrix}
             3 &0 \\
             0 &2
             \end{bmatrix}
& d(x,\xi_3)= 1+\mfrac{3x^2}{2} \\
& \begin{vmatrix}M(\xi_{3})\end{vmatrix}=6
& d(x,\xi_{3})=2.5 \\
\midrule
\Block{2-1}{\xi'_3 = \begin{Bmatrix}
                      -1 &1 \\
                      1/2 &1/2 \\
                     \end{Bmatrix}}
& M(\xi'_3)=\begin{bmatrix}
            3 &0 \\
            0 &2
            \end{bmatrix}
&d(x,\xi_3')= 1+\mfrac{3x^2}{2} \\
&\begin{vmatrix}M(\xi'_{3})\end{vmatrix}=8
&d(x,\xi'_{3})=3 \\
\bottomrule
\end{NiceArray} \]

\end{document} 

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .