答案1
使用TikZ
;以我的代码为例,您可以添加缺失的箭头:
代码:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning}
\begin{document}
\begin{tikzpicture}[
verbox/.style={
draw,
minimum height=1cm,
text width=10pt
},
data/.style={
draw,
minimum height=20pt,
text width=1cm,
align=center,
label={center:Data}
},
arr/.style={
->,
>=latex
}
]
\matrix[
matrix of nodes,
row sep=-\pgflinewidth,
nodes={
text width=3cm,
minimum height=25pt,
align=center,
draw
}
]
(mat)
{
|[name=mode]|Mode \\
|[name=owner]|Owner Info \\
|[name=size]|Size \\
|[minimum height=2.5cm,name=dirbl]|Direct Blocks \\
|[name=indbl]|Indirect Blocks \\
|[name=douin]|Double Indirect \\
|[name=triin]|Triple Indirect \\
};
\node[verbox,right=of mat]
at ([yshift=-30pt]mat.east)
(verl1)
{};
\node[verbox,below=10pt of verl1]
(verl2)
{};
\node[verbox,right=of verl2]
(verr1)
{};
\node[verbox,below=10pt of verr1]
(verr2)
{};
\node[data,right=of verr2]
(data8)
{};
\node[data,above=10pt of data8]
(data7)
{};
\node[data,above=10pt of data7]
(data6)
{};
\node[data,above=10pt of data6]
(data5)
{};
\node[data,above=10pt of data5]
(data4)
{};
\node[data,above=10pt of data4]
(data3)
{};
\node[data,above=10pt of data3]
(data2)
{};
\node[data,above=10pt of data2]
(data1)
{};
\draw[arr]
(indbl.east) -- ++(20pt,0pt) |- ([yshift=-5pt]verl1.north west);
\draw[arr]
([yshift=-5pt]verl1.north east) -- ++(20pt,0pt) |- (data4);
\draw[arr]
(verl1.east) -- ++(40pt,0pt) |- (data5);
\draw[arr]
(douin.east) -- ++(20pt,0pt) |- ([yshift=-5pt]verl2.north west);
\draw[arr]
([yshift=-5pt]verl2.north east) -- ([yshift=-5pt]verr1.north west);
\draw[arr]
([yshift=-5pt]verr1.north east) -- ++(20pt,0pt) |- (data6);
\draw[arr]
([yshift=-10pt]dirbl.north east) -- ++(20pt,0pt) |- (data1);
\draw[arr]
([yshift=-20pt]dirbl.north east) -- ++(40pt,0pt) |- (data2);
\end{tikzpicture}
\end{document}
评论
- 左边的块是
matrix of nodes
;每行是一个命名节点;这些名称稍后将用于绘制箭头。 - 所有其他块都是
\node
s。 - 我定义了一些样式来简化代码;一种
data
用于标记为“数据”的块的样式和一种verbox
用于空垂直框的样式。 arr
箭头还有一种样式。- 该
positioning
库允许轻松地将元素相对于已放置的其他元素放置。