2

I have a table that spans multiple pages. So naturally I used the longtable environment in the landscape mode.

The table works fine but output has large amount of vertical cell padding and sometimes result in having just one row in one page. Any help on how to remove them and make the following table look acceptable.

\begin{landscape}
\begin{longtable}{|m{3.0cm}|m{8.5cm}|m{8.5cm}|}
\hline
Algorithm & Advantages & Disadvantages \\
\hline
Method A &\begin{itemize}
    \item Have a variable history window controlled by the weight parameter.
     \item Resilient to noise and impurities in data.
\end{itemize} & \begin{itemize}
    \item Difficult to gauge the sensitivity of the weight parameter.
     \item Has a tendency to loose pattern information during averaging.
\end{itemize}\\
\hline
Method B &  \begin{itemize}
    \item Fixed number of pervious input vectors provide fine grain control over the amount of history the algorithm considers when making classifications.  
     \item Does not loose pattern information as in averaging.
\end{itemize} & \begin{itemize}
    \item Is not very resilient to noise or impurities in data.
     \item Increasing the number of previous input vectors appended to the current input vector will increase the dimensionality (curse of dimensionality) of the overall input vector and the weight vectors of the SOM.
\end{itemize}\\
\hline
\caption{Summary of Methods}
\label{tab:summaryAlgorithms}    
\end{longtable}
\end{landscape}

Following is the output of the above code (I want to make sure that there is no vertical padding)

enter image description here

8
  • Your problem is not tied only to longtable but to all table's environments. Answers for your problem I already see in SE, however, I can not temporary remember at which questions.
    – Zarko
    Commented Dec 29, 2015 at 10:57
  • @Zarko I tried most of the methods I found regarding this in table environments but all of them seem not to work.
    – Synex
    Commented Dec 29, 2015 at 11:01
  • Hopefully I will finad one of my answer(s) on the this theme ... meantime try: (i) replace m{...} with p{...} (this will align lists on top), (ii) before each list in cell put `\vspace{-\baselineskip}. This should resolve your problem at least on the top side of cells.
    – Zarko
    Commented Dec 29, 2015 at 11:07
  • See, if tex.stackexchange.com/questions/76151/… solve your problem.
    – Zarko
    Commented Dec 29, 2015 at 11:30
  • @Zarko it does not solve my problem....I think its more to do with the unordered lists I use. putting 'p{}' will not resolve the issue as well.
    – Synex
    Commented Dec 29, 2015 at 11:38

1 Answer 1

3

See, if this is what you like to have:

enter image description here

The code for above picture contain some tricks, one is "borrowed" from here ...

\documentclass{article}
    \usepackage{array,longtable,multirow}
    \usepackage{caption}
    \usepackage{paralist}
    \usepackage[margin=20mm]{geometry}

\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother    

\newcolumntype{P}[1]{>{\compress\vspace{-2ex}}p{#1}<{\vspace*{-2ex}}}  
    \begin{document}
\begin{longtable}{|l|P{72mm}
                    |P{72mm}|}%
\hline
Algorithm & Advantages & Disadvantages \\
\hline
\multirow{5}*{Method A}
        &   \begin{itemize}
            \item Have a variable history window controlled by the weight parameter.
            \item Resilient to noise and impurities in data.
                \end{itemize}
                &   
                    \begin{itemize}[\textbullet]
                \item Difficult to gauge the sensitivity of the weight parameter.
                \item Has a tendency to loose pattern information during averaging.
                    \end{itemize}\\
\hline
\caption{Summary of Methods}
\label{tab:summaryAlgorithms}
\end{longtable}
    \end{document}    \caption{Summary of Methods}
\label{tab:summaryAlgorithms}
\end{longtable}
    \end{document}

For vertical centering of contents in the first table column the multirow package is used. Number of the rows is approximately equal to number of lines in the tallest cell on the other cells in this row (in showed case 4, but 5 gives slightly better result).

Since landscape has nothing with your problem, I skip it. Between columns with lists is slightly defference. In the second is exploit paralist package, where with option textbullet the list is shift closer to left border of column.

Addendum: Better looks (according to my taste) you can obtain with use of package makecell, from which with use of macro thead you get:

enter image description here

\documentclass{article}
    \usepackage{array,longtable,makecell,multirow}
\newcolumntype{P}[1]{>{\compress\vspace{-2ex}}p{#1}<{\vspace*{-2ex}}}
\renewcommand\theadfont{\bfseries}
    \usepackage{caption}
    \usepackage{paralist}
    \usepackage[margin=20mm]{geometry}

\makeatletter
\newcommand*{\compress}{\@minipagetrue}
\makeatother    

    \begin{document}
\begin{longtable}{|l|P{72mm}
                    |P{72mm}|}%
\hline
\thead{Algorithm} & \thead{Advantages} & \thead{Disadvantages} \\
\hline
\multirow{5}*{Method A} 
            &   \begin{itemize}[\textbullet]
            \item Have a variable history window controlled by the weight parameter.
            \item Resilient to noise and impurities in data.
                \end{itemize}
                &   
                    \begin{itemize}[\textbullet]
                \item Difficult to gauge the sensitivity of the weight parameter.
                \item Has a tendency to loose pattern information during averaging.
                    \end{itemize}\\
\hline
\caption{Summary of Methods}
\label{tab:summaryAlgorithms}
\end{longtable}
    \end{document}
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .