如何在 Tikz 环境内部和外部本地和全局设置 \pause

如何在 Tikz 环境内部和外部本地和全局设置 \pause

我在 Beamer 演示文稿中使用 Tikz 图表。首先,\pause当它在图表中逐个生成元素时,似乎在 Tikz 环境中运行良好。但是,如果幻灯片\pause在 Tikz 环境之外有两个或更多命令,LaTex 似乎会优先考虑\pause外部命令而不是内部命令。

\pause按演示文稿的顺序逐一设置,并希望在 pdf 中也能这样工作。我该如何修复?

这是我的 MWE:

\documentclass{beamer}
\usepackage[utf8]{vietnam}
\usepackage{tikz}
\usepackage{mathdots}
\usepackage{color}
\begin{document}
\begin{frame}[fragile]{Functions}
\pause 
\textit{Example 1:} \pause Consider \pause 
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt  
\pause      
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,635); %set diagram left start at 0, and has height of 635
% Text Node
\draw (103,137) node [anchor=north west][inner sep=0.75pt]   [align=left] {{\fontfamily{pcr}\selectfont {\small \textcolor[rgb]{0.25,0.46,0.02}{def }\textcolor[rgb]{0.05,0.05,0.88}{star\_fig}()\textcolor[rgb]{0.25,0.46,0.02}{: \ \ \ }}}\\{\fontfamily{pcr}\selectfont {\small \textcolor[rgb]{0.25,0.46,0.02}{ \ \ \ print(}\textcolor[rgb]{0.82,0.01,0.11}{"**********"}\textcolor[rgb]{0.25,0.46,0.02}{)}}}\\{\fontfamily{pcr}\selectfont {\small \textcolor[rgb]{0.25,0.46,0.02}{ \ \ \ print(}\textcolor[rgb]{0.82,0.01,0.11}{"* * *"}\textcolor[rgb]{0.25,0.46,0.02}{)}}}};
\pause

%Curve Lines [id:da9470939235990756] 
\draw [color={rgb, 255:red, 0; green, 0; blue, 0 }  ,draw opacity=1 ]   (368,149.6) .. controls (318.75,110.2) and (240.39,119.31) .. (210.34,133.93) ;
\draw [shift={(209,134.6)}, rotate = 332.65] [color={rgb, 255:red, 0; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]    (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29)   ;
\pause

% Text Node
\draw (297,153) node [anchor=north west][inner sep=0.75pt]   [align=left] {{\fontfamily{pcr}\selectfont {\footnotesize without a parameter}}};
\pause

%Curve Lines [id:da34532083930227464] 
\draw [color={rgb, 255:red, 0; green, 0; blue, 0 }  ,draw opacity=1 ]   (430,200.6) .. controls (410.1,223.48) and (314.96,231.52) .. (248.01,181.36) ;
\draw [shift={(247,180.6)}, rotate = 37.28] [color={rgb, 255:red, 0; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]    (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29)   ;

\pause

% Text Node
\draw (296,177) node [anchor=north west][inner sep=0.75pt]   [align=left] {{\fontfamily{pcr}\selectfont {\footnotesize result: a figure with stars}}};
\end{tikzpicture}
\pause
\textit{Example 2:} \pause Consider \pause
\pause
\tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt        
\pause
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
%uncomment if require: \path (0,635); %set diagram left start at 0, and has height of 635
% Text Node
\draw (103,137) node [anchor=north west][inner sep=0.75pt]   [align=left] {{\fontfamily{pcr}\selectfont {\small \textcolor[rgb]{0.25,0.46,0.02}{def }\textcolor[rgb]{0.05,0.05,0.88}{new\_star\_fig}(x, y):\textcolor[rgb]{0.25,0.46,0.02}{ \ \ \ }}}\\{\fontfamily{pcr}\selectfont {\small \textcolor[rgb]{0.25,0.46,0.02}{ \ \ \ print}(x\textcolor[rgb]{0.5,0.5,0.5}{*}\textcolor[rgb]{0.82,0.01,0.11}{'*'})}}\\{\fontfamily{pcr}\selectfont {\small \textcolor[rgb]{0.25,0.46,0.02}{ \ \ \ print}(x\textcolor[rgb]{0.5,0.5,0.5}{*}\textcolor[rgb]{0.82,0.01,0.11}{'*', }y\textcolor[rgb]{0.5,0.5,0.5}{*}\textcolor[rgb]{0.82,0.01,0.11}{'*'})}}\\{\fontfamily{pcr}\selectfont {\small \textcolor[rgb]{0.05,0.05,0.88}{new\_star\_fig}(4, 4)}}};
\pause
%Curve Lines [id:da9470939235990756] 
\draw [color={rgb, 255:red, 0; green, 0; blue, 0 }  ,draw opacity=1 ]   (405,128.6) .. controls (356.25,89.6) and (278.03,122.85) .. (254.69,135.66) ;
\draw [shift={(253,136.6)}, rotate = 330.26] [color={rgb, 255:red, 0; green, 0; blue, 0 }  ,draw opacity=1 ][line width=0.75]    (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29)   ;
\pause
% Text Node
\draw (315,134) node [anchor=north west][inner sep=0.75pt]   [align=left] {{\fontfamily{pcr}\selectfont {\footnotesize with 2 parameters}}};
\pause 
%Curve Lines [id:da8771079801969777] 
\draw    (144,209) .. controls (170.6,245.45) and (268.99,221.74) .. (307.29,200.95) ;
\draw [shift={(309,200)}, rotate = 150.42] [color={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.75]    (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29)   ;
%Straight Lines [id:da07605527976206505] 
%\draw    (246,196.6) -- (308.02,188.85) ;
%\draw [shift={(310,188.6)}, rotate = 172.87] [color={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.75]    (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29)   ;
\pause
% Text Node
\draw (317,182) node [anchor=north west][inner sep=0.75pt]   [align=left] {{\fontfamily{pcr}\selectfont {\footnotesize when the function is called: }}\\{\fontfamily{pcr}\selectfont {\footnotesize ****}}\\ \ \ \ \ \ {\fontfamily{pcr}\selectfont {\footnotesize ****}}\\ \ \ \ \ \ };


\end{tikzpicture}
\pause
\end{frame}
\end{document}

当元素未按顺序出现时,这是 pdf 中的结果\pause在此处输入图片描述

请随时向我索取您需要的任何信息。

谢谢。

相关内容