从 Beamer 创建 AVI

从 Beamer 创建 AVI

我正在尝试使用以下代码创建 AVI:

\documentclass[hyperref={pdfpagelabels=false}]{beamer}
\usepackage{amsthm}
\usepackage{graphicx} % Required for inserting images
\usepackage{tikz}
\usetikzlibrary{overlay-beamer-styles}
\usetikzlibrary{automata, positioning, arrows.meta,calc,cd,animations,shapes}
\usetikzlibrary{patterns}
\usetikzlibrary{datavisualization}
\tikzset{
->, % makes the edges directed
>=stealth, % makes the arrow heads bold
node distance=3cm, % specifies the minimum distance between two nodes. Change if necessary.
every state/.style={thick, fill=gray!10}, % sets the properties for each ’state’ node
initial text=$ $, % sets the text that appears on the start arrow
}
%\usepackage{animate}
\beamertemplatenavigationsymbolsempty
\begin{document}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}

\begin{frame}[label=GIFshow]
    \begin{figure}
        \begin{tikzpicture}[node distance = 2cm, on grid,>={Stealth[inset=0pt,length=6pt,angle'=28,round]}][overlay]
    
        \node[state, initial,alt=<2->{fill=yellow}{}] at (0,0) (q1) {$q^1$};
        \node[state] at (1,-2.5) (q2) {$q^2$};
        \node[state, right of=q2] (q3) {$q^3$};
        \node[state, right of=q3] (q4) {$q^4$};
        \node[state, right of=q4] (q5) {$q^5$};
        \node[state,accepting,alt=<6->{fill=yellow}{}] at (8,0) (q6) {$q^6$};
        
        
        \node[state,alt=<3->{fill=yellow}{}] at (2,0) (q7) {$q^7$};
        \node[state, right of=q7,alt=<4->{fill=yellow}{}] (q8) {$q^8$};
        \node[state,alt=<5->{fill=yellow}{}] at (6,0) (q9) {$q^9$};
        
        \node[state] at (1,2.5) (q10) {$q^{10}$};
        \node[state, right of=q10] (q11) {$q^{11}$};
        \node[state, right of=q11] (q12) {$q^{12}$};
        \node[state, right of=q12] (q13) {$q^{13}$};
        
        \node[state,fill=red!20, densely dashed] at (2,-1.25) (q14) {$q^{14}$};
        \node[state,fill=red!20, densely dashed] at (4,-1.25) (q15) {$q^{15}$};
        \node[state,fill=red!20, densely dashed] at (2,1.25) (q16) {$q^{16}$};
        \node[state,fill=red!20, densely dashed] at (6,1.25) (q17) {$q^{17}$};
    
        \draw 
        
       (q1) edge[bend right] node [below left]{$e^1$} (q2)
       (q2) edge node [below] {$e^2$} (q3)
       (q3) edge node [below]{$e^3$} (q4)
       
       (q1) edge node [above]{$e^6$} (q7)
       (q9) edge node [above]{$e^9$} (q6)
       
       (q1) edge[bend left] node [below left]{$e^{10}$} (q10)
       (q12) edge node [above]{$e^{13}$} (q13)
       (q13) edge[bend left] node [above right]{$e^{14}$} (q6)
       
       (q2) edge[bend right, densely dashed] node [above left]{$e^{15}$} (q14)
       (q14) edge[bend right, densely dashed] node [ right]{$e^{16}$} (q7)
       (q4) edge[bend right, densely dashed] node [ right]{$e^{17}$} (q15)
       (q15) edge[bend right, densely dashed] node [ right]{$e^{18}$} (q9)
       (q12) edge[bend left=10, densely dashed] node [ above]{$e^{19}$} (q16)
       (q16) edge[bend left=10, densely dashed] node [ above right]{$e^{20}$} (q9)
       (q12) edge[bend left=10, densely dashed] node [ above right]{$e^{21}$} (q17)
       (q17) edge[bend left, densely dashed] node [ above right]{$e^{22}$} (q9)
       (q10) edge node [above]{$e^{11}$} (q11)
       (q11) edge node [above]{$e^{12}$} (q12)
       (q4) edge node [below]{$e^4$} (q5)
       (q5) edge[bend right] node [below right] {$e^5$} (q6)
       (q7) edge node [above]{$e^7$} (q8)
       (q8) edge node [above]{$e^8$} (q9);
    \end{tikzpicture}
    \end{figure}
\end{frame}
\againframe<6>{GIFshow}
\againframe<6>{GIFshow}
\end{document}

我正在使用 overleaf。在第一次尝试中,我创建了一个latexmkrc包含以下内容的网站:

END{ system('convert -delay 100 -loop 0 -density 300 output.pdf output.gif')}

这给了我 GIF 文件。我试图将文件格式更改为 AVI,但得到的是损坏的 AVI,我无法使用。有什么建议吗?另外,请为我提供一个latexmkrc命令链接,因为我现在依赖在线示例代码。顺便说一下,下面是 gif 文件。 在此处输入图片描述

相关内容