Sign up ×
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.

Possible Duplicate:
Using \frac within a table

I'm trying to do that within CodeCogs renderer, but it don't work:

\begin{tabular}{cc} \hline \frac{x}{2} & \frac{2}{x} \\ \hline \end{tabular}

How can I fix that? Thank you!

share|improve this question

marked as duplicate by Jake, Loop Space, egreg, TH., Caramdir Jun 20 '11 at 17:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

Fractions and other mathematical matter have to be in math mode: Enclose the \frac{}{} commands in dollar ($) signs to put them in math mode. See also the recent question, of which this seems to be a duplicate. – Jake Jun 20 '11 at 7:54

1 Answer 1

up vote 3 down vote accepted

Use $...$ or the tabular column definition



\begin{tabular}{ c >{\xstrut$}c<{$}} \hline 
 $\frac{x}{2}$ & \frac{2}{x} \\ \hline
 $\dfrac{x}{2}$ & \dfrac{2}{x} \\ \hline 


enter image description here

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.