[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#66636: latex: tables don't come out right



"KMH" == Karl M.Hegbloom <karlheg@bittersweet.inetarena.com>

    KMH> Description: The following test document produces the
    KMH> attached .dvi file:
    KMH> 
    KMH> \documentclass{article}
    KMH> 
    KMH> \begin{document}
    KMH> \begin{tabular}{|c|c|c|}
    KMH>   \hline\\
    KMH>   One & Two & Three\\
    KMH>   \hline\\
    KMH>   Four & Five & Six\\
    KMH>   \hline
    KMH> \end{tabular}
    KMH> \end{document}
    KMH> 
    KMH> ... as you can see, the boxes in the table are too tall,
    KMH> and the vertical lines don't reach all the way to the top
    KMH> like they should.

The LaTeX code you provided does exactly what you say.
Unfortunately, that's because your code is wrong -- you have extra
newline commands (\\) inserted after the \hline commands.

What you should type is as follows:

   \documentclass{article}

   \begin{document}
   \begin{tabular}{|c|c|c|}
   \hline
   One & Two & Three\\ \hline
   Four & Five & Six\\ \hline
   \end{tabular}
   \end{document}

Even better, try the following (which gives you a decent-looking
table, similar to the table design recommended by _The Chicago
Manual of Style_):

\documentclass{article}
\usepackage{booktabs}

\begin{document}
\begin{tabular}{ccc}
\toprule
Header 1 & Header 2 & Header 3 \\
\midrule
One      & Two      & Three \\
Four     & Five     & Six \\
\bottomrule
\end{tabular}

\end{document}

   CMC

+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
 Behind the counter a boy with a shaven head stared vacantly into space, 
 a dozen spikes of microsoft protruding from the socket behind his ear.
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
   C.M. Connelly               c@eskimo.com                   SHC, DS
+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+ 



Reply to: