I would like to do something similar to How Do I Highlight Table Rows in beamer, Piecewise?
But instead of only highlighting complete rows, I want to highlight arbitrary subsets of the table.
I added the code of the original question as well as the output. Which changes would have to be done to e.g. highlight the first 2 columns of the first 2 data rows in a contiguous block?
Additionally the code leads to the highlighted rows being indented, which I would like to avoid.
\documentclass{beamer}
\usepackage{lmodern}
\usepackage[beamer,customcolors]{hf-tikz}
\tikzset{hl/.style={
set fill color=red!80!black!40,
set border color=red!80!black,
},
}
\begin{document}
\begin{frame}{Title}
\begin{center}
\resizebox{\textwidth}{!}{
\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
& & & & & \\
\tikzmarkin<2->[hl]{a} Married Women 18-20*& -0.11 & -0.08* & -0.21*** & -0.00 & 0.00 \\
After*Treatment State & [0.071] & [0.045] & [0.069] & [0.055] & [0.000] \tikzmarkend{a} \\
& & & & & \\
\tikzmarkin<3->[hl]{b} Married Women 20-25*& -0.07*** & -0.07*** & -0.04 & -0.08*** & -0.38* \\
After*Treatment State & [0.023] & [0.015] & [0.036] & [0.016] & [0.215] \tikzmarkend{b} \\
& & & & & \\
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{frame}
\end{document}

\tikzmarkinand correspondingtikzmarkendat the opposite corners of the desired area. This means,tikzmarkinbefore the top left element andtikzmarkendafter the bottom right one. – Ignasi Dec 14 '16 at 11:50cfr'spatch tohf-tikz– Ignasi Dec 14 '16 at 15:53\matrixit will mark the positions for you automatically. – Symbol 1 Dec 15 '16 at 18:38