0

For a scientific paper I use the llncs layout. There I have created a table with tabular. The first column of this table should take half of the text width. The content of this first column can be of different length and extend over several lines. I used the following code to create the table.

\documentclass[runningheads]{llncs}
%
\usepackage{graphicx}

\begin{document}

\begin{table} \centering % stretch table over full \textwidth \resizebox{\textwidth}{!}{ \begin{tabular}{l|lll} \hline Column #1 & Col #2 & Col #3 & Col #4 \ \hline \parbox{6cm}{In reviewing applicants, we consider both objective criteria, such as test scores, and subjective criteria, such as leadership ability.} & negative & neutral & positive \ \parbox{6cm}{As a test for centrophobia, we measured the time fish spent in the centre of the tank in the horizontal plane.} & negative & neutral & positive \ \parbox{6cm}{The fortifications failed their only test when the New Model Army entered London in 1647 and they were levelled by Parliament the same year.} & negative & neutral & positive \ \parbox{6cm}{But Tower did better than HBO, the Boston Business Journal, and some others, where the test messages apparently fell into a cyberhole.} & negative & neutral & positive \ \parbox{6cm}{As you can see from the test reports, in the lower frequency ranges in particular, egg crates offer little value for absorption.} & negative & neutral & positive \ \end{tabular} } \end{table}

\end{document}

Here is the problem, that the different rows of the table are too close to each other and are also hard to distinguish.

enter image description here

How can I update the code to get an even, legible table stretching over the full \textwidth?

1 Answers1

1

First I'd recommend you to avoid the use of parbox since LaTeX already has a default option to create inner paragraphs in the tabular environment

\begin{tabular}{p{6cm}|lll}
\hline
Column \#1 & Col \#2 & Col \#3 & Col \#4 \\ 
\hline
In reviewing applicants, we consider both objective criteria, such as test scores, and subjective criteria, such as leadership ability. & negative & neutral & positive \\
As a test for centrophobia, we measured the time fish spent in the centre of the tank in the horizontal plane. & negative & neutral & positive \\
The fortifications failed their only test when the New Model Army entered London in 1647 and they were levelled by Parliament the same year. & negative & neutral & positive \\
But Tower did better than HBO, the Boston Business Journal, and some others, where the test messages apparently fell into a cyberhole. & negative & neutral & positive \\
As you can see from the test reports, in the lower frequency ranges in particular, egg crates offer little value for absorption. & negative & neutral & positive \\
\end{tabular}

Here I got rid of all the parboxes and replaced the l position above for p{6cm} which does exactly the same and gets correct spacing. If you want to increase it even more you can redefine the arraystretch as suggested in this stackexchange forum, which ultimately it's coded like this:

\bgroup
\def\arraystretch{1.5}
\begin{tabular}{p{6cm}|lll}
\hline
Column \#1 & Col \#2 & Col \#3 & Col \#4 \\ 
\hline
In reviewing applicants, we consider both objective criteria, such as test scores, and subjective criteria, such as leadership ability. & negative & neutral & positive \\
As a test for centrophobia, we measured the time fish spent in the centre of the tank in the horizontal plane. & negative & neutral & positive \\
The fortifications failed their only test when the New Model Army entered London in 1647 and they were levelled by Parliament the same year. & negative & neutral & positive \\
But Tower did better than HBO, the Boston Business Journal, and some others, where the test messages apparently fell into a cyberhole. & negative & neutral & positive \\
As you can see from the test reports, in the lower frequency ranges in particular, egg crates offer little value for absorption. & negative & neutral & positive \\
\end{tabular}
\egroup

And displays like this:enter image description here

  • That works out great for me. Just a little addition. Is it possible to center the content of columns 2, 3 and 4 vertically as it was in the previous version? – JohnDizzle Jun 29 '20 at 17:31
  • I noticed that the table no longer uses the full `\textwidth'. How can I adjust this? – JohnDizzle Jun 29 '20 at 17:34
  • Oh I just didn't copied that part, but you can still surround the table in the \resizebox command you use in the MWE. As I read you can add the array package and replace the l positions for m{3cm} or any length to get vertically centered cells – José Ignacio Cuevas Barrientos Jun 29 '20 at 17:53
  • @JoséIgnacioCuevasBarrientos: Please do not use or recommend resizebox in order to make tables as wide as the textwidth. This will result in inconsistent font sizes. – leandriis Jun 29 '20 at 18:00
  • Can you please provide me with working code? the vertical centering is not working for me with m{3cm} – JohnDizzle Jun 29 '20 at 18:00
  • @JohnDizzle: If you want to ensure your table is as wide as the textwidth, add \usepackage{tabularx} \renewcommand\tabularxcolumn[1]{m{#1}} to your preamble and use \begin{tabularx}{\textwidth}{X|lll}for your table. – leandriis Jun 29 '20 at 18:02