0

I just want to create a table like this enter image description here

but without the in-between line among rows. I also don't need the line between columns like this enter image description here

but below the Existing Methods CFNeT multi-column i need a line which doesn't span the full table. I mean that the line must fit into the content.

  • 2
    Your question leaves all the effort to our community, even typing the essentials of a TeX document such as \documentclass{}...\begin{document} etc. As it is, most of our users will be very reluctant to touch your question, and you are left to the mercy of our procrastination team who are very few in number and very picky about selecting questions. You can improve your question by adding a minimal working example (MWE) that more users can copy/paste onto their systems to work on. If no hero takes the challenge we might have to close your question. – Stefan Pinnow Oct 8 at 16:40
  • You might want to look at the booktabs package. – barbara beeton Oct 8 at 17:40
0
\documentclass[11pt]{article}
\usepackage{graphicx}

\begin{document}
  This a multirow and multicolumn table
    \begin{tabular}{|c|c|c|}
      \hline
       a & b & g\\
       \hline
       b & c & h\\
       \hline
       g & v & a\\
       \hline
   \end{tabular}

\end{document}

The | represent the vertical lines separating each element of the cell and c is the option to centre the cell's content (there are others like r -> right and l -> left).

Finally \hline stands for horizontal line. I hope I was clear enough.

  • 1
    THe OP clearly states in their question that they want a table "without the in-between line among rows. I also don't need the line between columns like this enter image description here". The example code in your answer produces a table with a lot of horizontal and vertical rows. Also your table does not make use of \multirow or \multicolumn. Could you please comment on that? – leandriis Oct 8 at 18:49
0

You have to compile at least twice with every change in the percentage (last) column (since it uses eqparbox for getting the appropriate alignment).

enter image description here

\documentclass{book}

\usepackage[
  margin=1in,
  landscape
]{geometry} % Just for this example

\usepackage{booktabs,collcell,eqparbox,makecell}


\begin{document}

\begin{table}
  \centering
  \newcommand{\pa}[1]{\eqmakebox[CFNetvsNeuMF][r]{#1}}% Percentage alignment
  \newcommand{\hlc}{\textbf}% Highlight cell
  \caption{Comparison results of different methods in terms of NDCG@10 and HR@10.}
  \begin{tabular}{ *{9}{c} >{\collectcell\pa}c<{\endcollectcell} }
    \toprule
    &
    &
    \multicolumn{4}{c}{Existing methods} &
    \multicolumn{3}{c}{CFNet} &
    \\
    \cmidrule(lr){3-6}\cmidrule(lr){7-9}
    Dataset & % \raisebox{.7\normalbaselineskip}[0pt][0pt]{Dataset}
    Measures & % \raisebox{.7\normalbaselineskip}[0pt][0pt]{Measures}
    ItemPop & eALS & DMF & NeuMF &
    CFNet-rl & CFNet-ml & CFNet &
    \multicolumn{1}{c}{\smash{\makecell[b]{Improvement of \\ CFNet \emph{vs.} NeuMF}}} \\
    \midrule
    ml-1m &  HR  & 0.4535 & 0.7018 & 0.6565 & \hlc{0.7210} &
      0.7127 & 0.7073 & \hlc{0.7253} &
      0.6\% \\
          & NDCG & 0.2542 & 0.4280 & 0.3761 & \hlc{0.4387} &
      0.4336 & 0.4264 & \hlc{0.4416} &
      0.7\% \\
    \addlinespace
    lastfm &  HR  & 0.6628 & 0.8265 & 0.8840 & \hlc{0.8868} &
      0.8840 & 0.8834 & \hlc{0.8995} &
      1.4\% \\
           & NDCG & 0.3862 & 0.5162 & 0.5804 & \hlc{0.6007} &
      0.6001 & 0.5919 & \hlc{0.6186} &
      3.0\% \\
    \addlinespace
    AMusic &  HR  & 0.2483 & 0.3711 & 0.3744 & 0.3891 &
      0.3947 & \hlc{0.4071} & \hlc{0.4116} &
      5.8\% \\
           & NDCG & 0.1304 & 0.2352 & 0.2149 & 0.2391 &
      \hlc{0.2504} & 0.2420 & \hlc{0.2601} &
      8.8\% \\
    \addlinespace
    AToy &  HR  & 0.2840 & 0.3717 & 0.3535 & 0.3650 &
      0.3746 & \hlc{0.3931} & \hlc{0.4150} &
      13.7\% \\
         & NDCG & 0.1518 & \hlc{0.2434} & 0.2016 & 0.2155 &
      0.2271 & 0.2293 & \hlc{0.2513} &
      16.6\% \\
    \bottomrule
  \end{tabular}
\end{table}

\end{document}

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.