[Tex/LaTex] Left justified, fixed width columns in table not working correctly

tables

Thanks to this answer I can create left justified fixed width columns in my table. However, I would like to ask if anyone else has encountered the problems with the last column not working as it should, for example:

\begin{table}
\caption{Device technical specifications summary.}
\begin{tabular}{|R{3cm}|R{2cm}|R{2cm}|R{2cm}|R{3cm}|}
\hline
~ & Samsung Galaxy Pocket Neo & Samsung S3 Mini & Vodafone Smart4 Mini & Google (Asus) Nexus 7 (2012) \\
\hline
CPU Speed [MHz] & 850 & 1000 & 1300  & 1200 \\
\hline
CPU Type & 1 Core & 2 Core Coretex-A9 & 2 Core Cortex-A7 & 4 Core Cortex-A9 \\
\hline
RAM [MB] & 512 & 1024 & 512 & 1024 \\ 
\hline
Release Year & 2013 & 2012 & 2014 & 2012 \\
\hline
\end{tabular}
\label{Device technical specifications summary}
\end{table}

Everything works fine with
\begin{tabular}{|R{3cm}|R{2cm}|R{2cm}|R{2cm}|p{3cm}|}

But if as it was set out above, I get:

Errors: ./contents/Chap-6.tex:40: Misplaced \noalign. [\hline]

i.e. giving me problems starting with the first \hline.

Any advice?

Best Answer

This works fine for me: (copied the column types verbatim from the link you provided, which I presume is what you did)

\documentclass{article}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R}[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}


\begin{document}

\begin{table}
\caption{Device technical specifications summary.\label{Device technical specifications summary}}
\begin{tabular}{|R{3cm}|R{2cm}|R{2cm}|R{2cm}|R{3cm}|}
\hline
~ & Samsung Galaxy Pocket Neo & Samsung S3 Mini & Vodafone Smart4 Mini & Google (Asus) Nexus 7 (2012) \\
\hline
CPU Speed [MHz] & 850 & 1000 & 1300  & 1200 \\
\hline
CPU Type & 1 Core & 2 Core Coretex-A9 & 2 Core Cortex-A7 & 4 Core Cortex-A9 \\
\hline
RAM [MB] & 512 & 1024 & 512 & 1024 \\ 
\hline
Release Year & 2013 & 2012 & 2014 & 2012 \\
\hline
\end{tabular}
\end{table}

\end{document}
Related Question