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'm trying to center-align the two-line heading of the rightmost column of the following table. Given that I use decimal point alignment, I guess the centre of the headings should be aligned with the decimal point.

alt text

The code I used is below. I put table-text-alignment=center but it doesn't make any difference, as it can be seen.

\begin{table}[htp]
    \centering
    \begin{tabular}{
            @{}
           l
            S[group-separator={,}, group-four-digits=true,table-format=5.0] 
            S[group-separator={,}, group-four-digits=true,table-format=5.0]
            >{\bfseries}S[table-format=3.2, table-text-alignment=center]
            @{}
            }
          \toprule
          \textbf{Product Group} & \textbf{Production Size} & \textbf{Number of Failures} & \textbf{Failure Rates} \\
          & & & \textbf{(per 1,000 items)} \\
          \midrule
          %  \addlinespace
          this is foo1 & 11111 & 1111 & 11.11\\
          this was foo2 & 22222 & 2222 & 222\\
          this will be foo3 & 33333 & 3333 & 3.33\\
          foo4 & 44444 & 4444 & 44.4\\
          foo5 & 55555 & 5555 & 5.5\\
          \bottomrule
    \end{tabular}
\end{table}

I'm not sure what I'm doing wrong.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You have to mask the critical heading cell with an additional set of curly braces.

... & {\textbf{Failure Rates}} \\
share|improve this answer

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.