3

How do I make the width not too big and how do I make the matrix appear at the center ? I copied this format from somewhere but i don't know how to edit it.

\begin{center}
    \begin{table}[h]
    \begin{tabu} to 1\textwidth {| X[c,m] | X[c,m] | X[c,m] | X[c,m] |@{}m{0pt}@{}}
    \hline
    k & $\pi$ & $\bm{\mu}$ & $\bm{S}$ \\ \hline
    1 & 0.865
      & [1.54   1.63    3.88]
      & $\begin{bmatrix} .0187 & .0043 & .0101 \\ .0043 & .0104 & .0152 \\ .0101 & .0152 & .1814 \end{bmatrix}$ \\[5ex] \hline
    2 & 0.135
      & [1.76   0.66    0.84]
      & $\begin{bmatrix} .0187 & .0043 & .0101 \\ .0043 & .0104 & .0152 \\ .0101 & .0152 & .1814 \end{bmatrix}$ \\[5ex] \hline
    \end{tabu}
    \caption{Maximum Likelihood Estimates of the component parameters.}
    \label{estimatedparameters}
    \end{table}
\end{center}

enter image description here

  • 2
    Do you have special reason to use tabu package for table? – Zarko Oct 14 '16 at 5:33
  • Off-topic: Don't embed a table environment inside a center environment. If the tabular material inside the table needs to be centered, provide a \centering instruction immediately after \begin{table}. – Mico Oct 14 '16 at 7:51
3

If you persist to use tabu, than try the following:

\documentclass{article}
\usepackage{tabu}
\usepackage{bm,mathtools}

\begin{document}
    \begin{table}[htb]
\tabulinesep =_3pt^3pt
    \begin{tabu} to \textwidth {| X[1,c,m] | X[1,c,m] | X[2,c,m] | X[3,c,m,$$]|}
    \hline
k   & $\pi$ & $\bm{\mu}$        & \bm{S}            \\ 
    \hline
1   & 0.865 & [1.54 1.63 3.88]  & \begin{bmatrix}
            .0187 & .0043 & .0101 \\
            .0043 & .0104 & .0152 \\
            .0101 & .0152 & .1814 \end{bmatrix}     \\
    \hline
2   & 0.135 & [1.76 0.66 0.84]  & \begin{bmatrix}
            .0187 & .0043 & .0101 \\
            .0043 & .0104 & .0152 \\
            .0101 & .0152 & .1814 \end{bmatrix}     \\
    \hline
    \end{tabu}
\caption{Maximum Likelihood Estimates of the component parameters.}
    \label{estimatedparameters}
\end{table}
 \end{document}

It gives:

enter image description here

3

Replace

\begin{tabu} to 1\textwidth {| X[c,m] | X[c,m] | X[c,m] | X[c,m] |@{}m{0pt}@{}}

with

\begin{tabu}{|c|c|c|c|}

This will centre-align all of the table contents, without spacing them out, and make sure the matrices fit into the last column.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.