1

I'm using tabu package. The inside of the every cell doesn't get to the center except for the second and the third. And also the line for closing the table doesn't show. Can anybody help me to fix it?

here's my code:

\begin{longtabu} spread 0pt {|X[c]|X[c]|X[c]|X[c]|X[c]|}

\caption{Tabel pengujian perubahan nilai $poolSize$}
\label{tab:uji_perubahan_mutrate}\\

\hline
\multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{Nilai $poolSize$}}} & \multicolumn{2}{c|}{\textbf{Rata-rata nilai \textit{fitness}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Standar Deviasi}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Waktu Eksekusi (ms)}}}\\ \cline{2-3}
                                                                                        & Jenis Mesin & Nilai \textit{fitness} & & \\ \hline
\endfirsthead

\multicolumn{5}{c}%
{{\bfseries \tablename\ \thetable{} -- lanjutan}} \\
\hline \multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{Nilai $mutRate$}}} & \multicolumn{2}{c|}{\textbf{Rata-rata nilai \textit{fitness}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Standar Deviasi}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Waktu Eksekusi (ms)}}}\\ \cline{2-3}
                                                                                        & Jenis Mesin & Nilai \textit{fitness} & & \\ \hline
\endhead

\hline
\endlastfoot

\multirow{4}{*}{50} & MC1 & $-8879.91$ & $307.56$ & 968\\
                                    & MC2 & $-6948.41$ & $232.06$ & 560\\
                                    & MC3 & $-9038.94$ & $301.54$ & 662\\
                                    & MC4 & $-8056.39$ & $29.34$ & 490\\
\hline
\multirow{4}{*}{100} & MC1 & $-8923.99$ & $253.71$ & 1591\\
                                    & MC2 & $-6952.59$ & $235.55$ & 1085\\
                                    & MC3 & $-9074.79$ & $321.58$ & 1336\\
                                    & MC4 & $-8079.78$ & $29.73$ & 1020\\
\hline
\multirow{4}{*}{200} & MC1 & $-8900.99$ & $231.72$ & 3133\\
                                    & MC2 & $-6966.78$ & $210.47$ & 2160\\
                                    & MC3 & $-9156.77$ & $273.89$ & 2832\\
                                    & MC4 & $-8087.58$ & $27.45$ & 2069\\
\hline
\multirow{4}{*}{400} & MC1 & $-8824.43$ & $319.14$ & 6312\\
                                    & MC2 & $-6894.05$ & $243.90$ & 4432\\
                                    & MC3 & $-9206.41$ & $230.69$ & 5679\\
                                    & MC4 & $-8109.32$ & $19.93$ & 4265\\
\hline
\multirow{4}{*}{800} & MC1 & $-8928.02$ & $244.72$ & 13740\\
                                    & MC2 & $-7003.61$ & $224.54$ & 10712\\
                                    & MC3 & $-9105.77$ & $299.83$ & 13881\\
                                    & MC4 & $-8126.01$ & $16.48$ & 10145\\
\hline
\multirow{4}{*}{1600} & MC1 & $-8993.31$ & $184.42$ & 35095\\
                                    & MC2 & $-6979.81$ & $235.70$ & 25039\\
                                    & MC3 & $-9250.08$ & $203.56$ & 36045\\
                                    & MC4 & $-8140.90$ & $8.01$ & 26832\\
\hline
\multirow{4}{*}{3200} & MC1 & $-8975.11$ & $279.18$ & 118560\\
                                    & MC2 & $-7048.33$ & $193.06$ & 97475\\
                                    & MC3 & $-9181.94$ & $275.81$ & 119472\\
                                    & MC4 & $-8140.92$ & $19.60$ & 91147\\
\hline
\multirow{4}{*}{6400} & MC1 & $-8939.97$ & $281.94$ & 292329\\
                                    & MC2 & $-6933.66$ & $266.37$ & 286887\\
                                    & MC3 & $-9184.78$ & $311.50$ & 293889\\
                                    & MC4 & $-817.40$ & $11.09$ & 274224\\


\end{longtabu}
\FloatBarrier

and here is what it looks like: enter image description here

1

The use of tabu is tricky and since it is not maintained, it is not recommended to use ...

Your problem arise because column headers is to wide. With use of makecell and its macro thread Ibroke heads of last two column into two line. After this it seems that the result is far better as before. I also change table to fixed width (\textwidth) and exploit possibility to put columns in "math mode" (and with this the signs $ in each cells are surplus.

\documentclass{article}
\usepackage[showframe]{geometry}

\usepackage{array,makecell,multirow,longtable,tabu}
\renewcommand\theadfont{\bfseries}
    \renewcommand{\arraystretch}{1.1}%1.2

    \begin{document}
\begin{longtabu} to \textwidth {@{}|X[c]|X[c]|X[c,$]|X[c,$]|X[c,$]|@{}}

\caption{Tabel pengujian perubahan nilai $poolSize$}
\label{tab:uji_perubahan_mutrate}\\

    \hline
\multirow{2}{*}{\thead{Nilai  \textit{poolSize}}} 
    &   \multicolumn{2}{c|}{\textbf{Rata-rata nilai \textit{fitness}}} 
        &   \multirow{2}{\hsize}{\thead{Standar\\ Deviasi}}
            &   \multirow{2}{\hsize}{\thead{Waktu\\ Eksekusi (ms)}} \\
    \cline{2-3}
    & Jenis Mesin & Nilai \textit{fitness} & & \\ \hline
\endfirsthead

\multirow{2}{*}{\textbf{Nilai  \textit{poolSize}}}
    &   \multicolumn{2}{c|}{\textbf{Rata-rata nilai \textit{fitness}}}
        &   \multirow{2}{\hsize}{\thead{Standar\\ Deviasi}}
            &   \multirow{2}{\hsize}{\thead{Waktu\\ Eksekusi (ms)}} \\
    &   Jenis Mesin 
        &   Nilai \textit{fitness}  &   &                           \\ 
    \hline
\endhead
    \hline
\endlastfoot

\multirow{4}{*}{50} & MC1 & -8879.91 & 307.56 & 968\\
                                    & MC2 & -6948.41 & 232.06 & 560\\
                                    & MC3 & -9038.94 & 301.54 & 662\\
                                    & MC4 & -8056.39 & 29.34 & 490\\
\hline
\multirow{4}{*}{100} & MC1 & -8923.99 & 253.71 & 1591\\
                                    & MC2 & -6952.59 & 235.55 & 1085\\
                                    & MC3 & -9074.79 & 321.58 & 1336\\
                                    & MC4 & -8079.78 & 29.73 & 1020\\
\end{longtabu}
    \end{document}

I consider only part of table (to spare space here). Obtained result is:

enter image description here

The purpose of used showframe is only to show page layout. In real case it should be omitted.

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.