3

The entries in cells need to appear one by one and at the same time content (entire row) in the reference table no. 1 needs to be struck through.

%\documentclass[aspectratio=169, handout]{beamer}
\documentclass[aspectratio=169]{beamer}                 % Document class
\usepackage{subcaption}
\usepackage[english]{babel}             % Set language
\usepackage[utf8x]{inputenc}            % Set encoding
\usepackage{nicematrix,tikz}
\mode<presentation>                     % Set options
{
  \usetheme{default}                    % Set theme
  \usecolortheme{rose}              % Set colors
  \usefonttheme{default}                % Set font theme
  \setbeamertemplate{caption}[numbered] % Set caption to be numbered

} \usepackage{tabularx} \usepackage{graphicx} % For including figures \usepackage{booktabs, caption} % For table rules \usepackage{hyperref} % For cross-referencing \usepackage{fontawesome} \usepackage{charter} % serif \usepackage{xcolor} \usepackage{colortbl} \usepackage{pdflscape,array,booktabs} \usepackage[font=scriptsize]{caption} \begin{document}

\setbeamertemplate{frametitle}[default][center]

\begin{frame} \begin{itemize}[<+|+->] \small \item[] \tiny{\begin{table} \caption{Feeding table} \begin{tabular}{ c | c | c } \toprule Task & Time &Positional weight\ \midrule 1 & 12 &70 \ 2 & 6 &58 \ 3 & 6 &31\ 4 & 2 &27 \ 5 & 2 & 20\ 6 & 12 & 29 \ 7 & 7 & 25\ 8 & 5 & 18\ 9 & 1 &18 \ 10 & 4 &17 \ 11 & 6&13 \ 12 & 7 &7 \ \bottomrule \end{tabular} \end{table} } \item Method: \item From the available tasks, choose the task for which the sum of following task times is the longest. \vspace*{-0.2cm} \item[] \begin{table} \caption{Data picked up from feeding table} \centering \tiny \begin{tabular}{l | m{1cm} | m{1cm} | m{1cm} | m{1cm} | m{1cm} | m{1cm}} \toprule Station & 1 & 2 & 3 & 4 & 5 & 6 \ \midrule Tasks &\onslide<5->{1} &\onslide<6->{2,3,4} & \onslide<7->{6,5,9}& \onslide<8->{7,8} & \onslide<9->{10,11} & \onslide<10->{12} \ \bottomrule \end{tabular} \end{table} \end{itemize}
\end{frame} \end{document}

enter image description here

For the table number 2 in the row marked Tasks, the tasks number are picked up from the table number 1. As the task numbers get picked, the corresponding entry (entire row) in the table number 1 needs to be striked through. Also, for the cells which are having multiple task numbers the entries need to appear one by one. For example: \onslide<6->{2,3,4}, the content should appear one by one, first 2, then 3, and 4. How to do this simultaneous striking through in the table 1 (entire row) as tasks get filled in table 2 from table 1?

Ingmar
  • 6,690
  • 5
  • 26
  • 47
mathslove
  • 141

2 Answers2

4

You could use the trick from https://tex.stackexchange.com/a/265728/36296 to strike through rows in your table:

%\documentclass[aspectratio=169, handout]{beamer}
\documentclass[aspectratio=169]{beamer}                 % Document class
\usepackage{subcaption}
\usepackage[english]{babel}             % Set language
%\usepackage[utf8x]{inputenc}            % Set encoding
\usepackage{nicematrix,tikz}
\mode<presentation>                     % Set options
{
  \usetheme{default}                    % Set theme
  \usecolortheme{rose}              % Set colors
  \usefonttheme{default}                % Set font theme
  \setbeamertemplate{caption}[numbered] % Set caption to be numbered

} \usepackage{tabularx} %\usepackage{graphicx} % For including figures \usepackage{booktabs, caption} % For table rules %\usepackage{hyperref} % For cross-referencing \usepackage{fontawesome} \usepackage{charter} % serif %\usepackage{xcolor} \usepackage{colortbl} \usepackage{pdflscape,array,booktabs} \usepackage[font=scriptsize]{caption}

\usepackage{tikz} \usetikzlibrary{tikzmark}

\begin{document}

\setbeamertemplate{frametitle}[default][center]

\begin{frame} \begin{itemize}[<+|+->] \small \item[] \begin{table} \tiny \caption{Feeding table} \begin{tabular}{ c | c | c } \toprule Task & Time &Positional weight\ \midrule \tikzmark{1-start}1 & 12 &70 \tikzmark{1-stop} \ \tikzmark{2-start}2 & 6 &58 \tikzmark{2-stop}\ \tikzmark{3-start}3 & 6 &31 \tikzmark{3-stop}\ \tikzmark{4-start}4 & 2 &27 \tikzmark{4-stop}\ \tikzmark{5-start}5 & 2 & 20 \tikzmark{5-stop}\ \tikzmark{6-start}6 & 12 & 29 \tikzmark{6-stop}\ \tikzmark{7-start}7 & 7 & 25 \tikzmark{7-stop}\ \tikzmark{8-start}8 & 5 & 18 \tikzmark{8-stop}\ \tikzmark{9-start}9 & 1 &18 \tikzmark{9-stop}\ \tikzmark{10-start}10 & 4 &17 \tikzmark{10-stop}\ \tikzmark{11-start}11 & 6&13 \tikzmark{11-stop}\ \tikzmark{12-start}12 & 7 &7 \tikzmark{12-stop}\ \bottomrule \end{tabular} \end{table} \item Method: \item From the available tasks, choose the task for which the sum of following task times is the longest. \vspace*{-0.2cm} \item[] \begin{table} \caption{Data picked up from feeding table} \centering \tiny \begin{tabular}{l | m{1cm} | m{1cm} | m{1cm} | m{1cm} | m{1cm} | m{1cm}} \toprule Station & 1 & 2 & 3 & 4 & 5 & 6 \ \midrule Tasks &\uncover<+->{1} &\uncover<+->{2}\uncover<+->{,3}\uncover<+->{,4} & \uncover<+->{6}\uncover<+->{,5}\uncover<+->{,9}& \uncover<+->{7}\uncover<+->{,8} & \uncover<+->{10}\uncover<+->{,11} & \uncover<+->{12} \ \bottomrule \end{tabular} \end{table} \end{itemize}
\begin{tikzpicture}[remember picture,overlay] \draw<5-> ([yshift=.2em]pic cs:1-start) -- ([yshift=.2em]pic cs:1-stop); \draw<6-> ([yshift=.2em]pic cs:2-start) -- ([yshift=.2em]pic cs:2-stop); \draw<7-> ([yshift=.2em]pic cs:3-start) -- ([yshift=.2em]pic cs:3-stop); \draw<8-> ([yshift=.2em]pic cs:4-start) -- ([yshift=.2em]pic cs:4-stop); \draw<9-> ([yshift=.2em]pic cs:6-start) -- ([yshift=.2em]pic cs:6-stop);
\draw<10-> ([yshift=.2em]pic cs:5-start) -- ([yshift=.2em]pic cs:5-stop); \draw<11-> ([yshift=.2em]pic cs:9-start) -- ([yshift=.2em]pic cs:9-stop);
\draw<12-> ([yshift=.2em]pic cs:7-start) -- ([yshift=.2em]pic cs:7-stop); \draw<13-> ([yshift=.2em]pic cs:8-start) -- ([yshift=.2em]pic cs:8-stop); \draw<14-> ([yshift=.2em]pic cs:10-start) -- ([yshift=.2em]pic cs:10-stop); \draw<15-> ([yshift=.2em]pic cs:11-start) -- ([yshift=.2em]pic cs:11-stop); \draw<16-> ([yshift=.2em]pic cs:12-start) -- ([yshift=.2em]pic cs:12-stop);
\end{tikzpicture}
\end{frame} \end{document}

enter image description here

2

Here is a solution with nicematrix. You need several compilations (because of the PGF/Tikz nodes constructed by nicematrix).

\documentclass[aspectratio=169]{beamer}            
\usepackage[english]{babel}

\mode<presentation>
{ \usetheme{default}
\usecolortheme{rose}
\usefonttheme{default}
\setbeamertemplate{caption}[numbered]

}

\usepackage{fontawesome} \usepackage{charter} \usepackage{pdflscape} \usepackage{booktabs} \usepackage[font=scriptsize]{caption}

\usepackage{nicematrix,tikz}

\ExplSyntaxOn \newcommand<> { \Strike }
{ \only#1 { \tl_gput_right:Nx \g_nicematrix_code_after_tl { \mathslove_strike:n { \arabic { iRow } } } } \ignorespaces } \cs_new_protected:Nn \mathslove_strike:n { \tikz \draw ([yshift=2pt]#1-1.south~west) -- ([yshift=2pt]#1-3.south~east) ; } \ExplSyntaxOff

% In {NiceTabular} of nicematrix, the rules drawn by "|" are % never broken, even when using \toprule, etc. of booktabs. % The following column type behaves as standard "|" of {tabular}. \newcolumntype{I}{!{\vrule}}

\begin{document}

\setbeamertemplate{frametitle}[default][center]

\begin{frame} \small \begin{table} \tiny \caption{Feeding table} \begin{NiceTabular}{cIcIc} \toprule Task & Time & Positional weight \ \midrule \Strike<5-> 1 & 12 & 70 \ \Strike<6-> 2 & 6 & 58 \ \Strike<7-> 3 & 6 & 31 \ \Strike<8-> 4 & 2 & 27 \ \Strike<10-> 5 & 2 & 20 \ \Strike<9-> 6 & 12 & 29 \ \Strike<12-> 7 & 7 & 25 \ \Strike<13-> 8 & 5 & 18 \ \Strike<11-> 9 & 1 & 18 \ \Strike<14-> 10 & 4 & 17 \ \Strike<15-> 11 & 6 & 13 \ \Strike<16-> 12 & 7 & 7 \ \bottomrule \end{NiceTabular} \end{table}

\begin{itemize}[<+|+->] \item Method: \item From the available tasks, choose the task for which the sum of following task times is the longest. \end{itemize}

\uncover<3-> { \begin{table} \caption{Data picked up from feeding table} \centering \tiny \begin{tabular}{l | m{1cm} | m{1cm} | m{1cm} | m{1cm} | m{1cm} | m{1cm} } \toprule Station & 1 & 2 & 3 & 4 & 5 & 6 \ \midrule Tasks &\uncover<+->{1} &\uncover<+->{2}\uncover<+->{,3}\uncover<+->{,4} & \uncover<+->{6}\uncover<+->{,5}\uncover<+->{,9}& \uncover<+->{7}\uncover<+->{,8} & \uncover<+->{10}\uncover<+->{,11} & \uncover<+->{12} \ \bottomrule \end{tabular} \end{table} }

\vfill

\end{frame}

\end{document}

One page of the output of the above code

The main part of the code is the following command \Strike.

\ExplSyntaxOn
\newcommand<> { \Strike }  
  { 
    \only#1
      {
        \tl_gput_right:Nx \g_nicematrix_code_after_tl
          { \mathslove_strike:n { \arabic { iRow } } }
      }
    \ignorespaces
  }
\cs_new_protected:Nn \mathslove_strike:n
  { \tikz \draw ([yshift=2pt]#1-1.south~west) -- ([yshift=2pt]#1-3.south~east) ; } 
\ExplSyntaxOff

That command \Strike acts by side effect, that is to say that it adds code in the parameter \g_nicematrix_code_after_tl provided by nicematrix (it's a parameter internal but public) and do not do the typesetting directly. That's why we need \only and not \uncover (with \uncover, the rule would always be drawn since it's a side effect).

F. Pantigny
  • 40,250