I am trying to create a table which has specified column widths and the text in these columns is right aligned. I can get this to work for every column except for the last column using '>{\raggedleft}p{3cm}'. However every time I try and use this for the last column I get a 'Misplaced \noalign. \hline ...' error followed by '! Extra alignment tab has been changed to \cr.<recently read> \endtemplate 100 &'
The following code will reproduce the error.
Code: Select all
\documentclass[11pt,letterpaper]{article}
\usepackage{array}
\begin{document}
Test table:
\begin{table}[!ht]
\begin{center}
\begin{tabular}{r >{\raggedleft}p{3cm} >{\raggedleft}p{3cm}}
\hline
test & really really long column title here & another really really long column title here \\
\hline
100 & 10 & 50000 \\
10 & 5 & 500 \\
\hline
\end{tabular}
\end{center}
\end{table}
\end{document}
If the last '>{\raggedleft}p{3cm}' is replaced with 'r' then it will be flushed right but the column label will be very long. Any help is greatly appreciated!