我正在尝试设计如下图所示的一系列图表。到目前为止,我已经做到了这么多。
\documentclass{beamer}
\usepackage{mathtools}
\usepackage{array}
\usepackage{amsmath}
\usepackage{tikz}
%\usetheme{Boadilla}
\usetheme{Warsaw}
\setbeamercolor{structure}{fg=cyan!90!black}
\begin{document}
\begin{frame}
\frametitle{}
\[
\setlength{\extrarowheight}{3pt}% local setting
\begin{array}{l|*{5}{l}}
\cdot & & & & & \\
\hline
& & & & & \\
& & & & & \\
& & & & & \\
& & & & & \\
& & & & & \\
\end{array}
\]
\begin{center}
\begin{tikzpicture}
\draw[draw=black] (16.1,5.5) rectangle ++(2,3);
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
答案1
作为tizpicture
,使用pic
和 TikZ 库arrows.meta
,positioning
以及shapes.symbols
:
\documentclass{beamer}
%\usetheme{Boadilla}
\usetheme{Warsaw}
\setbeamercolor{structure}{fg=cyan!90!black}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools} % it load amsmath
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
positioning,
shapes.symbols
}
\begin{document}
\begin{frame}
\frametitle{Process \dots}
\centering
\begin{tikzpicture}[
node distance = 9mm,
arr/.style = {-Stealth, semithick, shorten > = 1mm, shorten < = 1mm},
box/.style = {draw, minimum height=3cm, minimum width=2cm},
oblak/.style = {cloud, draw, aspect=2},
TAB/.pic = {\draw (0,0) -- (1.5,0);
\draw (0.5,0.5) -- (0.5,-2.5);
\coordinate (-w) at (1.5,-1);
}
]
\pic (n1) at (0,0) {TAB};
\node (n2) [box, right=of n1-w] {text};
\node (n3) [oblak, right=of n2] {text};
\node (n4) [box, right=of n3] {text};
\draw[arr] (n1-w) edge (n2) (n2) edge (n3) (n3) to (n4);
\end{tikzpicture}
\end{frame}
\end{document}
附录:
在这种情况下,array
您的 MWE 旨在用圆顶文本填充,而必须像以下 MWE 中那样pic
进行替换:array
\documentclass{beamer}
%\usetheme{Boadilla}
\usetheme{Warsaw}
\setbeamercolor{structure}{fg=cyan!90!black}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{mathtools} % it load amsmath
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
positioning,
shapes.symbols
}
\begin{document}
\begin{frame}
\frametitle{Process \dots}
\centering
\begin{tikzpicture}[
node distance = 9mm,
arr/.style = {-Stealth, semithick, shorten > = 1mm, shorten < = 1mm},
box/.style = {draw, minimum height=3cm, minimum width=2cm},
oblak/.style = {cloud, draw, aspect=2},
]
\node (n1) [box, draw=none] {$\begin{array}{c|ccc}
x & 1 & 2 & 3 \\ \hline
&&& \\
&&& \\
&&&
\end{array}$};
\node (n2) [box, right=of n1] {text};
\node (n3) [oblak, right=of n2] {text};
\node (n4) [box, right=of n3] {text};
\draw[arr] (n1) edge (n2) (n2) edge (n3) (n3) to (n4);
\end{tikzpicture}
\end{frame}
\end{document}
其生产成果为:
答案2
这是一个使用tabular
和shrink
选项的解决方案frame
。
\documentclass{beamer}
\usepackage{mathtools}
\usepackage{array}
\usepackage{amsmath}
\usepackage{tikz}
%\usetheme{Boadilla}
\usetikzlibrary{decorations.pathmorphing}
\usetheme{Warsaw}
\setbeamercolor{structure}{fg=cyan!90!black}
\begin{document}
\begin{frame}[shrink=30]
\frametitle{}
\begin{center}
\begin{tabular}{c c c c c c c c c}
\setlength{\extrarowheight}{3pt}% local setting
$\begin{array}{l|*{5}{l}}
\cdot & & & & & \\
\hline
& & & & & \\
& & & & & \\
& & & & & \\
& & & & & \\
& & & & & \\
\end{array} $
& $\to$ &
\begin{tikzpicture}[baseline=1.5cm]
\draw[draw=black] (0,0) rectangle ++(2,3);
\node at (1,1.5) {text1};
\end{tikzpicture}
& $\to$ &
\begin{tikzpicture}[baseline=0cm]
\draw plot[domain=0:350, smooth cycle] (\x:1+rnd*0.5);
\node at (0,0) {text2};
\end{tikzpicture}
& $\to$ &
\begin{tikzpicture}[baseline=1.5cm]
\draw[draw=black] (0,0) rectangle ++(2,3);
\node at (1,1.5) {text3};
\end{tikzpicture}
& $\to$ &
\begin{tikzpicture}[baseline=0cm]
\node at (0,0) {text4};
\end{tikzpicture}
\end{tabular}
\end{center}
\end{frame}
\end{document}
结果如下:
文本和箭头的垂直对齐方式可能不令您满意,但您可以使用环境baseline
选项进行调整tikzpicture
。我也很懒,将最后的文本单独放在了 中tikzpicture
,但不必如此,尽管这样您会遇到更多对齐问题(这反过来也可以用 解决\raisebox
,但效果并不好)。
您可以制作更长的箭,\longrightarrow
或者只制作一tikz
支箭,其长度 / 样式任意。
不规则形状直接取自这个答案。