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 have been using online latex editor for generating equations for my blog. I am kind of novice to Latex. Now I want to generate a table for the first time. But when I try to write a greek letter into a table cell I get invalid equation error.

A sample code is:

\begin{tabular}{|l|c|r|} 
\hline
2 & \alpha & 4 \\
\hline
\end{tabular}

This \alpha generates the "invalid equation" error, I want a greek alpha letter there.

Sorry if it is too simple but after half an hour I am still stuck. Thanks in advance...

share|improve this question

migrated from stackoverflow.com Jul 16 '12 at 8:39

This question came from our site for professional and enthusiast programmers.

    
Welcome to TeX.sx! Your answer was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or edit your answer. –  Martin Schröder Jul 17 '12 at 6:33

1 Answer 1

Table cells are not in math mode. You need to add a math environment around mathematical contents. Try this:

\begin{tabular}{|l|c|r|}
\hline
$2$ & $\alpha$ & $4$ \\
\hline
\end{tabular}
share|improve this answer
    
I've just tried this with your online editor, but it seems that the language it recognizes is restricted. (This would work with a standard latex compiler). –  Stéphane Gimenez Jul 14 '12 at 16:27
    
still doesn't work, I suppose it is something related with the site or something? –  Dogan_79 Jul 14 '12 at 16:29
4  
@Dogan_79: The site you linked to is an equation editor, so if you surround the table with `$\begin{tabular}...\end{tabular}$, this solution generats the desired table. –  Peter Grill Jul 14 '12 at 18:22
    
thank you peter, this works –  Dogan_79 Jul 14 '12 at 23:04
3  
@PeterGrill: If it's an equation, array would be better than tabular. –  Martin Schröder Jul 16 '12 at 8:14

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.