2

I have a tblr table in which I would like to highlight some cells gradually and for each one, when it is highlighted some related stuff is displayed below the table.

Here in my MWE, I reproduced the entire table for each \only command, each time highlighting what I want to highlight.

What I want is something like this:

  \only<1>{
     \begin {tblr}{colspec={l},cell{1}{1}={fg=purple}}}
  \only<2>{
     \begin {tblr}{colspec={l},cell{2}{1}={fg=purple}}}
  \only<1->{
  \begin {tblr}{colspec={l},cell{3}{1}={fg=purple}}}
     pays d'europe\\
     pays d'asie\\
     pays d'afrique\\
  \end {tblr}

The best would be that tabularray supports this feature.

I have found a solution is another post, but that user uses tabular. I did not get it work for tblr

\documentclass[aspectratio=169,t]{beamer}

\mode<presentation>
\usetheme{moloch}
\usepackage{tabularray,blindtext,tikz}
\UseTblrLibrary{tikz}
\SetTblrInner{rowsep={2pt}}
\newcommand{\titles}[1]{{\centering\bfseries #1\par\vspace{.6em}}}


\newcommand{\purp}[1]{\textcolor{purple}{#1}}
\newcommand{\mage}[1]{\textcolor{magenta}{#1}}

\begin{document}
\begin{frame}{aaa}
  \centering
  
  \only<1>{
    \begin {tblr}{l}
    \purp{pays d'europe}\\
    pays d'asie\\
    pays d'afrique\\
    \end {tblr}
  }
  
    \only<2>{
    \begin {tblr}{l}
    pays d'europe\\
    \purp{pays d'asie}\\
    pays d'afrique\\
    \end {tblr}
    }
    
    \only<3>{
    \begin {tblr}{l}
    pays d'europe\\
    pays d'asie\\
    \purp{pays d'afrique}\\
    \end {tblr}
  }
    \vspace{5\parskip} 

  \only<1>{
    allemagne,france,espagne}
  \only<2>{chine, inde, birmanie}
  \only<3>{mali, cameroun, sénégal}

\end{frame}

\end{document}

1 Answer 1

3

Solution 1:

You don't actually need tabularray to change the text colour, instead you could make your \purp macro overlay aware:

\documentclass[aspectratio=169,t]{beamer}

\usetheme{moloch}
\usepackage{tabularray}
\SetTblrInner{rowsep={2pt}}

\newcommand<>{\purp}[1]{\textcolor#2{purple}{#1}}

\begin{document}
\begin{frame}
\frametitle{aaa}
  \centering

  \begin{tblr}{l}
  \purp<1>{pays d'europe}\\
  \purp<2>{pays d'asie}\\
  \purp<3>{pays d'afrique}\\
  \end{tblr}

  \vfill

  \only<1>{allemagne,france,espagne}
  \only<2>{chine, inde, birmanie}
  \only<3>{mali, cameroun, sénégal}

\end{frame}

\end{document}

enter image description here

Solution 2:

If you need some tabularray-specific features, you could do something like this:

\documentclass[aspectratio=169,t]{beamer}

\usetheme{moloch}
\usepackage{tabularray}
\SetTblrInner{rowsep={2pt}}

\begin{document}
\begin{frame}
\frametitle{aaa}
  \centering
  
  \only<1>{\SetTblrInner{cell{1}{1}={fg=purple}}}
  \only<2>{\SetTblrInner{cell{2}{1}={fg=purple}}}
  \only<3>{\SetTblrInner{cell{3}{1}={fg=purple}}}

  \begin{tblr}{l}
  pays d'europe\\
  pays d'asie\\
  pays d'afrique\\
  \end{tblr}

  \vfill

  \only<1>{allemagne,france,espagne}
  \only<2>{chine, inde, birmanie}
  \only<3>{mali, cameroun, sénégal}

\end{frame}

\end{document}
2
  • could you explain about that \newcommand overlay aware? Commented 23 hours ago
  • 1
    @user1850133 See section "9.6.1 Making Commands and Environments Overlay Specification-Aware" of the beamer user guide Commented 23 hours ago

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.