1

I have create the following using Tikz.

\begin{document}
\pagestyle{empty}


% Define block styles

\tikzstyle{block} = [rectangle, draw, fill=white, rounded corners,
                 minimum height=2em, minimum width =7em, text width=5em]
\tikzstyle{line} = [draw, -latex']


\begin{tikzpicture}[node distance = 2cm, auto]
 % Place nodes

\node [block] (strategy) {\footnotesize Multimedia RSs};
\node [block, right of=strategy, node distance=3cm] (content) {\footnotesize Multimedia Content};

% Draw edges

\path [line] (strategy) -- (content);

\end{tikzpicture}
\end{document}

the output looks like this:

enter image description here

I would like the box 'Multimedia Content' to appear on the 'North East' and another box on the 'South East' with arrows that are not oblique (i.e. combination of horizontal and vertical arrows). I am quite new to tikzz so your suggestions are very welcome.

P.s. as you can see the text size are huge although \footnotesize.

Yas
  • 185
  • 2
    As always on this site, please post a full minimal example that others can copy and try without having to add anything. This greatly increases other peoples desire to help – daleif Oct 07 '16 at 10:20
  • 1
    Same as daleif, i don't know with packages and option are loaded, please include a working exemple. – poch Oct 07 '16 at 10:49

2 Answers2

4

There are several ways to do that. There is the chains library of TikZ meant for this kind of drawings, though I think its meant for oblique connections. You can also use the matrix library like in: Any easier way to draw lots of arrows in tikz?, use positioning library and probrably many more.

Anyhow, below is a MWE using matrix because it's easier to have the -| and |- (combination of horizontal and vertical lines) and also a continuation of what you were doing.

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix,positioning,calc}
\tikzset{block/.style={ rectangle,
                        draw,
                        fill=white,
                        rounded corners,
                        minimum height=2em,
                        minimum width =7em,
                        text width=5em},
         >=latex}

\begin{document}
\begin{tikzpicture}
% Using the matrix library
  % Make the grid
  \matrix (Media)[matrix of nodes, nodes in empty cells, column sep=2cm]
  {
                           &                                    &          & Subsubblock \\
                           &                                    & Subblock & \\
                           &                                    &          & Subsubblock \\
                           & |[block]| Multimedia content       &          & \\
                           &                                    &          & Subsubblock \\
                           &                                    & Subblock & \\
                           &                                    &          & Subsubblock \\
  |[block]| Multimedia RSs &                                    &          & \\
                           &                                    &          & Subsubblock \\
                           &                                    & Subblock & \\
                           &                                    &          & Subsubblock \\
                           & |[block]| Other Multimedia content &          & \\
                           &                                    &          & Subsubblock \\
                           &                                    & Subblock & \\
                           &                                    &          & Subsubblock \\
  };

  % Draw the lines
  \draw[->] (Media-2-1) -| +(2cm,0) |- (Media-1-2);
  \draw[->] (Media-2-1) -| +(2cm,0) |- (Media-3-2);

% Somewhat what you were doing - needs positioning and calc libraries
  \begin{scope}[xshift=6cm] %the scope here is just so graphics don't overlap in this example
  \node [block] (strategy) {\footnotesize Multimedia RSs};
  \node [block, above right=1cm of strategy] (content) {\footnotesize Multimedia Content};
  \node [block, below right=1cm of strategy] (content2) {\footnotesize Multimedia Content};

  \draw[->] (strategy) -| ($(strategy)!.5!(content)$) |- (content);
  \draw[->] (strategy) -| ($(strategy)!.5!(content2)$) |- (content2);
  \end{scope}
\end{tikzpicture}
\end{document}

By the way, to me seems like que \footnotesize is working normally.

enter image description here

  • Great. Your answer was very nice and complete. Can you please let me know if instead of two branches, we wish to have 3 or more branches how we can change the code e.g. using matrix ? Thanks – Yas Oct 07 '16 at 11:33
  • @Yas, I edited the answer to better show the \matrix command. If you see it, is much like tabular and the cells have automatic naming like this: (MatrixName-row-column) as you can see in the MWE, so to add more branches, just add more cells. For more Information on this please refer to the Manual as it is very complete and filled with examples. – Guilherme Zanotelli Oct 07 '16 at 11:46
  • In fact, the structure looks very clear to me. However, there is one last issue remaining and that is how can I subbranch from a subbranch. An example, suppose you want to subranch from Multimedia Content into two branches. Can we do this using matrix ? – Yas Oct 07 '16 at 12:15
  • Ah, sorry I think the answer is easy. We can just make a column matrix as you mentioned. – Yas Oct 07 '16 at 12:21
  • Yes, exactly. But that would be the downside of the Matrix way. the bigger the fluxogram the bigger the tabular. Look on the edit, though the subblocks are not properly connected. – Guilherme Zanotelli Oct 07 '16 at 12:26
  • oh, Yes thanks. I think the lines in the code your shared need some change. – Yas Oct 07 '16 at 12:29
  • Indeed, missing &. Did it in a hurry... :/ – Guilherme Zanotelli Oct 07 '16 at 12:33
  • Thanks A lot G.Z. Santos. Very useful discussion. I learned something new today ! – Yas Oct 07 '16 at 12:35
  • Fixed the code. You are very much welcome, if you are up for learning new TikZ tricks, check the manual I linked, it can do things one would dare say impossible in LaTeX. – Guilherme Zanotelli Oct 07 '16 at 12:39
  • 1
    Yes, actually I looked at the manual. It's nice, well-written and through. Many thanks for its introduction ! – Yas Oct 07 '16 at 12:42
3

It seems that you actually draw a tree. Tree can relatively simple to draw by help of tikz library trees or by use of package forest:

\documentclass[tikz,
               border=3mm]{standalone}
\usetikzlibrary{arrows,trees}
\usepackage[edges]{forest}

\begin{document}
    \begin{tikzpicture}[
    node distance = 2cm, 
every node/.style = {rectangle, draw, semithick, rounded corners,
                     inner sep=3mm, font=\footnotesize,
                     align=center},
  level distance = 33mm,
            grow = right,
edge from parent fork right,
edge from parent/.style = {draw, semithick, -stealth},
                        ]
\node {Multimedia\\ RSs}
    child { node {Multimedia\\ Content}}
    child { node {Multimedia\\ Content}}
    ;
    \end{tikzpicture}

  \begin{forest}
    for tree={
      font=\footnotesize,
      draw, semithick, rounded corners,
      align=center,
        inner sep = 3mm,
             edge = {draw, semithick, -stealth},
             grow = east,
    parent anchor = east,
     child anchor = west,
             grow = east,
      forked edge,
             l sep = 12mm% level distance
          fork sep = 6mm,
                }
    [Multimedia\\ RSs
      [Multimedia\\ Content]
      [Multimedia\\ Content]
    ]
  \end{forest}
\end{document}

result with trees:

enter image description here

result with forest

enter image description here

Edit: By help of @cfr the solution using forest is improved with adding fork sep = 6mm to for tree. Now the branching point is on the middle of horizontal distance between nodes.

Zarko
  • 296,517
  • Don't put forked edges in the scope of for tree as it doubles the for tree which sometimes causes problems. Either use forked edge or take it out of for tree. – cfr Oct 10 '16 at 23:48
  • I still learning forest ... this is actually my first try to use it in an answer :-). Now I remember one of yours comments about this problem. However, after your correction code gives unacceptable result, better is write forked edges outside scope for tree. It seems, that I need to ask here a question about issues with forked edge (forked edges) directed to east or west. Than you for correction. – Zarko Oct 11 '16 at 00:48
  • Sorry. I should have tested. I thought they were equivalent. – cfr Oct 11 '16 at 00:57
  • Problems were with parent/child anchors. I add them to code. – Zarko Oct 11 '16 at 00:59
  • Oh, OK. They aren't equivalent. I don't know why I thought that. Using forked edges or specifying the anchor in a direction-agnostic way will make the code more flexible. This is how forked edges does it, in fact, if you look at the library's code. forked edges/.style={ for tree={parent anchor=children}, for descendants={child anchor=parent,forked edge} }, – cfr Oct 11 '16 at 01:03