在 Beamer 中隱藏 Tikz 節點

在 Beamer 中隱藏 Tikz 節點

我正在用來Tikz建立簡報的流程圖Beamer。我設法Beamer一一發現流程圖中的每一項,但我希望能夠顯示一個節點,然後隱藏它。有什麼辦法可以做到這一點嗎?

這是我的程式碼:

    \begin{frame}{The Detection Method}
    \tikzstyle{LargeBlock} = [rectangle, draw, fill=blue!20, text width=10em, text badly centered, rounded corners]
    \tikzstyle{decision} = [diamond, draw, fill=red!20, text badly centered,text width=1.2cm]
    \tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=5em, text badly centered, rounded corners, minimum height=1em]
    \tikzstyle{ImgBlock} = [rectangle, draw]
    \tikzstyle{line} = [draw, -latex']
    \tikzstyle{cloud} = [draw, ellipse,fill=red!20, minimum height=1em]
    \tikzstyle{EmptyAnchor} = [ellipse,minimum height=1em]
    \begin{tikzpicture}[node distance = 1cm, auto]
        \pause{}
        % Step 1
        \node [LargeBlock, anchor=north]                            (init)          {Simulated Planet + Star CCFs};\pause{}
        % Step 2
        \node [decision, right=1 cm of init]                        (build)         {$\sum CCFs$};
        \path [line] (init)         --                              (build);        \pause{}
        % Step 3
        \node [block,   below=0.5 cm of build]                      (template)      {Star Template};
        \path [line] (build)        --                              (template);     \pause{}
        % Step 4
        \node [decision, below=0.5 cm of init]                      (normalise)     {$\frac{CCFs}{Template}$};
        \path [line] (init)         --                              (normalise);
        \path [line] (template)     --                              (normalise);    \pause{} 
        % Step 
        \node [EmptyAnchor, below=1.5 cm of normalise]              (empty0)        {};
        \node [EmptyAnchor, right=2.5 cm of empty0]                 (empty3)        {};
        \node [ImgBlock, right=5 cm of empty0]                      (img1)          {{\pgftext{\includegraphics[width=4.5cm,page=6]{./figures/Jupiter_3days_EELT.pdf}}}};  
        \path [line,dashed] (normalise)     |-                              (empty3);       \pause{}
        % Step 5
        \path [line] (init)         --                              (build);    
        \node [LargeBlock, below=0.5 cm of normalise]               (NormCCFs)      {Normalized CCFs};
        \path [line] (normalise)    --                              (NormCCFs);     \pause{}
        % Step 6
        \node [decision, below=0.5 cm of NormCCFs]                  (stack)         {$stack$ $CCFs$};    
        \node [EmptyAnchor, below=0.5 cm of NormCCFs]               (empty1)        {};
        \path [line] (NormCCFs)     --  node[color=red]{Correct Planet RV}      (stack);        \pause{}
        % Step 7
        \node [EmptyAnchor, right=2 cm of stack]                    (empty2)        {};
        \node [ImgBlock, right=5 cm of empty1]                      (stop)          {{\pgftext{\includegraphics[width=4.5cm,page=8]{./figures/Jupiter_3days_EELT.pdf}}}};
        \path [line,dashed] (stack)     --                                  (empty2);
    \end{tikzpicture}
\end{frame}

我想要節點(圖1)當節點出現然後消失(標準 CCF)出現。

有接受者嗎?

答案1

\node您可以利用和覆蓋感知這一事實\path,以便您可以在所需投影片上顯示元素:

\PassOptionsToPackage{demo}{graphicx}
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,positioning,arrows}

\begin{document}

   \begin{frame}{The Detection Method}
    \tikzstyle{LargeBlock} = [rectangle, draw, fill=blue!20, text width=10em, text badly centered, rounded corners]
    \tikzstyle{decision} = [diamond, draw, fill=red!20, text badly centered,text width=1.2cm]
    \tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=5em, text badly centered, rounded corners, minimum height=1em]
    \tikzstyle{ImgBlock} = [rectangle, draw]
    \tikzstyle{line} = [draw, -latex']
    \tikzstyle{cloud} = [draw, ellipse,fill=red!20, minimum height=1em]
    \tikzstyle{EmptyAnchor} = [ellipse,minimum height=1em]
    \begin{tikzpicture}[node distance = 1cm, auto]
        \pause{}
        % Step 1
        \node [LargeBlock, anchor=north]                            (init)          {Simulated Planet + Star CCFs};\pause{}
        % Step 2
        \node [decision, right=1 cm of init]                        (build)         {$\sum CCFs$};
        \path [line] (init)         --                              (build);        \pause{}
        % Step 3
        \node [block,   below=0.5 cm of build]                      (template)      {Star Template};
        \path [line] (build)        --                              (template);     \pause{}
        % Step 4
        \node [decision, below=0.5 cm of init]                      (normalise)     {$\frac{CCFs}{Template}$};
        \path [line] (init)         --                              (normalise);
        \path [line] (template)     --                              (normalise);    \pause{} 
        % Step 
        \node [EmptyAnchor, below=1.5 cm of normalise]              (empty0)        {};
        \node [EmptyAnchor, right=2.5 cm of empty0]                 (empty3)        {};
        \node<6> [ImgBlock, right=5 cm of empty0]                      (img1)          {{\pgftext{\includegraphics[width=4.5cm,page=6]{./figures/Jupiter_3days_EELT.pdf}}}};  
        \path<6> [line,dashed] (normalise)     |-                              (empty3);       \pause{}
        % Step 5
        \path [line] (init)         --                              (build);    
        \node [LargeBlock, below=0.5 cm of normalise]               (NormCCFs)      {Normalized CCFs};
        \path [line] (normalise)    --                              (NormCCFs);     \pause{}
        % Step 6
        \node [decision, below=0.5 cm of NormCCFs]                  (stack)         {$stack$ $CCFs$};    
        \node [EmptyAnchor, below=0.5 cm of NormCCFs]               (empty1)        {};
        \path [line] (NormCCFs)     --  node[color=red]{Correct Planet RV}      (stack);        \pause{}
        % Step 7
        \node [EmptyAnchor, right=2 cm of stack]                    (empty2)        {};
        \node [ImgBlock, right=5 cm of empty1]                      (stop)          {{\pgftext{\includegraphics[width=4.5cm,page=8]{./figures/Jupiter_3days_EELT.pdf}}}};
        \path [line,dashed] (stack)     --                                  (empty2);
    \end{tikzpicture}
\end{frame}

\end{document}

在此輸入影像描述

順便說一句,使用 TikZ 命令是覆蓋感知的,或者使用\onslide<>{...}或 ,\only<...>{}您可以獲得比使用簡單\pause命令更好的控制(如果需要)。

現在是程式碼,但使用\onslide規範;我還用新的 \tikzset 語法取代了舊的 \tikzstyle 語法:

\PassOptionsToPackage{demo}{graphicx}
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,positioning,arrows}

\begin{document}

   \begin{frame}{The Detection Method}
\tikzset{
LargeBlock/.style={rectangle, draw, fill=blue!20, text width=10em, text badly centered, rounded corners},
decision/.style = {diamond, draw, fill=red!20, text badly centered,text width=1.2cm},
block/.style = {rectangle, draw, fill=blue!20, text width=5em, text badly centered, rounded corners, minimum height=1em},
ImgBlock/.style = {rectangle, draw},
line/.style = {draw, -latex'},
cloud/.style = {draw, ellipse,fill=red!20, minimum height=1em},
EmptyAnchor/.style = {ellipse,minimum height=1em}
}
    \begin{tikzpicture}[node distance = 1cm, auto]
        % Step 1
        \node [LargeBlock, anchor=north]                            (init)          {Simulated Planet + Star CCFs};\pause{}
        % Step 2
\onslide<+->{\node [decision, right=1 cm of init]                        (build)         {$\sum CCFs$};
        \path [line] (init)         --                              (build);  
}
        % Step 3
\onslide<+->{\node [block,   below=0.5 cm of build]                      (template)      {Star Template};
        \path [line] (build)        --                              (template);
}
        % Step 4
\onslide<+->{\node [decision, below=0.5 cm of init]                      (normalise)     {$\frac{CCFs}{Template}$};
        \path [line] (init)         --                              (normalise);
        \path [line] (template)     --                              (normalise);
}
\onslide<+->{\node [EmptyAnchor, below=1.5 cm of normalise]              (empty0)        {};
        \node [EmptyAnchor, right=2.5 cm of empty0]                 (empty3)        {};
}
\onslide<+>{\node [ImgBlock, right=5 cm of empty0]                      (img1)          {{\pgftext{\includegraphics[width=4.5cm,page=6]{./figures/Jupiter_3days_EELT.pdf}}}};  
        \path [line,dashed] (normalise)     |-                              (empty3);
}
        % Step 5
\onslide<+->{\path [line] (init)         --                              (build);    
        \node [LargeBlock, below=0.5 cm of normalise]               (NormCCFs)      {Normalized CCFs};
        \path [line] (normalise)    --                              (NormCCFs);
}
        % Step 6
\onslide<+->{\node [decision, below=0.5 cm of NormCCFs]                  (stack)         {$stack$ $CCFs$};    
        \node [EmptyAnchor, below=0.5 cm of NormCCFs]               (empty1)        {};
        \path [line] (NormCCFs)     --  node[color=red]{Correct Planet RV}      (stack);
}
        % Step 7
\onslide<+->{\node [EmptyAnchor, right=2 cm of stack]                    (empty2)        {};
        \node [ImgBlock, right=5 cm of empty1]                      (stop)          {{\pgftext{\includegraphics[width=4.5cm,page=8]{./figures/Jupiter_3days_EELT.pdf}}}};
        \path [line,dashed] (stack)     --                                  (empty2);
}
    \end{tikzpicture}
\end{frame}

\end{document}

線路

\PassOptionsToPackage{demo}{graphicx}

只是用黑色矩形替換實際圖像。做不是在您的實際程式碼中使用該行。

相關內容