3

I have a large table in which many of the cells have free-flowing text in paragraph form. Rather than use \midrule's to help the reader delineate between rows, I'm trying to compress the text line spacing within a table row and inject a bit of extra spacing between table rows. I use the spacing environment (let me know if I'm abusing that term) to compress the line spacing. Then I use the \rule command to create a zero width box character in the 1st cell of each table row in order to give it enough distance from the table row above. However, even with the \rule command commented out (below), I'm finding an inexplicably lot of space between rows. Can anyone point out where this is coming from? Here is my MWE, which I compile with one invocation of "pdflatex tmp.tex":

\documentclass{article}

\usepackage{booktabs}
\usepackage{array}
\usepackage{setspace}

\begin{document}
\begin{tabular}{
   >{\raggedright\begin{spacing}{0.75}}p{1.5in}<{\end{spacing}}
   >{\raggedright\begin{spacing}{0.75}}p{0.45in}<{\end{spacing}}
}
   \toprule
      World domination scheme
      &
      Linear, either +ve
   \tabularnewline\midrule
      Sum over in subtree, including multiple instances
      &
      1.8\
   \tabularnewline%\rule{0pt}{0.2in}%
      Sum over nothing in subtree, including multiple instances blah
      dee blah
      &
      3.6
   \tabularnewline%\rule{0pt}{0.2in}%
      Sum over adfasd in subtree, including multiple adfads asdf asdf 
      &
      8.4
   \tabularnewline
   \bottomrule
\end{tabular}
\end{document}
4

The space comes from the spacing environment you use in your columns. Instead of adding it there, you could enclose the whole tabular in it:

\documentclass{article}
\usepackage{booktabs}
\usepackage{array}
\usepackage{setspace}

\begin{document}
\begin{spacing}{0.75}
\begin{tabular}{
   >{\raggedright}p{1.5in}
   >{\raggedright}p{0.45in}
}
   \toprule
      World domination scheme
      &
      Linear, either +ve
   \tabularnewline\midrule
      Sum over in subtree, including multiple instances
      &
      1.8\
   \tabularnewline\rule{0pt}{0.2in}%
      Sum over nothing in subtree, including multiple instances blah
      dee blah
      &
      3.6
   \tabularnewline\rule{0pt}{0.2in}%
      Sum over adfasd in subtree, including multiple adfads asdf asdf 
      &
      8.4
   \tabularnewline
   \bottomrule
\end{tabular}
\end{spacing}
\end{document}

enter image description here

2

If you want to stick to your approach, use \setstretch instead of spacing environment like:

\begin{tabular}[t]{
   >{\raggedright\setstretch{0.75}}p{1.5in}
   >{\raggedright\setstretch{0.75}}p{0.45in}
}

Here is a comparison of both the methods. Right side tabular uses \setstretch

\documentclass{article}

\usepackage{booktabs}
\usepackage{array}
\usepackage{setspace}

\begin{document}
\begin{tabular}[t]{
   >{\raggedright\begin{spacing}{0.75}}p{1.5in}<{\end{spacing}}
   >{\raggedright\begin{spacing}{0.75}}p{0.45in}<{\end{spacing}}
}
   \toprule
      World domination scheme
      &
      Linear, either +ve
   \tabularnewline\midrule
      Sum over in subtree, including multiple instances
      &
      1.8\
   \tabularnewline%\rule{0pt}{0.2in}%
      Sum over nothing in subtree, including multiple instances blah
      dee blah
      &
      3.6
   \tabularnewline%\rule{0pt}{0.2in}%
      Sum over adfasd in subtree, including multiple adfads asdf asdf
      &
      8.4
   \tabularnewline
   \bottomrule
\end{tabular}
\begin{tabular}[t]{
   >{\raggedright\setstretch{0.75}}p{1.5in}
   >{\raggedright\setstretch{0.75}}p{0.45in}
}
   \toprule
      World domination scheme
      &
      Linear, either +ve
   \tabularnewline\midrule
      Sum over in subtree, including multiple instances
      &
      1.8\
   \tabularnewline%\rule{0pt}{0.2in}%
      Sum over nothing in subtree, including multiple instances blah
      dee blah
      &
      3.6
   \tabularnewline%\rule{0pt}{0.2in}%
      Sum over adfasd in subtree, including multiple adfads asdf asdf
      &
      8.4
   \tabularnewline
   \bottomrule
\end{tabular}
\end{document}

enter image description here

  • Thank you. This is a nice alternative...not quite enough space (probably because the inter-line spacing affects inter-row spacing, but I'm just guessing), but it does have the benefit of cleaning up the LaTeX code in the body of the table. – user36800 Oct 15 '15 at 16:19
  • Drat...it doesn't look like it is possible to designate 2 answers as the answer. – user36800 Oct 15 '15 at 18:46

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.