3

I'm not sure if this is an acceptable kind of question, but figured I'd give it a shot.

I'm trying to replicate a basic diagram using LaTeX (as this one is bad quality), but I'm having trouble figuring out how to start.

EXT2 Diagram

Once I have a starting point (like knowing how to draw the initial box plus an arrow to a smaller box) I think I should be fine.

EDIT: I should add that my attempt so far was drawing the right hand box using a table (as this seemed like the easiest way to to it) but I'm not sure if it would be possible to align arrows and the other smaller boxes next to it.

1
  • Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. Oct 12 '15 at 5:11
7

A starting point using TikZ; taking my code as example you can add the missing arrows:

enter image description here

The code:

\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}

Remarks

  • The block on the left is a matrix of nodes; each row is a named node; those names will be used later to draw the arrows.
  • All other blocks are \nodes.
  • I defined some styles to simplify the code; a data style for the blocks labeled "data" and a verbox style for the empty vertical boxes.
  • There's also an arr style for the arrows.
  • The positioning library allows to easily place elements relatively to other elements already placed.
1
  • Legend! That's perfect. Also thanks for the explanation so that I know how it works. I will come back and up vote this once I've passed the threshold.
    – BSnapZ
    Oct 12 '15 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.