我是 LaTeX 新手,在创建表格方面遇到了困难。附件是使用 Word 创建的表格。有人能帮我在 LaTeX 中按原样创建这个表格吗?
我尝试过,但无法将箭头和所有内容连接在一起。
我迄今为止的代码:
\begin{center}
\setlength\extrarowheight{2.5pt}
\begin{tabular}{ " c | c | c | c | c | c | c" }
\hlinewd{1.5pt}
\rowcolor{LightCyan}
\small\textit{g(t+0)} & \small\textit{g(t+1)} & \small\textit{g(t+2)} & \small\textit{f(t+3)} & \small\textit{f(t+4)} & \small\textit{g(t+5)} & \small{...}\\[2.5pt]
\hlinewd{1.5pt}
\end{tabular}
\end{center}
答案1
这是通过 进行的尝试TikZ
。这里定义了 2 种线条样式和 2 种框样式来满足颜色和大小要求。线条要求的原因相同。
代码
\documentclass[border=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning}
\begin{document}
\tikzset{
linea/.style ={draw,-stealth', rounded corners=1pt, line width=2pt},
lineb/.style ={draw,-stealth', rounded corners=1pt, line width=2pt,color=blue!40!white},
cell/.style = {rectangle, draw, fill=gray!60!white, text width=2cm,outer sep=0pt},
cellx/.style = {rectangle,draw, fill=red!30!white, text width=1.5cm,outer sep=0pt}
}
\begin{tikzpicture}[
every node/.style={text centered, minimum height=2.5em, minimum width=1.5cm,node distance=0pt}
]
\node at (0,0) [cell] (n0) {$g(t+0)$};
\node[right=of n0,cell] (n1) {$g(t+1)$};
\node[right=of n1,cell] (n2) {$g(t+2)$};
\node[right=of n2,cell] (n3) {$g(t+3)$};
\node[right=of n3,cell] (n4) {$g(t+4)$};
\node[right=of n4,cell] (n5) {$g(t+5)$};
\node[right=of n5,cell] (n6) {$\cdots$};
%
\node[below left = 1 cm and 1cm of n0.east,cellx] (nn1) {$s(t+0)$};
\node[below left = 1 cm and 1cm of n1.east,cellx] (nn2) {$s(t+1)$};
\node[below left = 1 cm and 1cm of n2.east,cellx] (nn3) {$s(t+3)$};
\node[below left = 1 cm and 1cm of n3.east,cellx] (nn4) {$s(t+3)$};
\node[below =0.5 cm of n4,cellx] (nn5) {$s(t4)$};
\draw[linea](nn2.west)-|([xshift=0.3cm]n0.south);
\draw[linea](nn3.west)-|([xshift=0.3cm]n1.south);
\draw[linea](nn4.west)-|([xshift=0.3cm]n2.south);
\draw[linea](nn5.east)-|(n5.south)node[right,midway]{Extracted Models};
\draw[lineb]([xshift=-0.75cm]n0.south)-|(nn1.north);
\draw[lineb]([xshift=-0.75cm]n1.south)-|(nn2.north);
\draw[lineb]([xshift=-0.75cm]n2.south)-|(nn3.north);
\draw[lineb](n4.south) -| (nn5.north) ;
\end{tikzpicture}
\end{document}