GeneralExtra lines in table

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
ijc
Posts: 25
Joined: Mon Feb 04, 2008 4:26 pm

Extra lines in table

Post by ijc »

I'm having a bit of bother with a simple table. I currently have two extra vertical lines coming down from the first column. I felt it was due to the second \\ I use, but if I take that out it errors on the second \hline.

Code: Select all

\begin{table}
\centering
\caption{....}
\begin{tabular}{ |r|c|c|c|c|c|c|c|c|c|c|c|c| }
\hline
Note & G & A ... & A'\\
\hline
Frequency (Hz) & 449 & 460 ... & 915\\  
\hline
\label{....}
\end{tabular}
\end{table}

Thanks in advance for your help,

ijc

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

ijc
Posts: 25
Joined: Mon Feb 04, 2008 4:26 pm

Re: Extra lines in table

Post by ijc »

Also, is there an easy way to get the caption at the bottom of the table, when I previously tried it, it always error'ed for some reason or another, putting it at the top seemed like the only way to make it stop.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Extra lines in table

Post by localghost »

Code: Select all

\begin{table}[!ht]
  \centering
  \begin{tabular}{|r|*{12}{c|} \hline
    Note & G & A ... & A' \\ \hline
    Frequency (Hz) & 449 & 460 ... & 915 \\ \hline
  \end{tabular}
  \caption{A Table}\label{tab:table}
\end{table}
The code of your table seems to be correct. So, you might provide a minimal working example (MWE) that shows the undesired behaviour and add the result as a PDF file in the attachment.
ijc wrote:Also, is there an easy way to get the caption at the bottom of the table, when I previously tried it, it always error'ed for some reason or another, putting it at the top seemed like the only way to make it stop.
Modify the code as shown above and everything should work fine. The most important thing is to insert \caption before \label.


MfG
Thorsten¹
ijc
Posts: 25
Joined: Mon Feb 04, 2008 4:26 pm

Extra lines in table

Post by ijc »

Code: Select all

\begin{table}
\centering
\begin{tabular}{ |r|c|c|c|c|c|c|c|c|c| }
\hline
Note & G & A & B & C & D & E & F & G' & A'\\
\hline
Frequency (Hz) & 449 & 460 & 514 & 573 & 618 & 690 & 766 & 826 & 915\\
\hline
\label{tbl:pipechanterfreq}
\end{tabular}
\caption{This table shows the scale of a pipe chanter}
\end{table}

The caption on the bottom works fine - I think it's because before I didn't have the overall table tag, just the tabular ones when I tried it.

You can see in the attached image the extra lines there are...

Thanks for your help,

ijc
Attachments
table.jpg
table.jpg (16.21 KiB) Viewed 5703 times
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Extra lines in table

Post by localghost »

As I wrote in my last post, you have to take my example as provided. The \label command is not allowed inside the tabular environment and has to be put behind the \caption command. For some documentation about LaTeX basics refer to lshort and l2tabu.
Post Reply