Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

The problem is that the table is not closing from above. Secondary problem (which I don't really care) is that a vertical line is replicated.

Here is the code:

\resizebox{\linewidth}{!}{
$\displaystyle
\begin{tabular}{|l|l|l|l|l||l|l|l|}
\multicolumn{8}{|c|}{CGAL statistics} \\
\hline
tree & N & dim & nodes & depth & brute & cgal & speedup \\
\hline
\multirow{1}{*}{5e-06} & 150 & 20 & 69 & 9 & 0.000008 & 0.00006 & 0.14\\
\hline
\multirow{1}{*}{1.1e-05} & 150 & 30 & 68 & 9 & 0.00001 & 0.00006 & 0.16\\
\hline
\multirow{1}{*}{1.2e-05} & 150 & 50 & 68 & 9 & 0.00001 & 0.00008 & 0.13\\
\hline
\end{tabular}
$}

Outcome: enter image description here

share|improve this question
2  
Welcome to TeX.SE! You're tabular environment is missing an \hline instruction immediately after \begin{tabular}{|l|l|l|l|l||l|l|l|}. –  Mico Aug 22 at 19:28
    
Add an \hline command at the beginning of the table. But you can as well let it open, if you suppress the vertical lines in the first row. –  Bernard Aug 22 at 19:30
    
$\displaystyle and the trailing $ are useless; add % after the open brace \resizebox{\linewidth}{!}{% and after \end{tabular} (or put the closing brace just after it). Are you sure you need to resize the table? –  egreg Aug 22 at 19:33
    
Thanks for the welcoming! :) You were right about \hline. You could answer the question so that I can accept this as an answer. @egreg not really, but it seems nice as it is. I did the % thing you said, but I just noticed a small difference in the size. However, the problem is solved now! :) –  G. Samaras Aug 22 at 19:49
1  
It's never a good idea to do \resizebox{\linewidth}{!}{\begin{tabular}{.. it just generates inconsistent font sizes through the document, just choose a suitable font size such as \small and stick to it. –  David Carlisle Aug 22 at 21:48

1 Answer 1

up vote 5 down vote accepted

As noted in the comments, you need an \hline instruction to tell LaTeX to draw a full-width horizontal line.

Rather than create a table with lots and lots of vertical lines and quite a few horizontal lines, consider setting up a table with no vertical lines and just a few, but well-spaced horizontal lines. For that, use the macros \toprule, \midrule, and bottomrule of the booktabs package. Next, since some of the columns could benefit from extra formatting, consider loading the siunitx package and its S column type. And, if you want the table to span the full width of the text block, consider using a tabular* environment instead of resizing the tabular using \resizebox and getting a noticeably larger font size for the material inside the table. Finally, since the \multirow directives don't do anything, you should omit them entirely. The result of these suggestions is shown below.

enter image description here

\documentclass[12pt]{article}
\usepackage{graphicx,multirow}
\usepackage{siunitx,booktabs} % new
\sisetup{group-digits=false,tight-spacing=true} % new
\begin{document}
original form (with \verb+\hline+ added):

\bigskip\noindent
\resizebox{\linewidth}{!}{%
\begin{tabular}{|l|l|l|l|l||l|l|l|}
\hline
\multicolumn{8}{|c|}{CGAL statistics} \\
\hline
tree & N & dim & nodes & depth & brute & cgal & speedup \\
\hline
\multirow{1}{*}{5e-06} & 150 & 20 & 69 & 9 & 0.000008 & 0.00006 & 0.14\\
\hline
\multirow{1}{*}{1.1e-05} & 150 & 30 & 68 & 9 & 0.00001 & 0.00006 & 0.16\\
\hline
\multirow{1}{*}{1.2e-05} & 150 & 50 & 68 & 9 & 0.00001 & 0.00008 & 0.13\\
\hline
\end{tabular}}

\bigskip\bigskip
suggested alternative form:

\medskip
\noindent
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
   S[table-format=1.1e2] 
   cccc 
   S[table-format=1.6] 
   S[table-format=1.5] 
   c @{}}
\toprule
\multicolumn{8}{c}{CGAL statistics} \\
{tree} & N & dim & nodes & depth & {brute} & {cgal} & speedup \\
\midrule
5e-06 & 150 & 20 & 69 & 9 & 0.000008 & 0.00006 & 0.14\\
1.1e-05 & 150 & 30 & 68 & 9 & 0.00001 & 0.00006 & 0.16\\
1.2e-05 & 150 & 50 & 68 & 9 & 0.00001 & 0.00008 & 0.13\\
\bottomrule
\end{tabular*}
\end{document} 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.