I'm quite new to latex , I have tried to use multi columns to design a table like this, but seems hard to achieve.
Asked
Active
Viewed 482 times
1
1 Answers
1
I would have set the tabular as a traditional tabular using booktabs rules and no vertical lines. In addition, underline is for typewriters, italics is used to emphasise text. Since all numbers (save one) has two digits behind decimal separator, ordinary right aligned columns works well. \multicolumn{1}{c}{1} change the alignment for the three cells that contains headings.
If you insist to have ugly ‘Word-like’ tables, I have included the code in example 2 below. The line \setlength{\extrarowheight}{2pt} is important to have some space between the horizontal line and the cell content:
Example 1 – booktabs-style tabular`
\documentclass{scrartcl}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{array, booktabs}
\begin{document}
\noindent\begin{tabular}{@{}lcrrr@{}}
\toprule
&&\multicolumn{3}{c}{ROUGE}\\
\cmidrule(l){3-5}
Model&Type&\multicolumn{1}{c}{1}&\multicolumn{1}{c}{2}&\multicolumn{1}{c}{3}\\
\midrule
\multicolumn{5}{c}{\bfseries Previous work}\\
\midrule
SumBasix & Ext &29.47 & 6.95 & 2.36\\
LexRank & Ext & 33.85 & 10.73 & 4.54\\
LSA & Ext & 29.91 & 7,42 & 3.12\\
\addlinespace[4pt]
Seq2Seq & Abs & 29.30 & 6.00 & 1.77\\
Pointer-gen& Mix & 32.06 & 9.04 & 2.15 \\
Discourse & Mix & 35.80 & 11.05 & 3.62 \\
\midrule
\multicolumn{5}{c}{\bfseries Our Models}\\
\midrule
Lead-10 & Ext & 35.52& 10.33 & 3.74\\
Sent-CLF & Ext & 34.01 & 8.71 & 2.99\\
Sent-PTR & Ext & \itshape 42.32 & \itshape 15.63 & \itshape 7.49\\
\addlinespace[4pt]
TLM-I & Abs & 39.80 & 12.20 & 4.42\\
TLM-I+E (M,M) & Mix & 41.59 & 14.26 & 5.94 \\
TLM-I+E (G,M) & Mix & \bfseries 42.43 & \bfseries 15.24 & \bfseries 6.68 \\
\midrule
\multicolumn{5}{c}{\bfseries Oracle}\\
\midrule
Gold-Ext & Orac & 44.25 & 18.07 & 9.14 \\
TLM-I+E (G,G) & Orac& 46.52 & 18.19 & 8.73 \\
\bottomrule
\end{tabular}
\end{document}
Example 2 – ugly and wrong ‘Word-like’ tabular
\documentclass{scrartcl}
\usepackage{lmodern}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{array}
\setlength{\extrarowheight}{2pt}
\begin{document}
\noindent\begin{tabular}{|l|c|r|r|r|}
\hline
&&\multicolumn{3}{c|}{ROUGE}\\
Model&Type&\multicolumn{1}{c}{1}&\multicolumn{1}{c}{2}&\multicolumn{1}{c|}{3}\\
\hline
\multicolumn{5}{|c|}{\bfseries Previous work}\\
\hline
SumBasix & Ext &29.47 & 6.95 & 2.36\\
LexRank & Ext & 33.85 & 10.73 & 4.54\\
LSA & Ext & 29.91 & 7,42 & 3.12\\
\hline
Seq2Seq & Abs & 29.30 & 6.00 & 1.77\\
Pointer-gen& Mix & 32.06 & 9.04 & 2.15 \\
Discourse & Mix & 35.80 & 11.05 & 3.62 \\
\hline
\multicolumn{5}{|c|}{\bfseries Our Models}\\
\hline
Lead-10 & Ext & 35.52& 10.33 & 3.74\\
Sent-CLF & Ext & 34.01 & 8.71 & 2.99\\
Sent-PTR & Ext & \itshape 42.32 & \itshape 15.63 & \itshape 7.49\\
\hline
TLM-I & Abs & 39.80 & 12.20 & 4.42\\
TLM-I+E (M,M) & Mix & 41.59 & 14.26 & 5.94 \\
TLM-I+E (G,M) & Mix & \bfseries 42.43 & \bfseries 15.24 & \bfseries 6.68 \\
\hline
\multicolumn{5}{|c|}{\bfseries Oracle}\\
\hline
Gold-Ext & Orac & 44.25 & 18.07 & 9.14 \\
TLM-I+E (G,G) & Orac& 46.52 & 18.19 & 8.73 \\
\hline
\end{tabular}
\end{document}
Sveinung
- 20,355
-
You can have the first two columns verticaly aligned using multirow package. tex file example : http://ix.io/22vu – gigiair Nov 22 '19 at 09:18
-
@gigiair I have intentionally not vertically centred the content of the two first cell, because will be typographical wrong to do that. – Sveinung Nov 22 '19 at 09:32



https://tex.stackexchange.com/questions/433885/how-to-get-a-table-with-equally-spaced-columns-and-not-going-outside-the-page?rq=1and you will be a master in no time or herehttps://tex.stackexchange.com/questions/513531/how-to-design-multi-row-and-multi-column-tables-in-latex?rq=1– js bibra Nov 22 '19 at 08:41