Graphics, Figures & TablesTable generating an error, please help!

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
gammapoint
Posts: 11
Joined: Fri Jul 24, 2009 11:07 pm

Table generating an error, please help!

Post by gammapoint »

Hello, I'm trying to submit a paper to a journal but I can't until the latex runs without any errors (even if the output is shown to be the way that I want it anyway). But I'm not sure what's technically wrong with my syntax, could someone please help? I'd be SOOOO grateful :)

This is my latex code:

Code: Select all

\begin{table*}
\label{Table I}
\caption{This is my caption}
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill}}l c c c c }
\hline
& \multicolumn{2}{c}{E_i \; \text{(eV)}} & \multicolumn{2}{c}{E_d \; \text{(eV)}}\\
\cline{2-3}  \cline{4-5}  
&  Ref. [1] & Present Work & Ref. [1] & Present Work\\ 
\hline
Numbers1  & 0.10 & 0.15 & 0.25 & 0.32\\
Numbers2  & 0.47 & 0.86 & 0.74 & 1.07 \\
\hline
\end{tabular*}
\end{table*}
The errors that I'm seeing are the following:

Code: Select all

                $
l.79 & \multicolumn{2}{c}{E_i \; \text{(eV)}}
                                              & \multicolumn{2}{c}{E_d \; \t...

! Extra }, or forgotten $.
\@preamble ...ignorespaces \@sharp \unskip \hfil }
                                                  \hskip \tabrightsep \relax 
l.79 & \multicolumn{2}{c}{E_i \; \text{(eV)}}
                                              & \multicolumn{2}{c}{E_d \; \t...

! Missing $ inserted.
<inserted text> 
                $
l.79 & \multicolumn{2}{c}{E_i \; \text{(eV)}}
                                              & \multicolumn{2}{c}{E_d \; \t...

! Missing } inserted.
<inserted text> 
                }
l.79 & \multicolumn{2}{c}{E_i \; \text{(eV)}}
                                              & \multicolumn{2}{c}{E_d \; \t...

! Missing $ inserted.
<inserted text> 
                $
l.79 ...} & \multicolumn{2}{c}{E_d \; \text{(eV)}}
                                                  \\
! Extra }, or forgotten $.
\@preamble ...ignorespaces \@sharp \unskip \hfil }
                                                  \hskip \tabrightsep \relax 
l.79 ...} & \multicolumn{2}{c}{E_d \; \text{(eV)}}
                                                  \\
! Missing $ inserted.
<inserted text> 
                $
l.79 ...} & \multicolumn{2}{c}{E_d \; \text{(eV)}}
                                                  \\
! Missing } inserted.
<inserted text> 
                }
l.79 ...} & \multicolumn{2}{c}{E_d \; \text{(eV)}}
                                                  \\

Recommended reading 2024:

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

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

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

Table generating an error, please help!

Post by Stefan Kottwitz »

Hi,

use the math mode inside the table. With this correction I could compile this table:

Code: Select all

& \multicolumn{2}{c}{$E_i \; \text{(eV)}$} &
 \multicolumn{2}{c}{$E_d \; \text{(eV)}$}
Stefan
LaTeX.org admin
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Table generating an error, please help!

Post by frabjous »

You're using mathmode commants, namely \text{...} and _ outside of math mode.

You could try:

Code: Select all

\begin{table*}
\label{Table I}
\caption{This is my caption}
\begin{tabular*}{0.75\textwidth}{@{\extracolsep{\fill}}l c c c c }
\hline
& \multicolumn{2}{c}{$E_i \; \text{(eV)}$} & \multicolumn{2}{c}{$E_d \; \text{(eV)}$}\\
\cline{2-3}  \cline{4-5} 
&  Ref. [1] & Present Work & Ref. [1] & Present Work\\
\hline
Numbers1  & 0.10 & 0.15 & 0.25 & 0.32\\
Numbers2  & 0.47 & 0.86 & 0.74 & 1.07 \\
\hline
\end{tabular*}
\end{table*}
I think there are probably other things that could be cleaned up to, but those are what's causing the errors, I believe.

EDIT: Argh, Stefan beat me to it.
Last edited by frabjous on Fri Jul 24, 2009 11:50 pm, edited 1 time in total.
gammapoint
Posts: 11
Joined: Fri Jul 24, 2009 11:07 pm

Re: Table generating an error, please help!

Post by gammapoint »

Omg thanks so much! I should have known to do that due to the subscript but just wasn't thinking I guess. I'd make you coauthor of the paper I'm about to submit but if I did I think my advisor would be pissed :)
Post Reply