[Tex/LaTex] Enlarge table/tabular without using tabularx

tablestabularx

I have the following table and I want to enlarge this. The width of the table has not to be big as the \textwidth but it should be a little bit larger as it usually is:

\documentclass{article}
\usepackage{multirow}

\begin{document}

\begin{table}[bthp]
\centering
\begin{tabular}{ccccc}
\hline
\multicolumn{2}{c}{\multirow{2}{*}{\textbf{Parameter}}} & \multicolumn{3}{c}{\textbf{Messungen in ms}}                                  \\ \cline{3-5} 
\multicolumn{2}{c}{}     & \multicolumn{1}{c}{\textbf{First}} & \multicolumn{1}{c}{\textbf{Second}} & \multicolumn{1}{c}{\textbf{Third}} \\ \hline
\multirow{2}{*}{1KB}   & A & 0,043                                 & 0,200                                              & 0,990                                       \\ \cline{2-5} 
                       & B & 0,075                                  & 0,218                                                & 0,372                                          \\ \hline
\multirow{2}{*}{100KB} & A & 4,059                               & 0,283                                              & 5,087                                       \\ \cline{2-5} 
                       & B & 7,232                                  & 0,405                                                & 7,715                                          \\ \hline
\multirow{2}{*}{1MB}   & A & 37,989                              & 0,938                                             & 39,648                                      \\ \cline{2-5} 
                       & B & 38,600                                   & 1,445                                                & 40,122                                         \\ \hline
\multirow{2}{*}{100MB} & A & 3652,048                            & 73,660                                            & 3726,602                                    \\ \cline{2-5} 
                       & B & 3647,882                               & 115,198                                              & 3763,163                                       \\ \hline
\multirow{2}{*}{1GB}   & A & 36703,907                           & 738,011                                            & 37442,66                                    \\ \cline{2-5} 
                       & B & 36326,751                              & 1117,514                                             & 37444,319                                      \\ \hline
\multirow{2}{*}{4GB}   & A & 146859,876                            & 2815,443                                            & 149676,013                                    \\ \cline{2-5} 
                       & B & 146340,339                             & 4363,830                                              & 150704,225                                     \\ \hline
\end{tabular}
\end{table}

\end{document}

enter image description here

The problem is that it uses \multicolumn and \multirow. I created the table by using the tool http://www.tablesgenerator.com/latex_tables. Also, the position of the text in the cells should be centered and with tabularx I get left bounded text.

Best Answer

To widen the table to, say, 0.8\textwidth, you could use a tabular* environment instead of the current tabular environment; use the directive @{\extracolsep{\fill}} to make LaTeX expand the intercolumn whitespace sufficiently so that the table takes up the width specified in the first argument of tabular*.

You really ought to make a few more improvements to your table. I suggest you

  • align the numeric data on the decimal marker (in this case, a comma rather than a period); this can be done with either the dcolumn package or the siunitx package. In the example below, I use a column type of d{6.3} for the three numeric columns.

  • get rid of most \cline and \hline directives and use the macros of the booktabs package -- \toprule, \midrule, \bottomrule, and \cmidrule -- to insert well-spaced lines to set off the header material and to mark the end of the table. The interior \cline directives can be dropped entirely; I'd use extra vertical whitespace instead of the interior \hlines.

  • apply a few more touches to simplify and unify the visual appearance of the material

enter image description here

\documentclass[]{article}
\usepackage{multirow,dcolumn,booktabs}
\newcolumntype{d}[1]{D{,}{,}{#1}}

\begin{document}
\begin{table}[bthp]
\centering
\begin{tabular*}{0.8\textwidth}{@{} l @{\extracolsep{\fill}} l *{3}{d{6.3}} @{}}
\toprule
\multicolumn{2}{@{}l}{\textbf{Parameter}} & \multicolumn{3}{c}{\textbf{Messungen in ms}}                                  \\ \cmidrule(l){3-5}
&   
& \multicolumn{1}{r}{\textbf{First}} 
& \multicolumn{1}{r}{\textbf{Second}} 
& \multicolumn{1}{r@{}}{\textbf{Third}} \\ 
\midrule
\multirow{2}{*}{1KB}   & A & 0,043                                 & 0,200                                              & 0,990                                       \\
                       & B & 0,075                                  & 0,218                                                & 0,372                                          \\[1.5ex]
\multirow{2}{*}{100KB} & A & 4,059                               & 0,283                                              & 5,087                                       \\
                       & B & 7,232                                  & 0,405                                                & 7,715                                          \\[1.5ex]
\multirow{2}{*}{1MB}   & A & 37,989                              & 0,938                                             & 39,648                                      \\
                       & B & 38,600                                   & 1,445                                                & 40,122                                         \\[1.5ex]
\multirow{2}{*}{100MB} & A & 3652,048                            & 73,660                                            & 3726,602                                    \\
                       & B & 3647,882                               & 115,198                                              & 3763,163                                       \\[1.5ex]
\multirow{2}{*}{1GB}   & A & 36703,907                           & 738,011                                            & 37442,66                                    \\
                       & B & 36326,751                              & 1117,514                                             & 37444,319                                      \\[1.5ex]
\multirow{2}{*}{4GB}   & A & 146859,876                            & 2815,443                                            & 149676,013                                    \\ 
                       & B & 146340,339                             & 4363,830                                              & 150704,225                                     \\ 
\bottomrule
\end{tabular*}
\end{table}
\end{document} 
Related Question