2

enter image description here

I have a big table shown above with some problems:

1- I want to centralize (horizontally and vertically) the contents of all cells except the second column, vertically and horizontally. Also to centralize all the titles.

2- There should be a little space above and below the title of last 3 columns (three items below "Definition of users").

3- There is extra space below "Method 1 [1]" and on top of "Method 1's description".

4- The "InformationRetrieval1" name on the last row (first column) should break automatically since it is in a fixed length column, but it isn't.

Note that I am showing an MWE example here and the actual table is so bigger and fits the whole page (plus some of the margins). So please do not recommend changing the layout or removing the adjustbox, etc.:

Here's the code:

\RequirePackage{fix-cm}
\RequirePackage{amsmath}
\documentclass{svjour3}
\usepackage[backend=biber, maxnames=10, minnames=10]{biblatex}
\addbibresource{project.bib}
\smartqed  % flush right qed marks, e.g. at end of proof
\usepackage{graphicx}
\usepackage{floatrow}
\usepackage{lipsum}
\usepackage{multirow}
\usepackage{hhline}
\usepackage[group-separator={,},group-minimum-digits=4]{siunitx}
\usepackage{geometry}
\usepackage{adjustbox}
\usepackage{changepage}
\usepackage{makecell}
\usepackage{afterpage}
\usepackage{amssymb}
\usepackage{comment}
\usepackage{array}
\newcolumntype{?}{!{\vrule width 2pt}}

\makeatletter
\def\cl@chapter{\@elt {theorem}}
\makeatother
\usepackage{cleveref}%[2013/12/28]
\crefformat{footnote}{#2\footnotemark[#1]#3}
\journalname{Empirical Software Engineering}

\begin{document}
\title{Test project}
\author{Author 1         \and
        Author 2
}
\institute{Author 1 \at
              University of X \\
              \email{author1@someDomain.com}           
           \and
           Author 2 \at
              University of X
}
\date{Received: date / Accepted: date}
\maketitle

\begin{abstract}
Abstract
\keywords{keywords}
\end{abstract}

\section{Introduction}
Intro here ...

\section{Literature Review}
Lit review here \cite{Test1} ...

\newgeometry{bottom=0.5cm}
\begin{table}[htbp]
\centering
  \begin{adjustbox}{center}
  \caption{A review of previous methods and their used information for solving the problem}
\setlength\tabcolsep{2pt}
\hskip-13mm 
    \begin{tabular}{|m{16mm}?c|p{120mm}|c|c|c|}
    \hline
    \multirow{2}{*}{Method} & \multirow{2}{*}{Year} & \multicolumn{1}{c|}{\multirow{2}{*}{A summary of the techniques used}} & \multicolumn{3}{c|}{Definition of users} \\
\cline{4-6}          &       &       & \parbox{14mm}{\linespread{1}\selectfont{}\centering Final commenter} & \parbox{11mm}{\linespread{1}\selectfont{}\centering Closer / opener} & \parbox{11mm}{\linespread{1}\selectfont{}\centering Drafted login ...} \\
    \Xhline{5\arrayrulewidth}
    Method 1 \cite{Test1}  & 2004  & Method 1's description: This shows how the method works in different situations and what it has that is not mentioned in other works.  &       & \checkmark     & \checkmark \\ \hline
    ML1 & 2006  & Uses \textbf{Support Vector Machines (SVM)} classifier and text categorization to classify and label the input data (documents) into people (categories). Also used other machine learning approaches like and Naive Bayes to solve the problem. There are some Natural Language Processing (NLP) methods used in this method in order to remove stop words and filter extra keywords. &       & \checkmark     &  \\ \hline
    InformationRetrieval1  & 2009  & This method utilizes Bag of words;
    It Employed the \textbf{Vector Space Model (VSM)} and relies on a vocabulary of ``technical terms'' collected from the users' messages in the Facebook posts and the comments people made on his posts. The users' posts are  modeled as a big document and then a term vector, based on each user's history. Given a new topic, their approach finds closest user --according to the \textbf{cosine distance}-- is identified. & \checkmark     &       & \checkmark \\ \hline
    \end{tabular}
  \label{tab:previousMethods}
  \end{adjustbox}
  \vspace{-10pt}
\enlargethispage{-\baselineskip}
\end{table}
\restoregeometry

Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
Continue literature review ... 
\printbibliography % Prints the bibliography
\end{document}

The full code in the template is here: https://www.overleaf.com/9886798djbxjmvvhnjv#/36227506/

I tried different solutions that would work separately, but they did not work in this example, maybe because of the used template (the .clo and .cls files that are currently available in the above example in overleaf). Feel free to make a copy of the whole project and test separately in overleaf.

I appreciate solutions to any of the above problems.

3
  • The code here omits much, while the referenced code on overleaf is not "minimum", as in a minimum working example. – Steven B. Segletes Jun 8 '17 at 18:03
  • Thanks @StevenB.Segletes. I edited the question, but even the referenced code in overleaf is mimimum in that it does not contain the full table which fills exactly one page. I put the rest of stuff remaining there because I am using adjustbox and want two pages before and after the table page. – Alisa Jun 8 '17 at 18:19
  • Off-topic: Unless you use a LaTeX format built before 1 Jan. 2016, it should no longer be necessary to load the fix-cm package. – Mico Oct 8 '17 at 6:43
2

enter image description here

Your table is huge ... and \resizebox make its content almost not readable. Beside this, columns types doesn't allow to broke cells text in multi line.

I suggest to use tabularx, variant of X column type in first column, reduce the width of widest column and change page size of table (with \newgeometry):

\RequirePackage{fix-cm}
\RequirePackage{amsmath}
\documentclass{article}%{svjour3}
\usepackage[showframe]{geometry}
%\usepackage[backend=biber, maxnames=10, minnames=10]{biblatex}
%\addbibresource{project.bib}
%\smartqed  % flush right qed marks, e.g. at end of proof
%\usepackage{graphicx}
%\usepackage{floatrow}
\usepackage{lipsum}
\usepackage[group-separator={,},group-minimum-digits=4]{siunitx}
%\usepackage{adjustbox}
\usepackage{changepage}
%\usepackage{afterpage}
\usepackage{amssymb}
%\usepackage{comment}
\usepackage{makecell, multirow, tabularx}
\usepackage{ragged2e}
\newcolumntype{?}{!{\vrule width 2pt}}
\newcolumntype{L}{>{\RaggedRight}X}
%\usepackage{hhline}

\begin{document}

\newgeometry{hmargin=25mm,bottom=0.5cm}
\begin{table}[htp]
    \small
\centering
  \caption{A review of previous methods and their used information for solving the problem}
\setlength\tabcolsep{4pt}
    \begin{tabularx}{\linewidth}{|L ? c | p{105mm} |c|c|c|}
    \hline
    \multirow{2}{=}{Method} & \multirow{2}{*}{Year} & \multicolumn{1}{c|}{\multirow{2}{*}{A summary of the techniques used}} & \multicolumn{3}{c|}{Definition of users} \\
\cline{4-6}          &       &       & FC* & C/O* & DL* \\
    \Xhline{5\arrayrulewidth}
    Method 1 \cite{Test1}  & 2004  & Method 1's description: This shows how the method works in different situations and what it has that is not mentioned in other works.  &       & \checkmark     & \checkmark \\ \hline
    ML1 & 2006  & Uses \textbf{Support Vector Machines (SVM)} classifier and text categorization to classify and label the input data (documents) into people (categories). Also used other machine learning approaches like and Naive Bayes to solve the problem. There are some Natural Language Processing (NLP) methods used in this method in order to remove stop words and filter extra keywords. &       & \checkmark     &  \\ \hline
    Infor\-mation Retrieval1  & 2009  & This method utilizes Bag of words;
    It Employed the \textbf{Vector Space Model (VSM)} and relies on a vocabulary of ``technical terms'' collected from the users' messages in the Facebook posts and the comments people made on his posts. The users' posts are  modeled as a big document and then a term vector, based on each user's history. Given a new topic, their approach finds closest user --according to the \textbf{cosine distance}-- is identified. & \checkmark     &       & \checkmark \\ \hline
    \multicolumn{6}{l}{FC: Final Commenter, C/O: Closer/Opener, DL: Drafted Login}
    \end{tabularx}
  \label{tab:previousMethods}
\end{table}
\restoregeometry
\end{document}
1

Here's a second solution, which also employs a tabularx environment to guarantee that the tabular material will fit inside the width of the textblock. The first main difference to @Zarko's answer is that the third column, rather than the first column, is assigned a (modified) X column type. The second main difference is the use of an underlying m column type for both the first and third columns, to achieve the vertical centering that the OP has specified as being desirable.

A remark: I've the adjustbox-related code since it's not necessary for the table at hand. If the "real" table is considerably larger, just go ahead and reinstate the code related to adjusting the width of the tabular material.

enter image description here

\documentclass{svjour3}
\usepackage[english]{babel}
\usepackage{multirow} % \multirow macro
\usepackage{geometry} % change text block size
\usepackage{makecell} % \Xhline macro
\usepackage{amssymb}  % \checkmark symbol
\usepackage{ragged2e} % \RaggedRight
\usepackage{tabularx} % 'tabularx' env., loads 'array' package
\renewcommand{\tabularxcolumn}[1]{m{#1}} % 'm' col. type
\newcolumntype{?}{!{\vrule width 2pt}}

\journalname{Empirical Software Engineering}

\begin{document}

\begin{table}[htbp]
\caption{A review of previous methods and their used information for solving the problem}
\label{tab:previousMethods}

\setlength\tabcolsep{3pt} % default: 6pt
\setlength\extrarowheight{2pt} % for a more open "look"

\begin{tabularx}{\textwidth}{|%
   >{\hspace{0pt}\RaggedRight}m{16mm} % allow hyphenation
   ? c | 
   >{\RaggedRight}X|
   c | c| c| }
\hline
\multirow{3}{*}{Method} & \multirow{3}{*}{Year} & \multicolumn{1}{c|}{\multirow{3}{*}{A summary of the techniques used}} & \multicolumn{3}{c|}{Definition of users} \\
\cline{4-6}
& & & Final & Closer/ & Drafted \\[-2pt]
& & & commenter & opener & login\dots \\
\Xhline{5\arrayrulewidth}

Method 1 \cite{Test1}  & 2004  & Method 1's description: This shows how the method works in different situations and what it has that is not mentioned in other works.  
&  & \checkmark & \checkmark \\ 
\hline

ML1 & 2006  & Uses \textbf{Support Vector Machines (SVM)} classifier and text categorization to classify and label the input data (documents) into people (categories). Also used other machine learning approaches like and Naive Bayes to solve the problem. There are some Natural Language Processing (NLP) methods used in this method in order to remove stop words and filter extra keywords. 
& & \checkmark & \\ 
\hline

Information\-Retrieval1  & 2009  & This method utilizes Bag of words; It Employed the \textbf{Vector Space Model (VSM)} and relies on a vocabulary of ``technical terms'' collected from the users' messages in the Facebook posts and the comments people made on his posts. The users' posts are modeled as a big document and then a term vector, based on each user's history. Given a new topic, their approach finds closest user---according to the \textbf{cosine distance}---is identified. 
& \checkmark & & \checkmark \\ 
\hline
\end{tabularx}

\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.