在幻灯片 2 中,我想在节点“ODE soln”的左侧放置一个“文本”(不是“节点”)“Hello”(如代码中所述)。无法做到这一点
\documentclass{beamer}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{verbatim}
\usetikzlibrary{arrows,shapes}
\usetheme{AnnArbor}
\begin{document}
\begin{frame}
\frametitle{Intuition: Continued...}
\tikzstyle{format} = [draw, thin, fill=blue!20]
\begin{itemize}
\item<1-> Recall the proof of tracking lemma
\begin{tikzpicture}[auto,>=latex', thick]
\path[use as bounding box] (-5,0.5) rectangle (10,-2);
\only<1>{
\path[->]<1-> node[format] (link) {Algorithm};
}
\only<2->{
% Want to put "Hello" to the left of the node "O.D.E soln"
\path[->]<2-> node[format, below of=link] (incl) {O.D.E soln.:};
}
\end{tikzpicture}
\item<3-> Solution
\end{itemize}
\end{frame}
\end{document}
答案1
您已命名的“ODE-soln”节点incl
。您可以\node
使用
\node[left=of incl] {Hello};
这需要\usetikzlibrary{positioning}
。\node
是 的简写 \path node
。
下面是一个完整的示例。我还将其更改below of=
为below=of
,因为PGF/TikZ 中“right of=”和“right=of”之间的区别,并且我将 改为 ,\tikzstyle{name}=[<options>]
因为\tikzset{name/.style={<options>}}
建议使用后者。最后,我将您现有的两个节点 改为\node[format] {...};
。
\documentclass{beamer}
\usepackage[latin1]{inputenc}
\usepackage{times}
\usepackage{tikz}
\usetikzlibrary{calc,positioning,arrows,shapes}
\usetheme{AnnArbor}
\begin{document}
\begin{frame}
\frametitle{Intuition: Continued...}
\tikzset{format/.style={draw, thin, fill=blue!20}}
\begin{itemize}
\item<1-> Recall the proof of tracking lemma
\begin{tikzpicture}[auto,>=latex', thick]
\path[use as bounding box] (-5,0.5) rectangle (10,-2);
\only<1>{
\node[format] (link) {Algorithm};
}
\only<2->{
% Want to put "Hello" to the left of the node "O.D.E soln"
\node[format, below=of link] (incl) {O.D.E soln.:};
\node[left=of incl] {Hello};
}
\end{tikzpicture}
\item<3-> Solution
\end{itemize}
\end{frame}
\end{document}