latex - 使用带有 \onslide\visible\only 的 Tikz 定位在投影仪内
问题描述
我希望它的元素在我的投影仪演示中以一定的顺序出现。目前,我正在尝试让 a_1、a_2 出现在第二张幻灯片中。我正在使用这段代码:
\documentclass{beamer}
\usepackage{textcomp}
\usepackage{tikz}
\usetheme{Madrid}
\begin{document}
\begin{frame}{}
\usetikzlibrary{shapes,arrows, positioning, calc}
\tikzset{%
block/.style = {rounded corners, draw, thick, circle, minimum height = 3em,
minimum width = 3em, fill = yellow!50},
point/.style = {coordinate}, % Input
}
\begin{tikzpicture}[auto, thick, node distance=2cm, >=triangle 45]
%\node[block] (A1) at (0,0) {$A_1$};
%\node[block, right = 1cm of A1] (A2) {$A_2$};
\node[below = of A1] (a1) {{\visible<2->{$a_1$}}};
\node[below = of A2] (a2) {{\visible<2->{$a_2$}}};
\node[below = of A1] (a1) {$a_1$};
\node[below = of A2] (a2) {$a_2$};
\draw[->] (A1.south) ++(0,-0.3) -- ++(0, -1.3);
\draw[->] (A2.south) ++(0,-0.3) -- ++(0, -1.3);
\end{tikzpicture}
\end{frame}
\end{document}
但我得到的是:
我收到如下错误:“未知箭头类型'三角形 45'”和“未知运算符 'o' 或 'of ' in (of A1)。这是我第一次使用 Tikz,我不太实际使用投影仪工具像 \onslide、\only 或 \visible。我想我可以创建不同的图像,每个帧一个,然后用 \includegraphics 和 \pause 添加它们,但如果我设法在不创建的情况下实现相同的结果会更实用不同的图片。任何帮助将不胜感激。
解决方案
在序言中加载您的 tikz 库,而不是在框架内
您可以使用该
overlay-beamer-styles
库来控制节点的外观
\documentclass{beamer}
\usepackage{textcomp}
\usepackage{tikz}
\usetheme{Madrid}
\usetikzlibrary{shapes,arrows, positioning, calc}
\usetikzlibrary{overlay-beamer-styles}
\tikzset{%
block/.style = {rounded corners, draw, thick, circle, minimum height = 3em,
minimum width = 3em, fill = yellow!50},
point/.style = {coordinate}, % Input
}
\begin{document}
\begin{frame}{}
\begin{tikzpicture}[auto, thick, node distance=2cm, >=triangle 45]
\node[block] (A1) at (0,0) {$A_1$};
\node[block, right = 1cm of A1] (A2) {$A_2$};
\node[below = of A1, visible on=<2->] (a1) {$a_1$};
\node[below = of A2, visible on=<2->] (a2) {$a_2$};
\draw[->] (A1.south) ++(0,-0.3) -- ++(0, -1.3);
\draw[->] (A2.south) ++(0,-0.3) -- ++(0, -1.3);
\end{tikzpicture}
\end{frame}
\end{document}
推荐阅读
- python - Matplotlib - 如何绘制表格条形图
- python - 我不明白 JSON 在这个网站上是如何工作的
- python - 通过for循环检查字典中是否存在单词
- angular - 对角度分量方法进行单元测试时出错?
- c++ - 如何解决错误“(something::something) 的实例与参数列表不匹配”?
- xml - 读取 xml 文件内容的批处理文件
- flow-project - 我想在 Flow 中使用 Traci 设置车辆(或更多)的速度
- sql-server - GetDate() 给出东部时间而不是太平洋时间
- javascript - 通过滚动将表格行粘贴到浏览器顶部
- reactjs - 如何遍历来自服务器的验证错误