3

This is my code :

\documentclass[11pt,twoside]{report}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{multicol}
\usepackage{array}

\begin{document}

\begin{table}[H] \begin{tabular}{|l|lll|llll|l|} \hline \multirow{}{}{Algorithm Name} & \multicolumn{3}{l|}{Statistical properties} & \multicolumn{4}{l|}{Algorithm's features} & \multirow{2}{*}{Notes} \ \cline{2-8} & \multicolumn{1}{l|}{Average} & \multicolumn{1}{l|}{Variance} & Covariance & \multicolumn{1}{l|}{Non-Blind} & \multicolumn{1}{l|}{Noise robustness} & \multicolumn{1}{l|}{Linear algorithm} & CDW & \ \hline Algorithm1: Simple algorithm & \multicolumn{1}{l|}{T} & \multicolumn{1}{l|}{F} & F & \multicolumn{1}{l|}{T} & \multicolumn{1}{l|}{F} & \multicolumn{1}{l|}{T} & F & Illustrative purposes only \ \hline Algorithm2: Sebe 2005 {[}29{]} & \multicolumn{1}{l|}{T} & \multicolumn{1}{l|}{T} & F & \multicolumn{1}{l|}{F} & \multicolumn{1}{l|}{T} & \multicolumn{1}{l|}{F} & T & None \ \hline Algorithm3: Sebe 2006 {[}30{]} & \multicolumn{1}{l|}{T} & \multicolumn{1}{l|}{T} & T & \multicolumn{1}{l|}{F} & \multicolumn{1}{l|}{T} & \multicolumn{1}{l|}{F} & T & Future work \ \hline \end{tabular} \end{table} \end{document}

I want it to be like the following that I have made with Word : this one

Any help is really appreciated !

M-S
  • 141

2 Answers2

4

For your problem exist many solution, for example use p<width> columns, use X columns defined in tabularx package, etc. In your case may be handy tabularray package. Anyway, your columns headers are quite wide, even if they are written in two columns. A remedy can be make text area a bit wider (by use of the geometry package) and use the \footnotesize font:

\documentclass[11pt,twoside]{report}
%\usepackage{a4wide}
\usepackage[margin=25mm]{geometry}
\usepackage{tabularray}

\begin{document} \begin{table}[ht] \footnotesize \begin{tblr}{hlines, vlines, colspec= { X[1.4,l,m] *{7}{X[c,m]} X[c, m]}, colsep = 3pt, row{1} = {font=\bfseries} } \SetCell[r=2]{m} {Algorithm\ Name} & \SetCell[c=3]{c} {Statistical properties} & & & \SetCell[c=4]{c} {Algorithm's features}
& & & & \SetCell[r=2]{m} Notes \ & Average & Variance & Co-variance & {Non-\ Blind} & Noise robustness & Linear algorithm & CDW & \ {Algorithm 1:\ Simple algorithm}
& T & F & F & T & F & T & F & Illustrative purposes only \ Algorithm 2: Sebe 2005 [29]
& T & T & F & F & T & F & T & None \ Algorithm 3: Sebe 2006 {[}30{]}
& T & T & T & F & T & F & T & Future work \ \end{tblr} \end{table} \end{document}

enter image description here

If you for some reason had not have wider \textwidth you can make wider only locally for table by help of the package changepage.

Zarko
  • 296,517
2

You need to allow automatic line breaks in most of the table's columns. This may be done by switching from a tabular to a tabularx environment and employing X-type columns where needed. I would further like to encourage you to give the table a much more open look by (a) getting rid of all vertical rules and (b) employing fewer, but well-spaced, horizontal rules, using the macros of the booktabs package.

enter image description here

\documentclass[11pt,twoside]{report}
\usepackage[a4paper,margin=2cm]{geometry} % set page parameters as needed
\usepackage{tabularx,ragged2e,booktabs}
\newcolumntype{L}{>{\RaggedRight\hspace{0pt}}X}
\newcolumntype{C}{>{\Centering\hspace{0pt}}X}

\begin{document}

\begin{table}[ht] \setlength\tabcolsep{2pt} % default: 6pt \begin{tabularx}{\textwidth}{@{} L CCC CCCc L @{}} \toprule Algorithm Name & \multicolumn{3}{c}{Statistical properties} & \multicolumn{4}{c}{Algorithm's features} & Notes \ \cmidrule(lr){2-4} \cmidrule(l){5-8} & Average & Variance & Covariance & Non-Blind & Noise robustness & Linear algorithm & CDW & \ \midrule Alg1: Simple algorithm & T & F & F & T & F & T & F & Illustrative purposes only \ \addlinespace Alg2: Sebe 2005 [29] & T & T & F & F & T & F & T & None \ \addlinespace Alg3: Sebe 2006 [30] & T & T & T & F & T & F & T & Future work \ \bottomrule \end{tabularx} \end{table} \end{document}

Mico
  • 506,678