I'm struggling to generate a Tikz Image… I've progressed so far to generate the following image:
However, I want to generate something like this:
I can't straight the arrow from B to A, nor fix the space between C and the brain image….. here follows my code:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,
decorations.pathreplacing,decorations.pathmorphing,shapes,
matrix,shapes.symbols}
\begin{document}
\tikzset{
>=stealth',
punktchain/.style={
rectangle,
rounded corners,
draw=black, very thick,
text width=22em,
minimum height=3em,
text centered,
on chain},
small punktchain/.style={
rectangle,
rounded corners,
draw=black, very thick,
text width=10em,
minimum height=3em,
text centered,
on chain},
line/.style={draw, thick, <-},
element/.style={
tape,
top color=white,
bottom color=blue!50!black!60!,
minimum width=8em,
draw=blue!40!black!90, very thick,
text width=10em,
minimum height=3em,
text centered,
on chain},
every join/.style={->, thick,shorten >=1pt},
decoration={brace},
tuborg/.style={decorate},
tubnode/.style={midway, right=2pt},
}
\begin{tikzpicture}
[node distance=2.8cm,
start chain=1 going below, start chain=2 going below]
\node[punktchain] (a) {\textbf{A}}
child[<-,thick]{node[small punktchain,anchor=east] (b) {\textbf{B}
}
child{node[on chain, right = 1cm of b] (brain) {\includegraphics[width=.25\textwidth]{brain.png}}
child{node[small punktchain, join,node distance=0.8em] (c) {\textbf{C}}}}}
;
\path [->] (brain.south) to node [near start, right, text width=3em] {\textit{solves}} (c);
\path [->] (a.south) to node [near start, right,text width=2cm] {\textit{Previous Knowledge}} (brain);
\path [] (b.north) to node [near start, right] {\textit{advises}} (a);
\end{tikzpicture}
\end{document}
Best Answer
I think you are trying to use altogether two many tools at the same time:
positioning
,chains
,trees
.... Doing this defeats the primary purpose of using any of them which is to simplify, structure and organise the code, making it more flexible and straightforward.I recommend either using simple
positioning
, perhaps withon grid
, orchains
. This does not seem well-suited to being a tree.For example, here's a way of doing it with
chains
. (You define 2 chains but only ever use 1 of them.) When necessary, I usingpositioning
to place a node and then\chainin
to add it to the chain andjoin
it.example-image-a
is the brains of this operation: