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 am making a table right now and it's really annoying that items in my cell are getting crunched

\begin{center}
\begin{tabular}{|c| c | c|}
Critical Points $P_0$ & $f(P_0)$ & Conclusion \\ 
\hline
(0,0,1)     & 0 & Local Extrema\\ \hline
(0,0,-1)    & -2  & Absolute minimum \\ \hline
$\left ( 0,0,\frac{1}{2} \right ) $ & $\frac{1}{4}$ & Local Extrema \\  \hline

$(0,0, \frac{\sqrt{12}}{5})$ & $\frac{8}{5}$ & Absolute maximum \\ \hline

$(0,0, -\frac{\sqrt{12}}{5})$ & $\frac{8}{5}$ & Absolute maximum \\ 
\end{tabular}
\end{center}

My fractions are getting crushed and there is no such thing as "p{height}" to fix.

share|improve this question
add comment

2 Answers

up vote 11 down vote accepted

Instead of increasing the vertical space for rows, I propose you some changes:

  1. Don't use \frac{a}{b} but simply a/b; this increases readability.
  2. Use the features provided by the booktabs and array packages.
  3. Eliminate the vertical rules.

    \documentclass{article}
    \usepackage{amsmath}
    \usepackage{array}
    \usepackage{booktabs}
    
    \begin{document}
    
    \begin{center}
    \begin{tabular}{*{2}{>{$}c<{$}} c}
    \toprule
    \multicolumn{1}{c}{Critical Points $P_0$} & f(P_0) & Conclusion \\ 
    \cmidrule(r){1-1}\cmidrule(lr){2-2}\cmidrule(l){3-3}
    (0,0,1)     & 0 & Local Extrema\\ 
    (0,0,-1)    & -2  & Absolute minimum \\ 
    (0,0,1/2 )  & 1/4 & Local Extrema \\ 
    (0,0,\sqrt{12}/5) & 8/5 & Absolute maximum \\ 
    (0,0, -\sqrt{12}/5) & 8/5 & Absolute maximum \\ 
    \bottomrule
    \end{tabular}
    \end{center}
    
    \end{document}
    

enter image description here

If, for some reason, using array and booktabs is not possible, my first and third recommendations still apply and you can change \arraystretch; something along these lines:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{center}
\renewcommand\arraystretch{1.2}
\begin{tabular}{c c c}
\hline
Critical Points $P_0$ & $f(P_0)$ & Conclusion \\ 
\hline
$(0,0,1)$     & $0$ & Local Extrema\\ 
$(0,0,-1)$   & $-2$  & Absolute minimum \\ 
$(0,0,1/2 )$  & $1/4$ & Local Extrema \\ 
$(0,0,\sqrt{12}/5)$ & $8/5$ & Absolute maximum \\ 
$(0,0, -\sqrt{12}/5)$ & $8/5$ & Absolute maximum \\ 
\hline
\end{tabular}
\end{center}

\end{document}

enter image description here

share|improve this answer
    
What fi I don't want new packages? My computer can can't so much stuff –  sidht Jun 2 '12 at 22:50
    
@jak please see my updated answer. –  Gonzalo Medina Jun 2 '12 at 22:55
    
Now I am going to be even more annoying and ask is if there are anyway of using \frac{}{} in tables without it getting crushed? –  sidht Jun 2 '12 at 22:56
    
@jak you could use \dfrac instead of \frac (requires amsmath), but I personally don't like the result: \begin{center} \renewcommand\arraystretch{1.4} \begin{tabular}{c c c} \hline Critical Points $P_0$ & $f(P_0)$ & Conclusion \\ \hline (0,0,1) & 0 & Local Extrema\\ (0,0,-1) & -2 & Absolute minimum \\ $\left( 0,0,\dfrac{1}{2} \right) $ & $\dfrac{1}{4}$ & Local Extrema \\ $\left( 0,0, \dfrac{\sqrt{12}}{5} \right)$ & $\dfrac{8}{5}$ & Absolute maximum \$\left( 0,0, -\dfrac{\sqrt{12}}{5} \right)$ & $\dfrac{8}{5}$ & Absolute maximum \\ \hline \end{tabular} \end{center}. –  Gonzalo Medina Jun 2 '12 at 23:03
    
I used \dfrac initally and same thing happened lol –  sidht Jun 2 '12 at 23:11
add comment

The package cellspace offers a simple way to get the correct height:

\documentclass{article}
\usepackage{amsmath}
\usepackage{array}
\usepackage{booktabs}
\usepackage{cellspace}
\addtolength\cellspacetoplimit{3pt}
\addtolength\cellspacebottomlimit{3pt}
\begin{document}

\begin{center}
\begin{tabular}{>{$}c<{$}>{$}Sc<{$}c}
\toprule
\multicolumn{1}{c}{Critical Points $P_0$} & f(P_0) & Conclusion \\ 
\cmidrule(r){1-1}\cmidrule(lr){2-2}\cmidrule(l){3-3}
(0,0,1)     & 0 & Local Extrema\\ 
(0,0,-1)    & -2  & Absolute minimum \\ 
(0,0,1/2 )  & \dfrac14 & Local Extrema \\ 
(0,0,\sqrt{12}/5) & \dfrac85 & Absolute maximum \\ 
(0,0, -\sqrt{12}/5) & \dfrac85 & Absolute maximum \\ 
\bottomrule
\end{tabular}
\end{center}

\end{document}

enter image description here

share|improve this answer
    
That is big.... –  sidht Jun 2 '12 at 23:11
add comment

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.