1

I have the table below:

enter image description here

I want all of the cell entries to be centered. But I couldn't manage it. How can I do that?

My source code is below:

\documentclass{article}

\usepackage{array,multirow,graphicx}
\begin{document}



\newcommand{\colrot}{\rotatebox[origin = c]{90}{Variant}}
\begin{table}[h]
\begin{tabular}{cc|c|c|c|c|c|c|}
\cline{3-8}                                     &   & \multicolumn{6}{c|}{Time}                        \\ \cline{3-8} 
                                                &   & 75.5  & 76.0   & 76.5   & 77.0   & 77.5  & 78.0  \\ \hline
\multicolumn{1}{|c|}{\multirow{3}{*}{\colrot}}  & a & 69.39 & 139.95 & 172.78 & 177.83 & -     & -     \\[4mm] \cline{2-8} 
\multicolumn{1}{|c|}{}                          & b & 31.95 & 31.83  & 31.60  & 31.39  & 31.15 & 30.89 \\[4mm] \cline{2-8} 
\multicolumn{1}{|c|}{}                          & c & 48.89 & 54.59  & 55.33  & 55.76  & 56.0  & 56.14 \\[4mm] \hline
\end{tabular}
\end{table}


\end{document}

Any further recommendations for improving the quality of the table is highly appreciated.

1 Answer 1

2

I think most people dislike having to crane their necks to study headers of tables. Instead of rotating the string "Variant" by ninety degrees, consider placing it at the top left of the main header row. The first header row would thus consist of two items, "Variant" and "Time", and the second header row would provide six possibilities for the "Time" variable.

I would also suggest you get rid of all vertical bars and several of the horizontal lines, and use the line-drawing macros of the booktabs package instead of \hline and \cline to get well-spaced horizontal lines in the remaining cases. And, because most of the table's information consists of decimal numbers, consider loading the siunitx package and employing its S column type instead of the basic c ("centered") column type. (Encase the few non-numeric cell material in curly braces to center their contents.)

enter image description here

\documentclass[preview]{standalone}
\usepackage{siunitx}  % for "S" column type
\usepackage{booktabs} % for \toprule, \midrule, etc
\begin{document}
\begin{table}[h]
\centering
\begin{tabular}{@{} l *{6}{S[table-format=3.2]} @{}}
\toprule
Variant & \multicolumn{6}{c@{}}{Time} \\ 
\cmidrule(l){2-7} 
& 75.5  & 76.0   & 76.5   & 77.0   & 77.5  & 78.0  \\ 
\midrule
a & 69.39 & 139.95 & 172.78 & 177.83 & {--} & {--}\\ 
b & 31.95 & 31.83  & 31.60  & 31.39  & 31.15 & 30.89 \\ 
c & 48.89 & 54.59  & 55.33  & 55.76  & 56.0  & 56.14 \\ 
\bottomrule
\end{tabular}
\end{table}
\end{document}
1
  • Thanks for the instructive explanation and the elegant solution!
    – T-800
    Sep 25, 2014 at 17:44

You must log in to answer this question.

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