4

I am starting with animate package on LaTeX, and I want combine the animations and matrices from math, and make a electronic book for matrices with animated solutions of matrix.

I was trying make simple animation, but without results. I don't know where it stops, but I think I am doing it bad way.

I don't know how to do it, if with \newframe or \multiframe command, if I want some arrows, transformations, paths. I think I will need something like template, because what I need to do is simple and only about matrices. But I don't know how to do it step by step.

Here is the code what I am trying to do. 1st I want to add arrow into animation. Just 2frames changing. What should I change and how?

\documentclass{beamer}
\usepackage{animate}
\usepackage{tikz,pgfplots}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}

%%%<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\setlength\PreviewBorder{5pt}%
%%%>
\usetikzlibrary{matrix}
\usepackage{fullpage,amsmath}
\begin{document}
\newcounter{i} 
\setcounter{i}{0}
\begin{animateinline}[palindrome,controls]{1}
\multiframe{2}{i=0+1}{
    \begin{tikzpicture}
    \matrix (matrix) [matrix of nodes]
    {
            1 & 1 & 3  \\
            2 & 1 & 5  \\
            3 & 1 & 6  \\
            };

        \draw[thick,red,->] (matrix-1-1) |- (matrix-2-3);

    \end{tikzpicture}

\end{animateinline} 
\end{document}
4

A simple two-frame animation, as requested:

\documentclass[margin={10 1 10 0}]{standalone}
%\documentclass{beamer}
\usepackage{animate}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage[upright]{fourier}
\usetikzlibrary{matrix}

\begin{document}
%\begin{frame}[fragile]
  \begin{animateinline}[step,controls]{1}
    \begin{tikzpicture}
      \matrix (magic) [matrix of nodes]
      {
        1 & 1 & 3  \\
        2 & 1 & 5  \\
        3 & 1 & 6  \\
      };
    \end{tikzpicture}
  \newframe
    \begin{tikzpicture}
      \matrix (magic) [matrix of nodes]
      {
        1 & 1 & 3  \\
        2 & 1 & 5  \\
        3 & 1 & 6  \\
      };
      \draw[thick,red,->] (magic-1-1) |- (magic-2-3);
    \end{tikzpicture}
  \end{animateinline}
%\end{frame}
\end{document}
  • Thank you :) but it's not a problem, then it's not Beamer? It works, and it's enough I think. Now I know how to do animations. So if I want to show how to find determinant of matrix, i must to write every animation every step in `newframe? Or can I use `multiframe function somehow and make it faster and more general for the same size of matrix? – Ján Lazorík Mar 9 '17 at 15:06
  • \multiframe is intended for continuously changing parameter(s), such as i=1,2,...,99, inside the frames. I guess that start and end positions of the arrows will change erratically from frame to frame to demonstrate determinant calculation. Thus, you will have to explicitly build every frame and use \newframe for separation. – AlexG Mar 9 '17 at 15:14
  • Oh Ok then :) this is info which I need :) thank you for help really. I can't move, cause it's new language for me. Now it's only a lot of work, so I think it will be ok without bugs :) – Ján Lazorík Mar 9 '17 at 16:56
  • 1
    @Ján: would you please consider accepting this as the correct answer to your above question (click checkmark on the left)? – AlexG Mar 15 '17 at 14:44
  • Done :) sorry I am new :) I will know for next time – Ján Lazorík Mar 15 '17 at 15:15
6

A fragile frame helps:

\documentclass{beamer}
\usepackage{animate}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usetikzlibrary{matrix}

\begin{document}
\begin{frame}[fragile]
  \begin{animateinline}[step,controls]{1}
    \begin{tikzpicture}
      \matrix (magic) [matrix of nodes]
      {
        1 & 1 & 3  \\
        2 & 1 & 5  \\
        3 & 1 & 6  \\
      };
    \end{tikzpicture}
  \newframe
    \begin{tikzpicture}
      \matrix (magic) [matrix of nodes]
      {
        1 & 1 & 3  \\
        2 & 1 & 5  \\
        3 & 1 & 6  \\
      };
      \draw[thick,red,->] (magic-1-1) |- (magic-2-3);
    \end{tikzpicture}
  \end{animateinline}
\end{frame}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.