# In a Latex Table, how can I automatically resize cell heights to account for superscripts?

I have the following table created using the H command from the float package. The main problem below is that the exponents are too close to the top of the cell. Is there a way to increase the cell-height automatically? Thank you for any suggestions.

\usepackage(float)
\begin{table}[H]
\centering
\begin{tabular}{|c|c|c|}
\hline
& Compute on $X^A$ & Compute on $(X^A, X^B)$  \\
\hline
Estimate on $X^A$ & Correct & Incorrect \\
Estimate on $(X^A, X^B)$ & Correct & Incorrect \\
\hline
\end{tabular}
\end{table} The cellspace package is here for that! You can define minimal vertical spacing at the top and bottom of cells in columns with specifier prefixed with the letter S (or C if you load siunitx, as this package already defines an S column type). Demo:

\documentclass{article}
%\usepackage{array}
\usepackage{float}
\usepackage{cellspace}
\setlength\cellspacetoplimit{4pt}
\setlength\cellspacebottomlimit{3pt}

\begin{document}

\begin{table}[H]
\centering
\begin{tabular}{|Sc|Sc|Sc|}
\hline
& Compute on $X^A$ & Compute on $(X^A, X^B)$ \\
\hline
Estimate on $X^A$ & Correct & Incorrect \\
Estimate on $(X^A, X^B)$ & Correct & Incorrect \\
\hline
\end{tabular}
\end{table}

\end{document} alternatively, with makecell package :-)

\documentclass{article}
\usepackage{makecell}
\setcellgapes{4pt}

\begin{document}
\begin{table}[htb]
\centering
\makegapedcells
\begin{tabular}{|c|c|c|}
\hline
& Compute on $X^A$  & Compute on $(X^A, X^B)$ \\
\hline
Estimate on $X^A$
& Correct           & Incorrect \\
Estimate on $(X^A, X^B)$
& Correct           & Incorrect \\
\hline
\end{tabular}
\end{table}
\end{document} Alternatively, you can use array and the commands \arraystretch and \extrarowheight, which give perfect result here:

\documentclass{article}
\usepackage{float, array}

\begin{document}

\begin{table}[H]

\renewcommand{\arraystretch}{1.3}
\setlength{\extrarowheight}{1pt}
\centering
\begin{tabular}{|c|c|c|}
\hline
& Compute on $X^A$ & Compute on $(X^A, X^B)$  \\
\hline
Estimate on $X^A$ & Correct & Incorrect \\
Estimate on $(X^A, X^B)$ & Correct & Incorrect \\
\hline
\end{tabular}
\end{table}
\end{document} 