3

I have used paint editor to create a scheme but I'm not satisfied by the result. So I decided to use Tikz. I haven't found any good tutorial, the ones I'm reading gives the commands without explaining what the signification of the symbols. Here's the scheme I want to do :

enter image description here

I started like this :

\begin{tikzpicture}
\node[rectangle, draw, text width={3.5cm},  minimum height={6cm}, text centered] (l) {l};
\node[rectangle, draw, text width={3.5cm},  minimum height={6cm}, text centered, below right=0cm and 2cm of l.north east] (r) {r};
\draw[->] (l.center) -- (r.center); % Problem : How to connect the left side of l with the right side of r?
\draw[->] (r.160) -- (l.160);
\end{tikzpicture}

Can someone guide to do that. For example how to draw rectangles inside another rectangle. Make a list of text above an arrow. And anything that you think that will help to do my scheme.

Is there a good tutorial where I can learn using Tikz. Thanks for the help

7
  • 1
    Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}.
    – user31729
    Apr 18, 2014 at 10:27
  • 4
    tikz has a very large documentation with a lots of examples. Look for pgfmanual.pdf on your system. Apr 18, 2014 at 10:29
  • mirrors.ctan.org/graphics/pgf/base/doc/pgfmanual.pdf contains some introductory examples which can be used as a starting point
    – user31729
    Apr 18, 2014 at 10:29
  • 1
    Yes, and here you find the minimal introduction in pdf, further than the heavy latest version of the manual, which is richest of examples similar to yours. Yo may need \usetikzlibrary{arrows} for thin arrows. Apr 18, 2014 at 12:59
  • Thanks, I'm trying to do it but it's difficult. Could you tell me how to print the 'MEANS' text below the top line. I succeeded to print it but above the line by using this code :\node[fit=(inOut)(api)(logiciel), draw, label={[inner sep=0pt,minimum height=2ex]above:MEANS}] (rside) {};
    – Hunsu
    Apr 18, 2014 at 13:06

1 Answer 1

8

This is an attempt, hoping it will help. b style means horizontal box, c style is for vertical box, ar is line style, and myarrow style is for the two-colored arrow.

enter image description here

Code

\documentclass[border=10pt]{standalone}
%\usepackage[margin=1cm]{geometry}
\usepackage{tikz,xcolor}
\usetikzlibrary{shapes.geometric,arrows,positioning,fit,calc,}
\tikzset{
b/.style={draw, rectangle, rounded corners=2ex,minimum height=0.5in, minimum width=2in,align=center},
c/.style={draw, rectangle, rounded corners=2ex, minimum height=0.5in, minimum  width=2in,align=center, rotate=-90},
ar/.style={rounded corners=2ex,->,>=latex },  
myarrow/.style args={#1 colored by #2 and #3}{
    -stealth,line width=#1,#2,postaction={draw,-stealth,#3,line width=(#1)/3,
    shorten <=(#1)/3,shorten >=2*(#1)/3}, 
  }
}

\begin{document}
\begin{tikzpicture} 
    \node (block1) [b] {Application InOut};
    \node (block2) [b,below= 4cm of block1] {Logical de calcul \\ d'indicateurs};
    \node (block3)[c, right=2cm of block1]  {API Java \\ \color{red} (requetes, recuperation \\ \color{red}desresulats)};
% connections within block A
\draw[ar] ([xshift=-1cm]block1.south) --++ (0,-2cm) -- ++(1,0) -- ([xshift=-1cm]block2.north);
\draw[ar] ([xshift= 1cm]block1.south) |- ([yshift=1cm]block3.south);
\draw[ar] ([yshift=-1cm]block3.south) -| (block1.south);
\node (block4) [c,right=9cm of block1] {Services Web \\ \color{red} (REST)};
\node (block5) [c, right= 11cm of block1] {MicMac \\ \color{red} (simulation)};
% connections within block B
\draw[ar] ([yshift=0.5cm]block4.north)  -- ([yshift=0.5cm]block5.south);
\draw[ar] ([yshift=-0.5cm]block5.south) -- ([yshift=-0.5cm]block4.north);
% connection between blocks A and B
\draw[ar] ([yshift=0.5cm]block3.north)  -- node[above]{\parbox[t]{3cm}{- Choix du scenario\\
- Fichiers meteo}} ([yshift=0.5cm]block4.south);
\draw[ar] ([yshift=-0.5cm]block4.south) --node[below]{\parbox[t]{3cm}{- Apport d'zaote \\
- Apport de pesticide}} ([yshift=-0.5cm]block3.north);
\node(n1)[draw,fill opacity=0.2,fill=blue, fit=(block1)(block2)(block3),inner sep=3em,
label={[inner sep=0pt,yshift=-0.5cm]above:MEANS}
]{};
\node(n2)[draw,fill opacity=0.2,fill=blue, fit=(block4)(block5),inner sep=3em,
label={[inner sep=0pt,yshift=-0.5cm]above:RECORD}
]{};
\draw[myarrow=10pt colored by blue!50!white and white] (block2.south) --node[right,xshift= 0.2cm](){\color{red} (Indicateurs)} ++(0,-1.5cm);
\end{tikzpicture}
\end{document}
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .