![按照定义的距离垂直重复放置盒子](https://linux22.com/image/400309/%E6%8C%89%E7%85%A7%E5%AE%9A%E4%B9%89%E7%9A%84%E8%B7%9D%E7%A6%BB%E5%9E%82%E7%9B%B4%E9%87%8D%E5%A4%8D%E6%94%BE%E7%BD%AE%E7%9B%92%E5%AD%90.png)
使用以下代码
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{verbatim}
\usepackage{tikz}
\begin{document}
\begin{frame}[t]
\frametitle{}
\newsavebox{\recA}
\savebox{\recA}{
\begin{tikzpicture}[scale=.6]
\pgfmathsetmacro{\incrmnt}{1.618*.88}
\draw [thick, black, fill=red] (0,0) rectangle +(1,\incrmnt);
\end{tikzpicture}}
\newsavebox{\recB}
\savebox{\recB}{
\begin{tikzpicture}[scale=.6]
\pgfmathsetmacro{\inc}{1.618*.88*2}
\draw [thick, black, fill=red] (0,0) rectangle +(1,\inc);
\end{tikzpicture}}
\begin{tikzpicture}[scale=1]
\foreach \X in {1,3,5,7}
{\node[blue] (y-\X) at (0,\X){\usebox{\recB}};}
\end{tikzpicture}
\begin{tikzpicture}[scale=1]
\foreach \X in {1,...,4}
{\node[blue] (y-\X) at (0,\X){\usebox{\recA}};}
\end{tikzpicture}
\end{frame}
\end{document}
生成了下图。它取决于缩放比例和 foreach 序列;这无法让我精确控制框之间的垂直和水平间距。
我想以精确的垂直间距重复矩形,以使其看起来像下图。