我们可以在 中重现此图像LaTeX
吗?我有一些想法
\usepackage{tikz}
\usetikzlibrary{positioning,fit,shapes.geometric,backgrounds,matrix,calc,shapes}
但到目前为止我还无法实现这一点,因为我还不熟悉LaTeX
。
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix,calc,decorations.pathreplacing,shapes.misc}
\tikzset{
module/.style={draw, rectangle, fill=white, minimum size=1em,outer sep=0,inner sep=0},
mycross/.style={path picture={
\draw[#1] (path picture bounding box.south west) rectangle (path picture bounding box.north east);
\draw[#1] (path picture bounding box.south west) -- (path picture bounding box.north east);
\draw[#1] (path picture bounding box.south east) -- (path picture bounding box.north west);
}}
}
\begin{document}
\begin{tikzpicture}
\tikzset{column align/.style 2 args={column #1/.append style={nodes={execute at begin
node={\setbox\matrixcellbox=\hbox\bgroup},
execute at end
node={\egroup\eqmakebox[\tikzmatrixname\the\pgfmatrixcurrentcolumn][#2]{\copy\matrixcellbox}}}}}}
\matrix[fill=black!20, matrix of nodes, nodes={module,anchor=center},
row sep=-\pgflinewidth,column sep=-\pgflinewidth
]
{
Y & Y & Y \\
Y & Y & |[mycross]| \\
Y & Y & Y \\
};
\end{tikzpicture}
\end{document}
当前结果:
答案1
不需要任何这些库。从简单的节点路径开始。
\documentclass{standalone}
\usepackage{tikz}
\tikzset{
mynode/.style args={#1/#2/#3/#4/#5}{
#1,
fill=#2,
rounded corners=#5,
minimum height=#3,
minimum width=#4,
font=\sffamily\Large,
},
}
\begin{document}
\begin{tikzpicture}
\node (a) [mynode=/gray!15/3cm/18cm/10pt] {};
\node (b) [mynode={white,right=1cm}/blue/2cm/5.5cm/0pt] at (a.west) {Data File};
\coordinate (tmp) at (b.east);
\foreach \word/\col in {Parameter\\file/green,Control\\ File/green!50!black,Password\\File/blue!30,Archive Log\\File/purple}
\node (tmp) [mynode={white,anchor=west,right=3pt,align=center}/\col/2cm/2.5cm/0pt] at (tmp.east) {\word};
\end{tikzpicture}
\end{document}