1

I want to dim (ie, make transparent) certain selected columns of a table when on a slide, so that I can highlight the remaining columns without explicitly drawing attention to them by using colour. Currently I am trying to use the hf-tikz package and opacity option, but somehow I don't see any effect. I used colours to check if the command is actually working -- and it is -- so the issue is that without colour, plain dimming of text seems to have no visible effect. How do I improve this?

\documentclass{beamer}
\mode<presentation>
{
  \setbeamertemplate{navigation symbols}{}
  \setbeamertemplate{caption}[numbered]
}
%%%%%%%%%
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usetikzlibrary{arrows,shapes}
\usetikzlibrary{tikzmark, calc,decorations.pathmorphing,patterns}
\usetikzlibrary{arrows.meta, positioning, quotes}
\usetikzlibrary{matrix,overlay-beamer-styles}

\usepackage{nccmath} 
\usepackage[skins]{tcolorbox}
\tcbuselibrary{raster}
\tcbuselibrary{theorems}
\usepackage{makecell} 
\usepackage{array, booktabs, longtable}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{mathtools}

\newtcbtheorem[]{mylemmma}{Lemma}{colframe=red,colback=white, width=\textwidth, left=0pt}{lem}
\tcbset{colframe=red, colback=white}    
\resetcounteronoverlays{tcb@cnt@mylemmma}


\begin{document}
\section{Proofs}         

\begin{frame}[fragile]
\frametitle{Warmup}
%\setbeamercovered{transparent}%

  \only<1>{\begin{tcolorbox}[hbox, left = 0.1 mm, right=0.1 mm, top = 0.4mm, bottom = 0.4mm, hide=<2->]
Simpler case: blsadf asdf;laskjdf;laksdf;la
\end{tcolorbox}}
\pause 

\begin{table}[htbp]
    \centering
    \begin{tabular}{c c c c c c c c}
%    \begin{tabular}{>{\onslide<1>}c<{\onslide} c c c c c c c}
    \toprule
$a$ & \multicolumn{1}{c}{$b$} & \multicolumn{1}{c}{$c$} & \multicolumn{1}{c}{$d$}  & \multicolumn{1}{c}{$e$}
    & \multicolumn{1}{c}{$f$}
    & \multicolumn{1}{c}{$g$} & \multicolumn{1}{c}{$h$}\\
\midrule
    $x$ & $y$ & $z$ & $\alpha$ & $\beta$ & $\gamma$ & $\mu$ & $\epsilon$\\
        $x$ & $y$ & $z$ & $\alpha$ & $\beta$ & $\gamma$ & $\mu$ & $\epsilon$\\
    \bottomrule
    \end{tabular}
    \caption{Notation}
    \label{TableNotation}
\end{table} 
%
\pause

    \begin{mylemmma}{Our lemma}{lem}
        We have the following bound: 
        \[f(x) \leq g(x) + r(x) + m(x)\]
    \end{mylemmma}

    \pause
    \begin{tcolorbox}[hbox, left = 0.1 mm, right=0.1 mm, top = 0.4mm, bottom = 0.4mm]
Main Idea: $x$ is small enough for Taylor approximation. 
\end{tcolorbox}

\end{frame}
\end{document}

lazulikid
  • 561
  • 1
    As far as I can see it puts the stuff on the background, which is why you cannot see the shading. (Also remove the space in \tikzmarkin<2->[colhl]{c1} $a$.) You could just use the tikzmarknode library instead. –  May 27 '20 at 21:11
  • The tikzmark library seems to be more for things like adding annotations at specific symbols. I do not see a command in the manual that lets me do both 1) connect all elements of a column together, and 2) make them transparent. Was there a specific command using tikzmarknode that you had in mind? Thank you! – lazulikid May 27 '20 at 21:37
  • 1
    I think you can use e.g. https://tex.stackexchange.com/a/341184/194703. The author indicates where you can find her. One may also train collcell to uncover table columns. I would be surprised if no one had done that –  May 27 '20 at 21:40

1 Answers1

1

You can just use beamer tools, see here.

\documentclass{beamer}
\mode<presentation>
{
  \setbeamertemplate{navigation symbols}{}
  \setbeamertemplate{caption}[numbered]
}
%%%%%%%%%
\usepackage{array}
\usepackage{booktabs}

\begin{document}
\section{Proofs}         

%\resetcounteronoverlays{tcb@cnt@mydef}
\begin{frame}[fragile]

  \setbeamercovered{transparent}%

\begin{table}[htbp]
    \centering
    \resizebox{\linewidth}{!}{% Resize table to fit within \linewidth horizontally

    \begin{tabular}{>{\onslide<1>}c<{\onslide} c c c c c c c}
    \toprule
$a$ & \multicolumn{1}{c}{$b$} & \multicolumn{1}{c}{$c$} & \multicolumn{1}{c}{$d$}  & \multicolumn{1}{c}{$e$}
    & \multicolumn{1}{c}{$f$}
    & \multicolumn{1}{c}{$g$} & \multicolumn{1}{c}{$h$}\\
\midrule
    $x$ & $y$ & $z$ & $\alpha$ & $\beta$ & $\gamma$ & $\mu$ & $\epsilon$\\
        $x$ & $y$ & $z$ & $\alpha$ & $\beta$ & $\gamma$ & $\mu$ & $\epsilon$\\
    \bottomrule
    \end{tabular}}

    \caption{Notation}
    \label{TableNotation}
\end{table} 
\pause
\end{frame}
\end{document}

enter image description here

(Off-topic: personally I would not resize the table.)

  • Hm, so when I combined this code with other stuff on my slide, it messed up the other transparencies somehow :( – lazulikid May 27 '20 at 22:16
  • @lazulikid Do you load \usepackage{array}? –  May 27 '20 at 22:29
  • Yes, I do. I need it to write optimization problems nicely aligned columnwise in different rows. – lazulikid May 27 '20 at 22:34
  • 1
    @lazulikid It is very hard for me hard for me to debug this. Can you post the code that causes the problems? (One may also think of employing collcell.) –  May 27 '20 at 22:40
  • Thank you! I edited the original question with the complete code for the slide. There are two lines in it with comments. If you uncomment them and comment out the line \begin{tabular}{c c c c c c c c}, you can see the difference in output. While I don't mind the transparencies created by \setbeamercovered{transparent}, the problem is these transparencies are a bit inconsistent (for example, the table caption and text of the tcolorbox at the bottom of the slide aren't made transparent, so it looks very odd (it looks like an oversight...) – lazulikid May 27 '20 at 23:21
  • 1
    @lazulikid You can control the opacity with commands like \setbeamercovered{transparent=30}, where 30 can be replaced by any value between 0 (invisible) and 100 (fully visible). Likewise, the visibility of tcolorbox can be arranged with the beamer hidden style. I think you only need to synchronize the opacities to get what you want. –  May 27 '20 at 23:33