1

I am using the array package and have a problem with generating the following table:

\begin{table}
\renewcommand{\arraystretch}{1.5}
\centering 
\caption{Design values of thermal properties of typical building materials}
\label{t:material_prop}
\begin{tabular}{l@{\hskip 1.5cm} >{\centering}p{1.5cm} >{\centering}p{1.5cm} >{\centering}p{1.5cm}}
\toprule[3pt] \toprule
\textbf{Material} & \textbf{Thermal conductivity (W/m.K)} & \textbf{Density (kg/m\textsuperscript{3})} & \textbf{Specific heat (kJ/kg.K)} \\ \midrule
Acoustic tile & 0.061 & 481 & 0.84 \\
Clay tile & 0.571 & 1121 & 0.84 \\
Common brick & 0.727 & 1922 & 0.84 \\
Dense insulation & 0.043 & 91 & 0.84 \\
Face brick & 1.333 & 2002 & 0.92 \\
Felt and membrane & 0.19 & 1121 & 1.67 \\
Finish & 0.415 & 1249 & 1.09 \\
heavy-weight concrete & 1.731 & 2243 & 0.84 \\
heavy-weight concrete block & 0.813 & 977 & 0.84 \\
Light insulation & 0.043 & 32 & 0.84 \\
light-weight concrete & 0.173 & 641 & 0.84 \\
light-weight concrete block & 0.381 & 609 & 0.84 \\
Plaster or gypsum & 0.727 & 1602 & 0.84 \\
Slag & 0.19 & 1121 & 1.67 \\
Steel siding & 44.998 & 7689 & 0.42 \\
Stone & 1.436 & 881 & 1.67 \\
Stucco & 0.692 & 1858 & 0.84 \\
Wood & 0.121 & 593 & 2.51 \\
\bottomrule \bottomrule[3pt]
\end{tabular}
\end{table}
2
  • Any help please !
    – Muhammad
    Commented Nov 27, 2013 at 15:45
  • 2
    Please post a real question and tell us the specific problem. We will close it for now. Obviously the answer by @Johannes_B was solving your problem, so I guess there's no need to reopen for additional answers - but it's possible.
    – Stefan Kottwitz
    Commented Nov 27, 2013 at 16:53

1 Answer 1

2

Using the S column of siunitx gives you a much cleaner table, the table numbers are properly aligned.

The \centering command changes the behaviour of the line ending \\. You need to restore it using arraybackslash. I just defined a new columntype P, so the code is cleaner.

But I still think using siunitx gives a result much more pleasing to the eye.

\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\newcolumntype{P}{>{\centering\arraybackslash}p{1.5cm}}
\usepackage{siunitx}

\begin{document}

 \begin{tabular}{l@{\hskip 1.5cm} PPP }
  \toprule
  {Material} & {Thermal conductivity } & {Density} & {Specific heat} \\
  \midrule
  Acoustic tile & 0.061 & 481 & 0.84 \\
  Clay tile & 0.571 & 1121 & 0.84 \\
  \bottomrule
 \end{tabular}

\begin{table}
 \centering 
 \caption{Design values of thermal properties of typical building materials}
 \label{t:material_prop}
 \begin{tabular}{lSSS}
 \toprule
 {Material} & {Thermal conductivity } & {Density} & {Specific heat} \\
   &  \si{\watt\per\meter\per\kelvin} & \si{\kilo\gram\per\cubic\meter} &
      \si{\kilo\joule\per\kilo\gram\kelvin}\\
 \midrule
 Acoustic tile & 0.061 & 481 & 0.84 \\
 Clay tile & 0.571 & 1121 & 0.84 \\
 Common brick & 0.727 & 1922 & 0.84 \\
 Dense insulation & 0.043 & 91 & 0.84 \\
 Face brick & 1.333 & 2002 & 0.92 \\
 Felt and membrane & 0.19 & 1121 & 1.67 \\
 Finish & 0.415 & 1249 & 1.09 \\
 heavy-weight concrete & 1.731 & 2243 & 0.84 \\
 heavy-weight concrete block & 0.813 & 977 & 0.84 \\
 Light insulation & 0.043 & 32 & 0.84 \\
 light-weight concrete & 0.173 & 641 & 0.84 \\
 light-weight concrete block & 0.381 & 609 & 0.84 \\
 Plaster or gypsum & 0.727 & 1602 & 0.84 \\
 Slag & 0.19 & 1121 & 1.67 \\
 Steel siding & 44.998 & 7689 & 0.42 \\
 Stone & 1.436 & 881 & 1.67 \\
 Stucco & 0.692 & 1858 & 0.84 \\
 Wood & 0.121 & 593 & 2.51 \\
 \bottomrule 
\end{tabular}
\end{table}
\end{document}

enter image description here

2
  • Thanks, but the problem is with the following line : "\begin{tabular}{l@{\hskip 1.5cm} >{\centering}p{1.5cm} >{\centering}p{1.5cm} >{\centering}p{1.5cm}}" because when it is typed as: "\begin{tabular}{l@{\hskip 1.5cm}ccc}" the problem is solved I don't know why !!!
    – Muhammad
    Commented Nov 27, 2013 at 15:49
  • 1
    I made an update to the answer. Is this helping you?
    – Johannes_B
    Commented Nov 27, 2013 at 16:08

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