4

I want to draw following figure, reference SLURM page-6.

enter image description here

I was not able to find any example for computer science figures like this one. I was wondering is there any pre-defined shape for this in the shapes library or anything similiar to look like a desktop computer?


4
  • There isn't one. Do you need to connect lines directly to the border or do you only need to place these nodes in your diagram? Aug 1 at 9:42
  • If I understand your question correctly,I want to place this node in my diagram where there could be multiple nodes connect via arrows.
    – alper
    Aug 1 at 9:52
  • Yes, you did. Only a proper shape can do this correctly automatically. Which raises the question on how the border of the shape is defined and how one can calculate it. (The math isn't very complex, you just need to write it down in a PGF-way.) Is it just another slim rectangle attached to the bottom of another rectangle? Aug 1 at 10:04
  • Ah I got your point :) The behind rectangle border could be bolder probably double thickness
    – alper
    Aug 1 at 10:22

1 Answer 1

5

As already mentioned in the comments, there is probably no predefined node of this kind. Yet it is easy to create something that looks like the screen shot.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[compute/.style={draw,thick,font=\sffamily,
    append after command={
    (\tikzlastnode.south west) edge[double=gray!50,double distance=3pt,
        line cap=rect,
        shorten >=-2pt,shorten <=-2pt] 
    (\tikzlastnode.south east)}}]
 \node[compute] (n1) {Node};    
 \node[compute,right=2cm of n1] (n2) {More text};   
 \draw[thick,-stealth] (n1) -- (n2);
\end{tikzpicture}
\end{document}

enter image description here

4
  • 1
    Why do we use \tikzlastnode.south west ?
    – alper
    Aug 1 at 10:14
  • \tikzlastnode is the last node, i.e. the node that gets created, and south west is its lower left corner (as long as the node does not get rotated).
    – user277428
    Aug 1 at 10:27
  • If there is not text inside the rectangle can we also align it width?
    – alper
    Aug 1 at 12:29
  • 1
    You can use something like \node[compute,minimum width=2cm,minimum height=1em] (n1) {};, or \node[compute] (n1) {\phantom{Node}};.
    – user277428
    Aug 1 at 17:29

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.