I would like to know how to highlight rows within a table in beamer
, piecewise, so that when I present the piece, I can originally have no rows highlighted, and then the first, and then both the first and the second, etc.
I have the following table, with the first two rows highlighted:
\begin{frame}
\begin{table}
\begin{center}
\begin{tabular}{lcc|ccc}
\multicolumn{6}{c}{Effect of Mandate on Fertility by Age: Employed Individuals} \\ \hline \hline
& (1) & (2) & (3) & (4) & (5) \\
& Has Child & Has Child LT 5 & Has Child LT 5 & Has Child LT 5 & Has Child LT 5 \\
VARIABLES & All & All & No HS Degree & HS or College & Masters or More \\ \hline
& & & & & \\
\rowcolor{LRed} Married Women 18-20*& -0.11 & -0.08* & -0.21*** & -0.00 & 0.00 \\
\rowcolor{LRed} After*Treatment State & [0.071] & [0.045] & [0.069] & [0.055] & [0.000] \\
& & & & & \\
\rowcolor{LRed} Married Women 20-25*& -0.07*** & -0.07*** & -0.04 & -0.08*** & -0.38* \\
\rowcolor{LRed} After*Treatment State & [0.023] & [0.015] & [0.036] & [0.016] & [0.215] \\
& & & & & \\
Married Women 25-30*& -0.00 & 0.03** & 0.19*** & 0.01 & 0.11* \\
After*Treatment State & [0.019] & [0.012] & [0.032] & [0.014] & [0.058] \\
& & & & & \\
Married Women 30-35*& 0.01 & -0.01 & -0.09*** & -0.01 & 0.12** \\
After*Treatment State & [0.020] & [0.012] & [0.029] & [0.014] & [0.051] \\
& & & & & \\
Married Women 35-40*& -0.01 & -0.02** & -0.07*** & -0.03* & 0.10* \\
After*Treatment State & [0.019] & [0.012] & [0.026] & [0.014] & [0.053] \\
& & & & & \\
Observations & 152,366 & 152,366 & 34,081 & 110,324 & 7,961 \\
R-squared & 0.38 & 0.24 & 0.28 & 0.24 & 0.17 \\
Mean of Dependant Variable & 0.48 & 0.09 & 0.07 & 0.10 & 0.08 \\ \hline \hline
\multicolumn{6}{c}{ Standard errors in brackets} \\
\multicolumn{6}{c}{ *** p$<$0.01, ** p$<$0.05, * p$<$0.1} \\
\end{tabular}
}
\end{center}
\end{table}
\end{frame}
Best Answer
The solution linked in the comments is the most appropriate, but one might also use the
hf-tikz
package (with a bit of abstraction as it's not the main purpose of the package).A possible implementation:
The result:
A remark: the
\resizebox
has been adopted as the table does not fit the frame. It comes fromgraphicx
, a package automatically loaded by Beamer, so no need of load it explicitly.