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}

나는 노드를 원한다(img1)노드가 나타나면 나타났다가 사라지게 됩니다.(NormCCF)나타납니다.

받는 사람이 있나요?

답변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사양을 사용합니다. 또한 이전 \tikzstyle 구문을 새로운 \tikzset 구문으로 대체했습니다.

\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}

단순히 실제 이미지를 검은색 직사각형으로 대체합니다. 하다~ 아니다실제 코드에서 해당 줄을 사용하십시오.

관련 정보