在 beamer 和 tikz 中向指向同一节点的两个节点添加箭头、文本和叠加

在 beamer 和 tikz 中向指向同一节点的两个节点添加箭头、文本和叠加

我想创建类似于以下的图表: http://www.texample.net/tikz/examples/marketing-distribution-channel/

相反,我希望底部的两个节点指向顶部节点,除非它们重叠,否则我无法让它们这样做。

另外,我想添加与链接中一样的文本,例如箭头旁边的链接中的测试参与率。但是,每次我添加文本时,节点都会向右移动太远,以至于有些节点不再显示在屏幕上。

我想做的另一件事是,在显示完所有节点后,我想添加一个新的框架标题。我原本以为只有或揭露可能会奏效,但似乎不行。我还想添加一些带项目符号的文本。然而,它似乎没有遵循相同的间距和字体。参见叠加层 5 与幻灯片 2。

如能得到任何帮助我将非常感激。

 \documentclass{beamer}
 \mode<presentation>
 \usetheme{CambridgeUS}
  \useoutertheme{miniframes}
  \usepackage{color}

  \usepackage{tikz}
       \ussetikzlibrary{arrows,shapes,positioning,fit,shapes.misc,matrix,decorations.text,shapes.geometric}


 \begin{document}

 \tikzstyle{every picture}+=[remember picture]
 \tikzstyle{labels} = [font=\footnotesize, text centered,red]
  \tikzstyle{pointer} = [->,red, thick, >=latex']
  \tikzset{onslide/.code args={<#1>#2}{%
  \only<#1>{\pgfkeysalso{#2}} % \pgfkeysalso doesn't change the path
  }}

  \frame
  {
  \frametitle{Frame Title Goes Here}
  \begin{figure}
  \centering
   \begin{tikzpicture}[node distance=1cm, auto]  

   \tikzset{
    mynode/.style={rectangle,rounded corners,draw=black, top color=white, bottom          color=yellow!50,very thick, inner sep=1em, minimum size=2em, text centered},
myarrow/.style={->, >=latex', shorten >=1pt, very thick},
  mylabel/.style={text width=10em, text centered} 
 } 
     \uncover<1-4>{\node[mynode, align=center,draw,onslide=<1-3>] at (0,0) (a) {Line 1\\Line 2};}
     \uncover<1-3>{\node[mynode, align=center,draw,onslide=<1-3>] at (4.75,0) (b) {Line 1\\Line 2};}
     \uncover<1-3>{\draw[myarrow] (a) -- (b);}
     \uncover<2-3>{\node[mynode, align=center,draw,onslide=<2-3>] at (-2,-3.75) (c) {Line 1:\\Line 2};
    \uncover<2-3>{\node[below=-1.35cm of c] (dummy) {};}
    \uncover<3-3>{\node[right=-0.35cm of c] (dummy2) {};}
    \uncover<2-3>{\node[mylabel, below = of dummy](label1){\hspace{0.10cm}\hyperlink{eac<1>}{\beamergotobutton{Literature}}};}
    \uncover<2-3>{\draw[myarrow] (c.north) -- +(0,0) -- ++(0,1) -| (a.south);}}
   \uncover<3-4>{\node[mynode, align=center,draw,onslide=<3-3>] at (2,-3.75) (d) {Line 1\\Line 2};
   \uncover<3-4>{\node[right=-0.35cm of d] (dummy3) {};}
   \uncover<3-4>{\draw[myarrow] (d.north)  -- ++(0,0) -- ++(0,1) -| (a.south);}}

  \end{tikzpicture} 
  \end{figure}
  \uncover<6-6>{Test}
 }
\end{document}

编辑:使用答案中的代码,其中一个节点中的长文本似乎仍然存在问题:

\documentclass{beamer}
\usetheme{CambridgeUS}
\useoutertheme{miniframes}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,fit,shapes.misc,matrix,decorations.text,shapes.geometric}

\begin{document}

 \tikzstyle{every picture}+=[remember picture]
\tikzstyle{labels} = [font=\footnotesize, text centered,red]
\tikzstyle{pointer} = [->,red, thick, >=latex']
\tikzset{onslide/.code args={<#1>#2}{%
 \only<#1>{\pgfkeysalso{#2}} % \pgfkeysalso doesn't change the path
}}

\begin{frame}
 \only<1-4>{\frametitle{Frame Title Goes Here}}
 \only<5->{\frametitle{Some Other Title}}

\only<5->{
 \textbf{Sample:}
 \begin{itemize}
\item Peace
 \item Love
  \item War
 \end{itemize}

 \vspace{0.65cm}
 \textbf{Sample2:}
 }      

 \begin{figure}
 \centering
\begin{tikzpicture}[node distance=1cm, auto]  

\tikzset{
mynode/.style=
{rectangle,rounded corners,draw=black, top color=white, 
bottom color=yellow!50,very thick, inner sep=1em, minimum size=2em, align=center},
myarrow/.style={->, >=latex', shorten >=1pt, very thick},
mylabel/.style={text width=10em, text centered} 
} 

\uncover<1-4>{\node[mynode] at (0,0) (a) {Line 1\\Line 2};}
\uncover<1-3>{\node[mynode] at (4.75,0) (b) {Line 1\\Line 2};}
\uncover<1-3>{\draw[myarrow] (a) -- (b);}
 \uncover<2-3>{\node[mynode] at (-2,-3.75) (c) {Line 1:\\Line 2};
 \uncover<2-3>{\node[below=-1.35cm of c] (dummy) {};}
\uncover<3-3>{\node[right=-0.35cm of c] (dummy2) {};}
 \uncover<2-3>{\node[mylabel, below = of dummy] (label1)
{\hspace{0.10cm}\hyperlink{eac<1>}{\beamergotobutton{Literature}}};}
\uncover<2-3>{\draw[myarrow] (c.north) -- +(0,0) -- ++(0,1) 
 node[swap,anchor=west,text width=3cm] {some really really really long text goes here} -| (a.250);}}
 \uncover<3-4>{\node[mynode] at (2,-3.75) (d) {Line 1\\Line 2};
 \uncover<3-4>{\node[right=-0.35cm of d] (dummy3) {};}
 \uncover<3-4>{\draw[myarrow] (d.north)  -- ++(0,0) --  ++(0,1) 
 node[swap,anchor=west,text width=3cm] {some really really really long text goes here} -| (a.290);}}

 \end{tikzpicture} 
\end{figure}
\end{frame}

\begin{frame}
\frametitle{Some Other Title}
\textbf{Sample:}
\begin{itemize}
 \item Peace
\item Love
\item War
 \end{itemize}

\vspace{0.65cm}
\textbf{Sample2:}
 \end{frame}

\end{document}

答案1

也许这样的东西就是您所需要的?

\documentclass{beamer}
\usetheme{CambridgeUS}
\useoutertheme{miniframes}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,fit,shapes.misc,matrix,decorations.text,shapes.geometric}

\begin{document}

 \tikzstyle{every picture}+=[remember picture]
\tikzstyle{labels} = [font=\footnotesize, text centered,red]
\tikzstyle{pointer} = [->,red, thick, >=latex']
\tikzset{onslide/.code args={<#1>#2}{%
 \only<#1>{\pgfkeysalso{#2}} % \pgfkeysalso doesn't change the path
}}

\begin{frame}
 \only<1-4>{\frametitle{Frame Title Goes Here}}
 \only<5->{\frametitle{Some Other Title}}

\only<5->{
 \textbf{Sample:}
 \begin{itemize}
\item Peace
 \item Love
  \item War
 \end{itemize}

 \vspace{0.65cm}
 \textbf{Sample2:}
 }      

\only<1-4>{%
\begin{figure}
 \centering
\begin{tikzpicture}[node distance=1cm, auto]  

\tikzset{
mynode/.style=
{rectangle,rounded corners,draw=black, top color=white, 
bottom color=yellow!50,very thick, inner sep=1em, minimum size=2em, align=center},
myarrow/.style={->, >=latex', shorten >=1pt, very thick},
mylabel/.style={text width=10em, text centered} 
} 

\uncover<1-4>{\node[mynode] at (0,0) (a) {Line 1\\Line 2};}
\uncover<1-3>{\node[mynode] at (4.75,0) (b) {Line 1\\Line 2};}
\uncover<1-3>{\draw[myarrow] (a) -- (b);}
 \uncover<2-3>{\node[mynode] at (-2,-3.75) (c) {Line 1:\\Line 2};
 \uncover<2-3>{\node[below=-1.35cm of c] (dummy) {};}
\uncover<3-3>{\node[right=-0.35cm of c] (dummy2) {};}
 \uncover<2-3>{\node[mylabel, below = of dummy] (label1)
{\hspace{0.10cm}\hyperlink{eac<1>}{\beamergotobutton{Literature}}};}
\uncover<2-3>{\draw[myarrow] (c.north) -- +(0,0) -- ++(0,1) 
 node[swap,anchor=east,text width=3cm] {some really really really long text goes here} -| (a.250);}}
 \uncover<3-4>{\node[mynode] at (2,-3.75) (d) {Line 1\\Line 2};
 \uncover<3-4>{\node[right=-0.35cm of d] (dummy3) {};}
 \uncover<3-4>{\draw[myarrow] (d.north)  -- ++(0,0) --  ++(0,1) 
 node[swap,anchor=west,text width=3cm] {some really really really long text goes here} -| (a.290);}}

 \end{tikzpicture} 
\end{figure}}
\end{frame}

\end{document}

相关内容