3
\documentclass{article}

\begin{document}
    \begin{table}[h!]
        \centering
        \caption{Bobot kriteria}
        \label{tabel6}
        \begin{tabular}{|c|c|c|c|c|c|}
            \hline
            Kriteria&\multicolumn{4}{c|}{Pembuat keputusan ($D_1 - D_4$)}&Nilai rata-rata\\
            \hline
            $C_1$&AI&AI&AI&AI&$([0.8, 0.9], [0, 0.1])$\\
            \hline
            $C_2$&VI&VI&VI&I&$([0.659,0.762], [0.132,0.238])$\\
            \hline
        \end{tabular}
    \end{table}
\end{document}

enter image description here

Why the width of the 5th column not same as the width of 2nd, 3rd, and 4th columns? How to fix it?

1
  • 3
    Because the contents of the \multirow{4}{…} above is too wide for thlengths of the 4 corresponding columns. I suggest to use a two-line multicolumn with the makecell package.
    – Bernard
    Commented Apr 16, 2021 at 9:13

3 Answers 3

3

If a \multicolumn object is wider than the combined natural widths of the spanned columns, the excess space goes in the last spanned column.

If you cannot split the wide \multicolumn entry across lines, you can measure it and set the width of the columns to a fourth of this width.

\documentclass{article}
\usepackage{array}

\newlength{\spannedlength}
\AtBeginEnvironment{table}{%
  \setlength{\belowcaptionskip}{\abovecaptionskip}%
  \setlength{\abovecaptionskip}{0pt}%
}

\begin{document}

\begin{table}[h!]
\centering

\caption{Bobot kriteria}
\label{tabel6}

\settowidth{\spannedlength}{Pembuat keputusan ($D_1$ -- $D_4$}
% this will span four columns, six \tabcolsep spaces, but
% we need to take care of four \arrayrulewidth wide rules
\setlength{\spannedlength}{\dimexpr(\spannedlength-6\tabcolsep+4\arrayrulewidth)/4}

\begin{tabular}{|c|*{4}{w{c}{\spannedlength}|}c|}
\hline
Kriteria & \multicolumn{4}{c|}{Pembuat keputusan ($D_1$ -- $D_4$)} & Nilai rata-rata\\
\hline
$C_1$ & AI & AI & AI & AI & $([0.8, 0.9], [0, 0.1])$\\
\hline
$C_2$ & VI & VI & VI & I  & $([0.659,0.762], [0.132,0.238])$\\
\hline
\end{tabular}

\end{table}

\end{document}

I have changed $D_1-D_2$ into $D_1$ -- $D_2$ as it doesn't seem a subtraction. I also suggested how to get a proper distance between the caption and the table.

enter image description here

A different realization of the table with booktabs and no vertical rules.

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

\newlength{\spannedlength}
\AtBeginEnvironment{table}{%
  \setlength{\belowcaptionskip}{\abovecaptionskip}%
  \setlength{\abovecaptionskip}{0pt}%
}

\begin{document}

\begin{table}[h!]
\centering

\caption{Bobot kriteria}
\label{tabel6}

\settowidth{\spannedlength}{Pembuat keputusan ($D_1$ -- $D_4$}
% this will span four columns and six \tabcolsep spaces
\setlength{\spannedlength}{\dimexpr(\spannedlength-6\tabcolsep)/4}

\begin{tabular}{@{} c *{4}{w{c}{\spannedlength}} c @{}}
\toprule
Kriteria & \multicolumn{4}{c}{Pembuat keputusan ($D_1$ -- $D_4$)} & Nilai rata-rata\\
\midrule
$C_1$ & AI & AI & AI & AI & $([0.8, 0.9], [0, 0.1])$\\
$C_2$ & VI & VI & VI & I  & $([0.659,0.762], [0.132,0.238])$\\
\bottomrule
\end{tabular}

\end{table}

\end{document}

enter image description here

1

I suggest you place ($D_1 - D_4$) on a row by itself, directly below Pembuat keputusan.

enter image description here

\documentclass{article}
\usepackage{array}
\begin{document}
    \begin{table}[h!]
    \setlength\extrarowheight{2pt}
    \addtolength\tabcolsep{2pt}
        \centering
        \caption{Bobot kriteria\strut}
        \label{tabel6}
        \begin{tabular}{ | *{6}{c|} }
            \hline
            Kriteria & \multicolumn{4}{c|}{Pembuat keputusan} & Nilai rata-rata \\
                     & \multicolumn{4}{c|}{($D_1 - D_4$)} &  \\
            \hline
            $C_1$ & AI & AI & AI & AI & ($[0.8, 0.9]$, $[0, 0.1]$)\\
            \hline
            $C_2$ & VI & VI & VI & I & ($[0.659,0.762]$, $[0.132,0.238]$)\\
            \hline
        \end{tabular}
    \end{table}
\end{document}
1

You can fix by hand the width of the columns 2, 3, 4 and 5.

\documentclass{article}
\usepackage{caption}
\usepackage{array}

\begin{document}
\begin{table}[h!]
    \centering
    \caption{Bobot kriteria}
    \label{tabel6}
    \begin{tabular}{|c|*{4}{w{c}{1cm}|}c|}
        \hline
        Kriteria&\multicolumn{4}{c|}{Pembuat keputusan ($D_1 - D_4$)}&Nilai rata-rata\\
        \hline
        $C_1$&AI&AI&AI&AI&$([0.8, 0.9], [0, 0.1])$\\
        \hline
        $C_2$&VI&VI&VI&I&$([0.659,0.762], [0.132,0.238])$\\
        \hline
    \end{tabular}
\end{table}
\end{document}

Output fo the above code

You must log in to answer this question.

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