1

When \multicolumn is used in dcolumn, then there is misalignment in text and the heading. See the figure for more details.

\documentclass[12pt,oneside]{report}
\usepackage{amsmath}
\usepackage{amstext}
\usepackage{lmodern}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage{caption,ragged2e,array}
\usepackage{pdflscape}
\usepackage{dcolumn}
\usepackage{setspace}
\usepackage{geometry}

\newcolumntype{d}[1]{ D{.}{\cdot}{-1} }

\begin{document}
\newgeometry{margin=1.5cm}
\begin{landscape}
\begin{table}[ht]
\centering
\footnotesize
\begin{tabular}{d{1} d{1} d{1} d{1} d{1} d{1}}
\toprule
kB/s_{um} & d/B & N_{c0} \text{ smooth base, smooth sides} & \multicolumn{3}{c}{$N_{c0}$ rough base ($\alpha_{base}=1$, varying side adhesion factor $\alpha_{side}$)}\\
 & & \alpha_{base}= 0 \text{, } \alpha_{side}= 0 & \alpha_{side}= 0 & \alpha_{side}= 0.5 & \alpha_{side}= 1 \\
\midrule
0 & 0.0 & 5.144 & 5.157 & 5.157 & 5.157\\
  & 0.1 & 5.507 & 5.511 & 5.615 & 5.705\\
  & 0.2 & 5.758 & 5.762 & 5.977 & 6.124\\
  & 0.3 & 5.952 & 5.955 & 6.296 & 6.513\\
  & 0.5 & 6.222 & 6.224 & 6.850 & 7.231\\
  & 1.0 & 6.614 & 6.616 & 7.978 & 8.847\\[4pt]
5 & 0.0 & 8.357 & 9.818 & 9.818 & 9.818\\
  & 0.1 & 8.436 & 9.499 & 9.693 & 9.837\\
  & 0.2 & 8.204 & 9.097 & 9.437 & 9.631\\
  & 0.3 & 8.045 & 8.805 & 9.253 & 9.507\\
  & 0.5 & 7.899 & 8.439 & 9.042 & 9.414\\
  & 1.0 & 7.822 & 8.025 & 9.017 & 9.656\\[4pt]
\bottomrule
\end{tabular}
\caption{Bearing capacity factors $N_{c0}= q_u/s_{u0}$ for strip foundations}
\label{gourtable2}
\end{table}
\end{landscape}
\restoregeometry

enter image description here

1- In the 3rd column, the text and numbers are not aligned properly. The numbers must be centered with the text. Same problem with 4th, 5th and 6th column.

2- In the \newcolumntype, the 3rd entry is specified as -1 because it is giving me a wider table but the extra space between 3rd and 4th column is not needed. Using #1 instead removes this, however it also removes the wider table.

What is the mistake I am doing in specifying the \newcolumntype?

1

The columns are too wide, due to the large headers; I suggest to split them across lines and to use siunitx.

\documentclass[12pt,oneside]{report}
\usepackage{amsmath}
\usepackage{lmodern}
\usepackage{booktabs}
\usepackage{siunitx}

\newcommand{\tsub}[1]{_{\mathrm{#1}}}

\begin{document}

\begin{table}[htp]
\centering
\footnotesize
\begin{tabular}{
  c
  S[table-format=1.1]
  S[table-format=1.3]
  S[table-format=1.3]
  S[table-format=1.3]
  S[table-format=1.3]
}
\toprule
{$\si{kB/s}\tsub{um}$} &
  {\si{dB}} &
  {$N_{c0}$ smooth base,} &
  \multicolumn{3}{c}{$N_{c0}$ rough base, $\alpha\tsub{base}=1$,} \\
& & {smooth sides} &
  \multicolumn{3}{c}{varying side adhesion factor $\alpha\tsub{side}$}\\
\cmidrule(lr){3-3} \cmidrule(lr){4-6}
& & {$\alpha\tsub{base}=0$, $\alpha\tsub{side}=0$} &
  {$\alpha\tsub{side}=0$} &
  {$\alpha\tsub{side}=0.5$} &
  {$\alpha\tsub{side}=1$} \\
\midrule
0 & 0.0 & 5.144 & 5.157 & 5.157 & 5.157\\
  & 0.1 & 5.507 & 5.511 & 5.615 & 5.705\\
  & 0.2 & 5.758 & 5.762 & 5.977 & 6.124\\
  & 0.3 & 5.952 & 5.955 & 6.296 & 6.513\\
  & 0.5 & 6.222 & 6.224 & 6.850 & 7.231\\
  & 1.0 & 6.614 & 6.616 & 7.978 & 8.847\\
\midrule
5 & 0.0 & 8.357 & 9.818 & 9.818 & 9.818\\
  & 0.1 & 8.436 & 9.499 & 9.693 & 9.837\\
  & 0.2 & 8.204 & 9.097 & 9.437 & 9.631\\
  & 0.3 & 8.045 & 8.805 & 9.253 & 9.507\\
  & 0.5 & 7.899 & 8.439 & 9.042 & 9.414\\
  & 1.0 & 7.822 & 8.025 & 9.017 & 9.656\\
\bottomrule
\end{tabular}
\caption{Bearing capacity factors $N_{c0}= q_u/s_{u0}$ for strip foundations}
\label{gourtable2}
\end{table}

\end{document}

enter image description here

  • true, was aware of the package but lacked the skills to create right commands. I added \setlength{\tabcolsep}{0.75cm} so that the numbers can breathe. :) – JaiGuruDev Jan 8 '16 at 21:53
2

It is perfectly aligned on the specified alignment point!

N_{c0} \text{ smooth base, smooth sides} 

does not have a . so it is taken as the integer part of a number in a D cell, and the right hand edge is aligned with . in the column.

If you want centred alignment you need to specify that:

\multicolumn{1}{c}{$N_{c0}$ smooth base, smooth sides} 

For your second question -1 is OK (the extra space to the right of the third column will go once you fix the heading, it is just centering the . for what is currently specified as a very wide integer part).

In that case you may as well just use d with no argument. If you want to use #1 and centre you need to specify d{1.1} for column 2 and d{2.3} in the other numeric columns (or whatever values your full data needs for integer digits . decimal fraction digits )

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.