[Tex/LaTex] Alignment in a longtable + centered rule

horizontal alignmentlongtable

The first row in my longtable-environment should be left-aligned and only have a specific width. The other rows should be right-aligned. I get the error Extra alignment tab has been changed to \cr 1 & if I use >{\raggedleft}p{1cm} instead of only p{1cm}. What is wrong with my environment?

Is there also a way to align the \cmidrule centered in the middle of the whole table? An extra table in a minipage-environment does not really work (the minipage is then right-aligned).

\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{paper=a4paper,inner=26mm,outer=26mm,top=30mm}
\usepackage{longtable}
\usepackage{array}
\usepackage{booktabs}
\newcolumntype{L}[1]{>{\raggedleft\hspace{0pt}}p{#1}}
\begin{document}
\begin{longtable}{lrrrp{1cm}}%{lrrrL{1cm}}
\caption{Fo}
\label{tab:ll}\\
\toprule
Nanana  &\multicolumn{1}{p{3cm}}{nononononon nii nuu Ononononono}&\multicolumn{1}{p{3cm}}{nononononon nunu nnu bobobobobob}&nun&\multicolumn{1}{p{3cm}}{nono non nonors nononno nunununun}\\\midrule
\multicolumn{5}{c}{nonono,\qquad nono=0.042\quad nununu=0.011}\\
\multicolumn{5}{c}{npnpnpnpnpnpnnununuu:\qquad 2.35}\\
\cmidrule(lr){2-4}
0   &6907   &6615   &3684   &79 \\
1   &96907  &96615  &93684  &179    \\
\bottomrule
\end{longtable}
\end{document}

Best Answer

The problem is well known and documented in the package array: if you have >{\raggedleft} in the last column either you use \tabularnewline for ending the row or say

>{\raggedleft\arraybackslash}p{3cm}

It's also wrong to specify p{1cm} in the table preamble, while using p{3cm} in the \multicolumn: use the same dimension in both places.

Related Question