0

So I am trying to figure this out:

enter image description here

Can you help me out with the layout? Those multi rows are hard to draw.

Working on a MWE right now:

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{multirow,tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\renewcommand{\arraystretch}{2}
\begin{document}\pagestyle{empty}
\begin{tabularx}{\textwidth}{|*{4}{Y|}}
\hline
\multirow{2}{*}{Similarity} 
  &\multicolumn{2}{c|}{Movielens 1M}&\\
\cline{2-4}
             &KNNBasic       &KNNBaseline & KNNMeans\\
\hline
MSD      &0.9345            &0.9345       & 0.9345  \\
\hline
User based &0.9345             &0.9345       &0.9345  \\
\hline
Item based     &0.9345   &0.9345     &0.9345  \\ \hline
\end{tabularx}
\end{document}

enter image description here

  • 3
    You don't need multirow for this, if I understand well what you want. Just use \cline{2-5} in the relevant places. – Bernard May 20 at 23:53
  • How can I put MSD, Cosine and Pearson behind User Based and Item Based? I’m stuck there – NaveganTeX May 21 at 1:34
1

Here is a reproduction of your first table, without colors, and with some entries vertically entered, which I think is nicer.

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{multirow,tabularx}
\renewcommand{\tabularxcolumn}[1]{m{#1}}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\renewcommand{\arraystretch}{2}
\begin{document}\pagestyle{empty}
\begin{tabularx}{\textwidth}{|*{5}{Y|}}
\hline
\multicolumn{2}{|c|}{\multirow{2}{*}{Similarity modules}}
  & \multicolumn{3}{c|}{Mean RMSE for Movielens 1M dataset} \\
\cline{3-5}
\multicolumn{2}{|c|}{} & KNN Basic       &KNN Baseline & KNN With Means\\
\hline
\multirow{2}{*}{MSD}      & Item Based & 0.9144            & 0.8853       & 0.8854  \\
\cline{2-5}
      & User Based & 0.9230            & 0.8953       & 0.9292  \\ \hline
\multirow{2}{*}{Cosine} & Item based & 0.9994             & 0.9840       & 0.8936  \\
\cline{2-5}
 & User based & 0.9767             & 0.9011       & 0.9394  \\ \hline
\multirow{2}{*}{Pearson} & Item based     & 0.9741   & 0.8825    & 0.8821  \\
\cline{2-5}
 & User based     & 0.9481   & 0.8879    & 0.9163  \\ \hline
\end{tabularx}
\end{document}

resulting document

If you want the table to be colored you have to insert \rowcolor, \cellcolor, and \arrayrulecolor commands from the colortbl package and use \color commands for some of the texts.

  • It was not that easy! Thank you very much Piet, I really appreciate it!!! – NaveganTeX Jun 2 at 16:15
1

Well, not the best, but it works for me.

\documentclass{article}
\usepackage[margin=1in]{geometry}
\usepackage{multirow,tabularx}
\newcolumntype{Y}{>{\centering\arraybackslash}X}
\renewcommand{\arraystretch}{2}
\begin{document}\pagestyle{empty}
\begin{tabularx}{\textwidth}{|*{3}{Y|}}
\hline
\multirow{2 }{*}{\textbf{Similarity}} 
  &  \multicolumn{2}{c|}{\textbf{RMSE}}   \\
\cline{2-3}
             &   Movielens        & Movielens \\
\hline
Cosine &         0.9345                &0.9345         \\
\hline
Pearson    &      0.9345               &0.9345       \\ \hline
\end{tabularx}
\end{document}

enter image description here

  • Could you please explain how the table in your answer and the request in the question are related. Also, is there a connection to the following question? Problem getting rid of column? – leandriis May 21 at 7:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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