Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am trying to do the following diagram but seems that I can't understand the TikZ package:

Diagram

How can i do it?

Im using the following code:

\usepackage{tikz}

\usetikzlibrary{arrows, decorations.markings}
      % for double arrows a la chef
      % adapt line thickness and line width, if needed
      \tikzstyle{vecArrow} = [thick, decoration={markings,mark=at position
      1 with {\arrow[semithick]{open triangle 60}}},
      double distance=1.4pt, shorten >= 5.5pt,
      preaction = {decorate},
      postaction = {draw,line width=1.4pt, white,shorten >= 4.5pt}]
     \tikzstyle{innerWhite} = [semithick, white,line width=1.4pt, shorten >= 4.5pt]


\usetikzlibrary{positioning}

\begin{tikzpicture}
\matrix [column sep=7mm, row sep=5mm] {
  \node (a) [draw, shape=rectangle] {Controlador de Solicitudes}; &
  \node (b) [draw, shape=rectanble] {Receptor Satelital}; &
  \node (c) [draw, shape=rectangle] {Decodificador}; \\
  \node (d) [draw, shape=rectangle] {Almacenamiento de Informacion}; \\
  \node (e) [draw, shape=rectangle] {Transmisor con GPRS}; \\
  \node (f) [draw, shape=rectangle] {Servidor Web}; \\
  \node (g) [draw, shape=rectangle] {Interfaz Web}; \\
  \node (h) [draw, shape=rectangle] {Autentificacion}; \\

};
\draw[->, thick] (a) -- (b);
\draw[->, thick] (b) -- (c);
\draw[->, thick] (c) -- (d);
\draw[->, thick] (d) -- (e);
\draw[->, thick] (e) -- (f);
\draw[->, thick] (f) -- (g);
\draw[->, thick] (g) -- (h);
\draw[->, thick] (h) -- (f);
\draw[->, thick] (a) -- (e);
\draw[->, thick] (e) -- (a);
\end{tikzpicture}
share|improve this question
4  
Could you provide the code of your attempt? And welcome to tex.SE –  Dox Aug 14 at 19:26
1  
If you cannot understand TikZ, you might be able to understand PSTricks. –  stalking is prohibited Aug 14 at 19:26
1  
Edited with the code that im using! Thanks for the welcome. By the way seems that latex is not recognizing the draw command. –  Tomas Campos Aug 14 at 19:38

2 Answers 2

up vote 13 down vote accepted

On the one hand, TikZ is very powerful and comprehensive, on the other hand, it is very hard to find solutions for concrete tasks. In addition, there are often many ways to realize graphics.

I tried to use you existing code and added the code you need to draw the given graphic.

Most things should be clear. Maybe I am wrong, but it seems that you don't have understood how to place content into the matrix. I hope this gets clearer now.

Code

\begin{tikzpicture}

\definecolor{blue1}{HTML}{6095C9}
\definecolor{blue2}{HTML}{55779A}

\matrix [column sep=10mm, row sep=8mm, every node/.style={
    shape=rectangle,
    text width=2.75cm,
    minimum height=1.75cm,
    text centered,
    font=\sffamily\small,
    very thick,
    color=white,
    draw=blue2,
    fill=blue1,
}] {
  \node (a1) {Controlador de solicitudes}; &
  \node (a2) {Receptor Satelital}; &
  \node (a3) {Alimentatión Inteligente}; \\
  &
  \node (b2) {Decodificador desde NMAE a algo}; &
  \node (b3) {Interfaz Web}; \\
  &
  \node (c2) {Almacenamiento de Informacion}; &
  \node[xshift=15mm] (c3) {Autorizar y Autentificar}; \\
  &
  \node (d2) {Transmisor con GMS/GPRS}; &
  \node (d3) {Servidor Web}; \\
};

\begin{scope}[->, very thick, blue1]
  \draw (a1) -- (a2);
  \draw ([xshift=3mm]a1.south) |- ([yshift=3mm]d2.west);
  \draw (a2) -- (b2);
  \draw (b2) -- (c2);
  \draw (c2) -- (d2);
  \draw ([yshift=-3mm]d2.west) -| ([xshift=-3mm]a1.south);
  \draw[-, dashed] (d2) -- (d3);
  \draw ([xshift=5mm]b3.south) -- ([xshift=-10mm]c3.north);
  \draw ([xshift=-10mm]c3.south) -- ([xshift=5mm]d3.north);
  \draw ([xshift=-5mm]d3.north) -- ([xshift=-5mm]b3.south);
\end{scope}

\end{tikzpicture}

Graphic

Diagram

share|improve this answer
    
Perfect. Really usefull. Thanks a lot! –  Tomas Campos Aug 15 at 0:04
    
One little thing is that i don't know why after the \begin{scope}, the -> option is not working. If i delete that works perfect but I just can get all the lines (not the arrows). Do you know what can it be ? –  Tomas Campos Aug 15 at 20:05
    
I don't understand, what you mean. Because of \begin{scope}[->, very thick, blue1] every line inside scope gets an arrow at its end. Why should you delete it? Or do you not want the arrows? –  dawu Aug 15 at 23:06
    
I want the arrows. The problem is that LaTeX tells me that there is an error if i don't delete it. Is there another way to do the arrows ? Thank you ! –  Tomas Campos Aug 15 at 23:12
    
Could you post your complete current file? Maybe you do something before your picture which produces the error. I had no problems compiling my graphic. –  dawu Aug 15 at 23:16

And just for comparison, here is a version in Metapost, using the boxes library, as described in Drawing Boxes with Metapost. The main item of interest here is how to get the boxes drawn with white text on a blue background: you can't use the provided drawboxed command, because this does not let you specify a colour, so I've used the bpath and pic commands to get at the box outlines and contents, respectively.

enter image description here

prologues := 3;
outputtemplate := "%j%c.eps";
% load the boxes library 
input boxes;

% a little bit of plain TeX to wrap text in the boxes
verbatimtex
\def\wrap#1{\let\\\cr\font\sf=cmss10\vbox{\halign{\hfil\strut\sf ##\hfil\cr#1\crcr}}}
etex

beginfig(1);
% define all the box names and text
boxit.con(btex \wrap{Controlador de\\solicitudes} etex);
boxit.rec(btex \wrap{Receptor\\Satellital} etex);
boxit.dec(btex \wrap{Decodifcar desde\\NMEA a algo} etex);
boxit.alm(btex \wrap{Almacenar\\Informaci\'on} etex);
boxit.trx(btex \wrap{Transmisor con\\GMS/GPRS} etex);
boxit.ali(btex \wrap{Alimentaci\'on\\Intellegente} etex);
boxit.inw(btex \wrap{Interfaz Web} etex);
boxit.aya(btex \wrap{Autorizar y\\Autentificar} etex);
boxit.svw(btex \wrap{Servidor Web} etex);

% position the centres relative to each other
con.c + 140 right = rec.c;
rec.c +  80 down  = dec.c;
dec.c +  80 down  = alm.c;
alm.c +  80 down  = trx.c;

con.c + 290 right = ali.c;
ali.c +  80 down  = inw.c;
inw.c +  80 down  = aya.w;
aya.w +  80 down  = svw.c;

% best guess at the required colors
color mid_blue, dark_blue;
mid_blue  = (79/255, 129/255, 189/255); 
dark_blue = (56/255,  93/255, 138/255);

% draw the boxes with blue background and white text
forsuffixes $=con,rec,dec,alm,trx,ali,inw,aya,svw:
  $.ne-$.sw = (89,55); % make them all the same size
  fill bpath $ withcolor mid_blue;
  draw pic   $ withcolor .95white;
  draw bpath $ withcolor dark_blue;
endfor

% draw the lines
drawoptions(withcolor mid_blue);
drawarrow con.e -- rec.w;
drawarrow rec.s -- dec.n;
drawarrow dec.s -- alm.n;
drawarrow alm.s -- trx.n;

z1 = (xpart con.c, ypart trx.c);
drawarrow con.s + 5 right -- z1 + (5,5) -- trx.w + 5 up;
drawarrow trx.w + 5 down  -- z1 - (5,5) -- con.s + 5 left;

draw trx.e -- svw.w dashed evenly;

drawarrow (svw.n -- inw.s)  shifted 10 left;
drawarrow (inw.s -- aya.nw) shifted 10 right;
drawarrow (aya.sw -- svw.n) shifted 10 right;

% draw a rounded frame 
drawoptions(dashed evenly scaled .8 withcolor dark_blue);
draw quartercircle scaled 1cm rotated   0 shifted urcorner currentpicture 
  -- quartercircle scaled 1cm rotated  90 shifted ulcorner currentpicture 
  -- quartercircle scaled 1cm rotated 180 shifted llcorner currentpicture 
  -- quartercircle scaled 1cm rotated 270 shifted lrcorner currentpicture 
  -- cycle ;

endfig;
end.
share|improve this answer
    
Cool! Never heard about Metapost! –  dawu Aug 15 at 22:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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