2

Thanks to your help I was able to create some basic things with TikZ. However I run into trouble when creating a larger image without all straight lines. I dont know how to get the line between the box EIB and Parter Re through BNP. I'm also struggling a bit with getting the text nice but that is not my main issue. It would be great if someone could give some advice! It will be appreciated

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows, positioning, quotes}

\begin{document}
\begin{tikzpicture}[
    node distance=10mm and 29mm,
box/.style = {draw, minimum height=35mm, minimum width=20mm, align=center},
sy+/.style = {yshift= 2mm}, 
sy-/.style = {yshift=-2mm},
every edge quotes/.style = {align=center}
                        ]
\node (n1) [box]             {\textbf{Investor}};                        
\node (n2) [box,right=of n1] {\textbf{EIB}};
\node (n3) [box,right=of n2] {\textbf{BNP}};
\node (n4) [box,below=of n3,minimum height=20mm] {\textbf{Partner Re}};
%
\draw[very thick,->, transform canvas={yshift=2em}]  
    ([sy+] n1.east) to [above,"Issue price  \\ \hspace{2cm} \\ \hspace{2cm}"] ([sy+] n2.west);
\draw[very thick, dashed,->,transform canvas={yshift=-2em}]  
    ([sy-] n2.west) to [below," \hspace{2cm} \\ \hspace{2cm} \\ Notional $\times$ realized mortality rate"] ([sy-] n1.east);

    \draw[very thick,->, transform canvas={yshift=2em}]  
    ([sy+] n2.east) to [above,"\footnotesize Interest rate swap  \\ \hspace{2cm} \\ \hspace{2cm}"] ([sy+] n3.west);
\draw[very thick, dashed,->,transform canvas={yshift=2em}]  
    ([sy-] n3.west) -- ([sy-] n2.east);
    \end{tikzpicture}    
\end{document}

enter image description here

enter image description here

1

For a start, you can make life easier if you give good names to the nodes, e.g. n1 => inv, n2 => eib, n3 => bnp, n4 => pre.

Then the line from eib through bnp to pre can be done with:

\draw[->] ([yshift=-1cm]eib.east) -- ([shift={(4mm,-1cm)}] bnp.center) -- ([xshift=4mm]pre.north);
  • Thanks, this really helped me in being able to bend and shift lines – Tim Dec 1 '16 at 12:46
2

I changed a few small things:

  • Renamed nodes mnemotechnically.
  • Removed transform canvas. (What's the purpose?)
  • Removed the quotes library. (Doesn't hurt, but what is the advantage?)

The "bent" lines can be accomplished by using -| instead of -- in the draw command, like this:

\draw[<-] ([sY-] eib.east) -| ([sx-]pre.north);
\draw[->] ([sy-] eib.east) -| ([sx+]pre.north);

enter image description here

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows, positioning}
\begin{document}
\begin{tikzpicture}%
   [node distance=10mm and 29mm,
    >=stealth,
    box/.style = {draw, minimum height=35mm, minimum width=20mm, align=center},
    sY+/.style = {yshift= 1cm}, 
    sy+/.style = {yshift= 0.8cm}, 
    sY-/.style = {yshift=-1cm},
    sy-/.style = {yshift=-0.8cm},
    sx+/.style = {xshift=3mm},
    sx-/.style = {xshift=-3mm},
   ]
\node (inv) [box]              {\textbf{Investor}};                        
\node (eib) [box,right=of inv] {\textbf{EIB}};
\node (bnp) [box,right=of eib] {\textbf{BNP}};
\node (pre) [box,below=of bnp,minimum height=20mm] {\textbf{Partner Re}};

\draw[very thick,->]  
   ([sY+] inv.east) -- node[above,yshift=8mm]{Issue price} ([sY+] eib.west);
\draw[very thick,<-,dashed]  
   ([sY-] inv.east) -- node[below,yshift=-8mm]{Notional $\times$ realized mortality rate} ([sY-] eib.west);

\draw[very thick,->]  
   ([sY+] eib.east) -- node[above,yshift=8mm]{\footnotesize Interest rate swap} ([sY+] bnp.west);
\draw[very thick,<-,dashed]
   ([sy+] eib.east) -- ([sy+] bnp.west);

\draw[<-] ([sY-] eib.east) -| ([sx-]pre.north);
\draw[->] ([sy-] eib.east) -| ([sx+]pre.north);
\end{tikzpicture}    
\end{document}
  • Thank you, I didn't know what transform canvas did, I found it somewhere and think it helped with something I guess! – Tim Dec 1 '16 at 12:46

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.