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.
\begin{table}
    \begin{tabular}{|c|c|c|c|c|}
    \hline
    \multicolumn{5}{|c|}{\textbf{Table 1:}Unfiltered Water}\\
    Concentration of analyte in sample   & Avg & Std Dev &  RSD & 90\% CI \\ 
    \hline
    Total hardness (ppm $CaCo_3$ equiv)  & 97  &    2   &  2\%  & \pm 5   \\
    Calcium hardness (ppm $Ca^{2+}$)     & 57  &    3   &  5\%  &  \pm 5   \\
    Magnesium hardness( ppm $Mg^{2+}$)   & 40  &    3   & 7.5\% &  \pm 5 \\
    \hline
    \end{tabular}

This table is giving me an error. That says

! Missing $ inserted.
<inserted text>
$
l.41 ...Co_3 equiv\) & 97 & 2 & 2\% & \pm
5 \\

I've inserted a begin-math/end-math symbol since I think you left one out. Proceed, with fingers crossed.

What is the cause of this error? I can't seem to find any thing that is mismatched.

share|improve this question
3  
\pm requires math mode, that's all. Since tabular sets its contents in text mode, it causes an error, and you have to switch manually using $\pm$. It's better to use \pm 5 though. –  Werner Oct 6 '13 at 23:21
    
You also should say CaCO$_3$ or use a specialized package for inputting chemical formulas such as mhchem or bpchem. –  egreg Oct 6 '13 at 23:26
    
I have tried to use mhchem in Texmaker, but the package is not there. Is there an easy way to install packages? Is there a package manager for Texmaker? –  olliepower Oct 6 '13 at 23:41
    
@Werner I agree \pm 5 is better. But is there a way to input it, with out generating an error? –  olliepower Oct 6 '13 at 23:43
2  
Why do you write "Table 1" in the table? You can use the \caption{} command for automatic numbering! Details for this can be found in every basic latex tutorial dealing with floating environments such as figure or table –  Martin H Oct 6 '13 at 23:46

1 Answer 1

up vote 7 down vote accepted

The use of \pm requires math-mode, so you should use $\pm 5$.

Here is a full alternative view on your table using booktabs (for pizzaz...), caption (for caption formatting) and mhchem (for Chemistry formula setting):

enter image description here

\documentclass{article}
\usepackage{booktabs,caption,mhchem}
\captionsetup{labelfont=bf, textfont=normalfont}
\begin{document}
\begin{table}
  \caption{Unfiltered water}
  \begin{tabular}{*{5}{c}}
    \toprule
    Concentration of analyte in sample   & Avg & Std Dev &  RSD             &  90\% CI \\ 
    \midrule
    Total hardness (ppm \ce{CaCo_3} equiv)  & 97  &    2    &  \phantom{0.}2\% & $\pm 5$  \\
    Calcium hardness (ppm \ce{Ca^{2+}})     & 57  &    3    &  \phantom{0.}5\% & $\pm 5$  \\
    Magnesium hardness (ppm \ce{Mg^{2+}})   & 40  &    3    &            7.5\% & $\pm 5$  \\
    \bottomrule
  \end{tabular}
\end{table}

\end{document}

Original:

enter image description here

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.