1

In this animation, I need to access to the number of some labelled slides (not frames) to use this numbers in overlay specification. As far as I know it is not possible

What then should be the good approach, other than taking numbers from screen like I did for the last one.

enter image description here

Edit Here is the corrected code with the other answer :

\documentclass[xcolor=dvipsnames,professionalfont,french]{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fourier,tikz,ifthen}
\usetikzlibrary{calc} 
\usepackage[french]{babel}
\usepackage{etoolbox}

\usetheme{Madrid}               % thème
\setbeamertemplate{footline}{}

\setbeamercolor{palette primary}{fg=white, bg=MidnightBlue!90}
\setbeamercolor{background canvas}{bg=MidnightBlue!15}

\setbeamersize{text margin left=1 mm}
\setbeamersize{text margin right=1 mm}

\beamertemplatenavigationsymbolsempty

\makeatletter
\def\c@slideinframe{\beamer@slideinframe}
\def\beamerslideinframe{\beamer@slideinframe}

\DeclareRobustCommand*{\Label}[2][-1]{\only<1>{%
\advance\c@beamerpauses by#1%
\immediate\write\@auxout{\string\pauseentry{\the\c@framenumber}{#2}{\the\c@beamerpauses}}%
\advance\c@beamerpauses by-#1\relax}}

\newcommand*{\Ref}[1]{\@ifundefined{pauses@\the\c@framenumber @#1}{1}{\@nameuse{pauses@\the\c@framenumber @#1}}}

\newcommand*{\pauseentry}[3]{\global\@namedef{pauses@#1@#2}{#3}}
\makeatother


\begin{document}
\begin{frame}[label=bob,fragile]{Dudeney}
\begin{columns}[onlytextwidth]

% #############################
%         Tikz Picture        #
% #############################

\column{\dimexpr\textwidth-4cm}
\begin{tikzpicture}

% taille du rectangle de tikzpicture
\coordinate (Diag) at (8.6,8.3) ; 

\fill[white,rounded corners=1pt] (0,0) rectangle (Diag) ;
\clip[rounded corners=1pt] (0,0) rectangle (Diag) ;

\begin{scope}[scale=.5,             % échelle
            shift={($.5*(Diag)-(0,3)$)},    % centre la figure
            font=\small,            % taille de caractères
            label distance=-2pt,
            ]

%\draw[help lines] (-10,-10) grid (10,10) ;
%\fill[red] (0,0) circle (3pt) ;
\node[fill=red!25] at (0,0) {\arabic{slideinframe}} ;

\coordinate (A) at (90:6) ;
\coordinate (B) at (210:6) ;
\coordinate (C) at (-30:6) ;

\coordinate (I) at ($(A)!.5!(B)$) ;
\coordinate (J) at ($(A)!.5!(C)$) ;
\coordinate (K) at ($(C)!.5!(B)$) ;
\coordinate (E) at ($(B)!.5!(K)$) ;
\coordinate (F) at ($(C)!.5!(K)$) ;

\coordinate (N) at ($(E)!(F)!(J)$) ;
\coordinate (M) at ($(E)!(I)!(J)$) ;



\only<+-+(2),\Ref{Last}>{%
    \draw (A)--(B)--(C)-- cycle ;
    }

\only<+-+>{%
    \foreach \Coor in {I,J,K,E,F} {%
        \fill[red] (\Coor) circle (2.5pt) ; }
    }

\only<+-+>{%
    \draw (E)--(J) (I)--(M) (F)--(N) ;
    }

\only<.(1)->{% untill the last slide
    \draw (A)--(I)--(M)--(J)--cycle ;
    }

\only<.(1)-\Ref{Second}>{% untill the slide labelled "second"
    \draw (I)--(M)--(E)--(B)--cycle ;
    }

\only<.(1)-\Ref{Third}>{% untill the slide labelled "third"
    \draw (E)--(F)--(N)--cycle ;
    }

\label<.(1)>{first} % start of the first piece - slide 4
\foreach \i in {10,20,...,170} {%
\transduration<+-+>{.1}
\only<.-.>{%
    \begin{scope}[transform canvas={rotate around = {\i:(J)}}]
    \draw (F)--(C)--(J)--(N)--cycle ;
    \end{scope}
    }
}
\transduration<+-+>{.1}
\only<.->{% reste affiché
    \begin{scope}[transform canvas={rotate around = {180:(J)}}]
    \draw (F)--(C)--(J)--(N)--cycle ;
    \end{scope}
    }

\Label{Second} % start of the second piece
\foreach \i in {-10,-20,...,-170} {%
\transduration<+-+>{.1}
\only<.-.>{%
    \begin{scope}[transform canvas={rotate around = {\i:(I)}}]
    \draw (I)--(M)--(E)--(B)--cycle ;
    \end{scope}
    }
}

\transduration<+-+>{.1}
\only<.->{%
    \begin{scope}[transform canvas={rotate around = {-180:(I)}}]
    \draw (I)--(M)--(E)--(B)--cycle ;
    \end{scope}
    }

\Label{Third} % start of the third piece
\foreach \i in {.1,.2,...,.91} {%
\transduration<+-+>{.1}
\only<.-.>{%
    \begin{scope}[transform canvas={shift={($(K)!\i!(A)-(K)$)}}]
    \draw (E)--(F)--(N)--cycle ;
    \end{scope}
    }
}

\only<+-+>{%
    \begin{scope}[transform canvas={shift={($(A)-(K)$)}}]
    \draw (E)--(F)--(N)--cycle ;
    \end{scope}
    }
\Label{Last}

\end{scope}
\end{tikzpicture}% -- Fin Tikz Picture

% #############################
%         Commentaires        #
% #############################

\column{39mm}
\begin{minipage}[t][8.3cm]{\linewidth}
\small

\begin{itemize}

\item<1-> An equilateral triangle.
\item<\Ref{Last}> A square ? 

\end{itemize}

\only<\Ref{Last}>{But I don't want to calculate the number
of the last slide !!}

\end{minipage}
\end{columns}
\end{frame}


\end{document}
Tarass
  • 16,912

0 Answers0