我想将标有“1”的两个框调整到同一条水平线上,从第一张幻灯片开始(就像在最后一张幻灯片中一样)
\documentclass{beamer}
\mode<presentation>{\usetheme{Madrid}}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning,decorations.pathmorphing}
\usetikzlibrary{shapes.geometric, arrows}
\usetikzlibrary{arrows.meta,backgrounds,fit,matrix}
\usepackage[utf8]{inputenc}
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=3cm, thick,draw=blue!50, fill=blue!10]
\tikzstyle{box} = [minimum width=3cm, minimum height=1cm, rounded corners,rectangle, fill=blue!50]
\tikzstyle{arrow}= [thick,->,>=stealth]
\begin{document} %For boxes in background
\pgfdeclarelayer{background layer}
\pgfsetlayers{background layer,main}
\begin{frame}[t]%{Cloud}{}
\begin{tikzpicture}[ every edge/.style = {draw, thick, -Stealth}] %
\path (-1,-1)rectangle(1,1);
\node (box11) [box] {1};
\tikzstyle{box} = [minimum width=3cm, minimum height=2.5cm, rounded corners,rectangle, fill=blue!30]
\node<+(1)-> (box12) [box, right of=box11,xshift=6cm] {1};
\tikzstyle{box} = [minimum width=1cm, minimum height=1cm, rounded corners,rectangle, fill=blue!50]
\draw<.(1)-> [arrow] (box11.east) -- (box12.west);
\begin{pgfonlayer}{background layer}
\node<.(1)-> [cloud, draw, align=left, cloud puffs=20,cloud puff arc=110, aspect=2, inner sep=0mm,fit= (box12) (box12)]{3};
\end{pgfonlayer}
\node<+(1)-> (box13) [box, right of=box12,yshift=-0.7cm] {2};
\end{tikzpicture}
\end{frame}
\end{document}
答案1
这是因为 3 张幻灯片的边界框并不相同。要找到足够大的框,只需绘制一个包含 3 张幻灯片的矩形即可。
\path[use as bounding box] (-1.5,2.2)rectangle(10.7,-2.2);
%\draw (-1.5,2.2)rectangle(10.7,-2.2); %<- bounding box
\documentclass{beamer}
\mode<presentation>{\usetheme{Madrid}}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning,decorations.pathmorphing} \usetikzlibrary{shapes.geometric, arrows} \usetikzlibrary{arrows.meta,backgrounds,fit,matrix}
\usepackage[utf8]{inputenc}
\tikzstyle{process} = [rectangle, minimum width=3cm, minimum height=1cm, text centered, text width=3cm, thick,draw=blue!50, fill=blue!10]
\tikzstyle{box} = [minimum width=3cm, minimum height=1cm, rounded corners,rectangle, fill=blue!50]
\tikzstyle{arrow}= [thick,->,>=stealth]
\begin{document} %For boxes in background
\pgfdeclarelayer{background layer}
\pgfsetlayers{background layer,main}
\begin{frame}[t]%{Cloud}{}
\begin{tikzpicture}[ every edge/.style = {draw, thick, -Stealth}] %
\path[use as bounding box] (-1.5,2.2)rectangle(10.7,-2.2);
%\path (-1.5,2.2)rectangle(10.7,-2.2);
\node (box11) [box] {1};
\tikzstyle{box} = [minimum width=3cm, minimum height=2.5cm, rounded corners,rectangle, fill=blue!30]
\node<+(1)-> (box12) [box, right of=box11,xshift=6cm] {1};
\tikzstyle{box} = [minimum width=1cm, minimum height=1cm, rounded corners,rectangle, fill=blue!50]
\draw<.(1)-> [arrow] (box11.east) -- (box12.west);
\begin{pgfonlayer}{background layer}
\node<.(1)-> [cloud, draw, align=left, cloud puffs=20,cloud puff arc=110, aspect=2, inner sep=0mm,fit= (box12) (box12)]{3};
\end{pgfonlayer}
\node<+(1)-> (box13) [box, right of=box12,yshift=-0.7cm] {2}; \end{tikzpicture}
\end{frame}
\end{document}