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.

I need to insert into a table cell a formula that requires the summation sign and I apparently do something wrong and the compiler just throws me back errors and I really don't know how to solve this.

\begin{tabular}{ c || c c c }
\hline 
Linea & Costo & Esecuzioni & Totale \\ \hline                        
1 & $1$ & $1$ & $1$ \\
2 & $n+1$ & $2$ & $2(n+1)$ \\
3 & \begin{equation} \sum_{n=1}\nolimits' C_n \end{equation} & $2$ & $2(n+1)$ \\
\hline  
\end{tabular}
share|improve this question

2 Answers 2

up vote 3 down vote accepted

You cannot use \begin{equation}...\end{equation} inside a table cell. If you want it to look like a displayed equation, you can do this:

3 & \(\displaystyle \sum_{n=1}\nolimits' C_n \) & $2$ & $2(n+1)$ \\

Here, \( ... \) is inline math (more-or-less equivalent to $ ... $), and \displaystyle is self-explanatory: it typesets the equation in the style as it was a displayed math.

share|improve this answer

You can actually put \begin{equation}...\end{equation} in a tabular cell, but you need to box it up first, either using a vbox, minipage, parbox, or something similar.

Whether or not that's a good idea is another issue; if your tabular is floating then it's almost certainly a bad idea (as the numbering might get messed up)

3 & \vbox{\begin{equation} \sum_{n=1}\nolimits' C_n \end{equation}} & $2$ & $2(n+1)$ \\
4 & \parbox{3cm}{\begin{equation} \sum_{n=1}\nolimits' C_n \end{equation}} & $2$ & $2(n+1)$ \\
5 & \begin{minipage}{4cm}\begin{equation} \sum_{n=1}\nolimits' C_n \end{equation}\end{minipage} & $2$ & $2(n+1)$ \\
share|improve this answer
    
how do I know if my tabular is floating? (sorry for this basic question, but I'm a rookie and I'm learning by doing...) –  haunted85 Oct 10 '12 at 16:57
    
@haunted85 if it's in a table environment. have a look at the not so short guide to latex –  cmhughes Oct 10 '12 at 18:25

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.