0

I have a question about {tabular}

> \newcolumntype{R}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
> \begin{tabular}{|R{2cm}|R{2cm}|R{2cm}|R{2cm}|R{2cm}|}
> \hline 
> 1.845 & 0 & 0.61 &   &   \\  \hline 
> 1.885 & 4 & 3.04 &  &  \\  \hline 
> 1.925 & 7 & 9.75 & 11 & 12.79 \\  \hline 
> 1.965 & 17 & 2.08 & 17 & 20.08 \\  \hline 
> 2.005 & 34 & 26.50 & 34 & 26.50 \\  \hline 
> 2.045 & 17 & 22.44 & 17 & 22.44 \\  \hline 
> 2.085 & 17 & 12.18 & 17 & 12.18 \\  \hline 
> 2.125 & 3 & 4.24 & 4 & 5.18 \\  \hline 
> 2.165 & 1 & 0.945 &  &  \\  \hline  \end{tabular}

And that's the result

enter image description here

How can I merge only the cells that I highlighted in red in to a single-row cell?

enter image description here

  • Look into multirow and multicolumn, there's plenty of questions on it on this site. :) – Alenanno Feb 15 '16 at 18:29
1

Something like that?

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{array, multirow}
 \newcolumntype{R}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\begin{document}
\begin{tabular}{|R{2cm}|R{2cm}|R{2cm}|R{2cm}|R{2cm}|}
\hline
1.845 & 0 & 0.61 &\multirow{3}{*}{11} & \multirow{3}{*}{12.79}\\
\cline{1-3}
1.885 & 4 & 3.04 & & \\
\cline{1-3}
1.925 & 7 & 9.75 & & \\
\hline
1.965 & 17 & 2.08 & 17 & 20.08 \\ \hline
2.005 & 34 & 26.50 & 34 & 26.50 \\ \hline
2.045 & 17 & 22.44 & 17 & 22.44 \\ \hline
2.085 & 17 & 12.18 & 17 & 12.18 \\ \hline
2.125 & 3 & 4.24 & \multirow{2}{*}{4} & \multirow{2}{*}{5.18} \\
\cline{1-3}
2.165 & 1 & 0.945 & & \\
\hline
\end{tabular}

\end{document} 

enter image description here

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