Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to use ctable in my thesis for tables and graphics and I also would like to use siunitx for formatting numbers and aligning numbers on the decimal marker in tables.

Everything seemed to work well until I discovered some strange behaviour in the last column. The heading does not get centered there (I tried the different settings for siunitx: table-alignment, table-text-alignment, in the preamble and for the specific column). It did not help.

ctable version is rev 26694, v 1.23;

siunitx is rev 29017, v 2.5p

This is my minimal example:

\documentclass[english]{book}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{ctable}
\usepackage{siunitx}
\begin{document}

% Does not center the heading in the last column.
\ctable[]{
  |l
  |S
  |S
  |S|
}{}{
  \FL
  &         {Tom} &     {Suzy} &    {Rob} \ML
  Eating &      122.5 &     1.025 &     1.5 \NN
  Sleeping &    9.1 &       1346.5 &    213.7 \NN
  Working &     7.5 &       9.5 &       2.0125 \NN
  Watching TV & 5.25 &      117.5 &     7.5 \LL}

% Works fine with simple tabular
\begin{tabular}{
  |l
  |S
  |S
  |S|
  }
  \hline
  &         {Tom} &     {Suzy} &    {Rob} \\ \hline
  Eating &      122.5 &     1.025 &     1.5 \\
  Sleeping &    9.1 &       1346.5 &    213.7 \\
  Working &     7.5 &       9.5 &       2.0125 \\
  Watching TV & 5.25 &      117.5 &     7.5 \\ \hline
\end{tabular}

\end{document}

This is how it looks to me:

ctable and tabular

share|improve this question
1  
Interesting... A simple fix is adding an empty last column by changing the |S| to |S|@{}l@{}, and the changing {Rob} \ML to {Rob} &\ML. –  Peter Grill Mar 4 '13 at 21:14
    
Welcome to TeX.sx! –  Peter Jansson Mar 4 '13 at 21:29
1  
It's a known problem, I believe: an S column needs to see either & or \\ to know where it ends and \ML is not good when there's \multicolumn. I tried to find an answer by Joseph Wright, but didn't find it. –  egreg Mar 4 '13 at 21:38
    
Thank you both! –  jogru Mar 4 '13 at 21:41
1  
rather than change the preamble you can just change \ML to \tabularnewline \midrule which is the same thing, but works –  David Carlisle Mar 4 '13 at 21:42
show 3 more comments

1 Answer

up vote 5 down vote accepted

Just to close off the solution in the comments

Rather than change the preamble you can just change \ML to \tabularnewline \midrule which is the same thing, but works.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.