在 tikz 数组上写入

在 tikz 数组上写入

我有这个数组。我需要在每个单元格上写东西。例如,我必须在数组上写“S”和“E”,而不是在里面。有人能帮我吗?

\begin{tikzpicture}[>=latex,font=\sffamily,every node/.style={minimum width=1cm,minimum height=1.5em,outer sep=0pt,draw=black,semithick}]
\node []at (0,0) (A) {};
\node [anchor=west] at (A.east) (B) {};
\node [anchor=west,fill=black!20] at (B.east) (C) {S};
\node [anchor=west,fill=black!20] at (C.east) (D) {};
\node [anchor=west] at (D.east) (E) {E};
\node [anchor=west] at (E.east) (F) {};
\node [anchor=west] at (F.east) (G) {};
\draw [->,shorten >=2pt,shorten <=2pt,semithick] (G.south) -- +(0,-1em) -| (A);
\end{tikzpicture}

在此处输入图片描述

答案1

你是指那样的事情吗?

\begin{tikzpicture}[>=latex,font=\sffamily,every node/.style={minimum width=1cm,minimum height=1.5em,outer sep=0pt,draw=black,semithick}]
\node []at (0,0) (A) {};
\node [anchor=west] at (A.east) (B) {};
\node [anchor=west,fill=black!20] at (B.east) (C) {S};
\node [anchor=west,fill=black!20] at (C.east) (D) {};
\node [anchor=west] at (D.east) (E) {E};

\node [draw=none,above] at (E.north) {Test};

\node [anchor=west] at (E.east) (F) {};
\node [anchor=west] at (F.east) (G) {};
\draw [->,shorten >=2pt,shorten <=2pt,semithick] (G.south) -- +(0,-1em) -| (A);
\end{tikzpicture}

在此处输入图片描述

相关内容