TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 tex.stackexchange.com/questions/21049/using-frac-within-a-table, of which this seems to be a duplicate. – Jake Jun 20 '11 at 7:54
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.