1

I want to generate seperate frames to use it with \animategraphics in my beamer, so how to convert them to frames?.. Thanks in advnace for your help.

\documentclass[border=30pt, tikz]{standalone}
\usepackage{circuitikz}


\newcommand{\stepconductor}{.1}
\newcommand{\stepresistor}{.025}

\newcommand{\currentradius}{3pt}


\newenvironment{mycircuit}{%
    \begin{circuitikz}
        \draw (0,0) coordinate (V-)
            to[V,v=$U_q$] ++(0, 2) coordinate (V+)
            to[short]     ++(2, 0) coordinate (R1+)
            to[R=$R_1$]   ++(0,-2) coordinate (R1-)
            to[short]     (V-);
        \draw (R1+)
            to[short]     ++(2, 0) coordinate (R2+)
            to[R=$R_2$]   ++(0,-2) coordinate (R2-)
            to[short]     (R1-);

        % ensure that tikzpicture has always the same size (independent of the position of the current)
        \path (V+) -- ++(0, +\currentradius);
        \path (V-) -- ++(0, -\currentradius);
}{%
    \end{circuitikz}%
}
\newcommand{\current}[2]{%
    \path (#1) -- node[pos=\p, circle, fill=red, minimum size=2*\currentradius, inner sep=0pt]{} (#2);
}

\begin{document}
    \foreach \p in {0, \stepconductor, ..., 1}{
        \begin{mycircuit}
            \current{V-}{V+}
        \end{mycircuit}
    }
    \foreach \p in {0, \stepconductor, ..., 1}{
        \begin{mycircuit}
            \current{V+}{R1+}
        \end{mycircuit}
    }
    \foreach \p in {0, \stepresistor, ..., 1}{
        \begin{mycircuit}
            \current{R1+}{R1-}
        \end{mycircuit}
    }
    \foreach \p in {0, \stepconductor, ..., 1}{
        \begin{mycircuit}
            \current{R1-}{V-}
        \end{mycircuit}
    }
\end{document}

1 Answer 1

1

Add

\standaloneenv{mycircuit}

at the end of the preamble, just before \begin{document}. This creates one (cropped) page per mycircuit of a multi-page PDF that can be used with \animategraphics in another document.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .