4

As seen below, my goal is to save some space. For example,

                     Applied
                      Model
Logistic 
Model

enter image description here

The code i'm using to generate the table is:

\begin{table}[ht]
\renewcommand{\arraystretch}{1}
\addtolength{\tabcolsep}{-5pt}
\centering
{\scriptsize
\begin{tabular}{llccc}
\hline
Algorithm & Dataset &  Applied Model (\%) & Definition of data  (\%) & Overall Assumptions (\%)  \\ \hline 
\multirow{3}{*}{Logistic MODEL} & + & 63.6 & 98 &  95.3937  \\ 
 & - & 68.1 & 95.5 & 95.4757   \\
 & - & 100 & 100 & 99.1935 \\ \hline
\end{tabular}}
\label{table:tex-exchange}
\end{table} 
5

You can use \multicolumn to override the column specification and then put the header text inside a \parbox (I centered the text inside each \parbox, but this is, of course, optional); the following modification of your code illustrates this approach:

\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}

\newcommand\MyHead[2]{%
  \multicolumn{1}{l}{\parbox{#1}{\centering #2}}
}

\begin{document}

\begin{table}[ht]
  \addtolength{\tabcolsep}{-3pt}
  \centering
  {\scriptsize
  \begin{tabular}{@{}llccc@{}}
    \toprule
    Algorithm & Dataset & \MyHead{1.3cm}{Applied\\ Model (\%)} 
      & \MyHead{1.5cm}{Definition\\ of data  (\%)}
      & \MyHead{2.2cm}{Overall\\ Assumptions (\%)}  \\
    \cmidrule(r){1-1}\cmidrule(rl){2-2}\cmidrule(rl){3-3}\cmidrule(rl){4-4}\cmidrule(l){5-5}
    \multirow{3}{*}{\parbox{1cm}{Logistic\\ MODEL}} & + & 63.6 & 98 &  95.3937  \\ 
    & $-$ & 68.1 & 95.5 & 95.4757   \\
    & $-$ & 100 & 100 & 99.1935 \\ 
    \bottomrule
  \end{tabular}}
  \label{table:tex-exchange}
\end{table} 

\end{document}

EDIT: another option would be to manually split the header text using several rows:

\documentclass{article}
\usepackage{booktabs}
\usepackage{multirow}

\begin{document}

\begin{table}[ht]
  \addtolength{\tabcolsep}{-3pt}
  \centering
  {\scriptsize
  \begin{tabular}{@{}llccc@{}}
    \toprule
    Algorithm & Dataset & Applied  & Definition & Overall  \\ 
    & & Model (\%) & of data (\%) & Assumptions (\%)  \\
    \cmidrule(r){1-1}\cmidrule(rl){2-2}\cmidrule(rl){3-3}\cmidrule(rl){4-4}\cmidrule(l){5-5}
    \multirow{3}{*}{\parbox{1cm}{Logistic\\ MODEL}} & + & 63.6 & 98 &  95.3937  \\ 
    & $-$ & 68.1 & 95.5 & 95.4757   \\
    & $-$ & 100 & 100 & 99.1935 \\ 
    \bottomrule
  \end{tabular}}
  \label{table:tex-exchange}
\end{table} 

\end{document}

Note that I took the liberty to use some of the features provided by the booktabs package; of course, this suggestion is completely optional.

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.