2

having got very useful help to my posts here and here I have been able to find a number of documents on drawing trees. However it is taking me time to link all the nodes at the top of the tree (at the bottom since the tree is growing down) into one node. I would appreciate a quick fix of this, if what am trying to do is possible. In the mwe below I want to have only one node from x and y, to x

\documentclass[12pt]{report}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}[inner sep=1.5pt]
\node (10) {z=F(x,y)}
[ auto,
sibling distance=2.4cm,
level distance=2cm,
level 2/.append style={
sibling distance=1.8cm,
level distance=1.5cm
    },
    edge from parent/.append style={nodes={pos=.6}}
  ]
  child { node {x}
    child { node {x}
      edge from parent node[swap]{$\frac{dx}{dx}=1$}
    }
    edge from parent node[swap]{$\frac{\partial z}{\partial x}=F_{x}$}
  }
  child { node {y}
    child { node {x}
      edge from parent node{$\frac{dy}{dx}$}
    }
    edge from parent node{$\frac{\partial z}{\partial y}=F_{y}$}
}
;
\end{tikzpicture}
\end{document}
2

For a diagram like that I wouldn't use a tree at all. Instead, I'd use tikz-cd.

enter image description here

\documentclass[12pt]{report}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[row sep=1.5cm,column sep=0.3cm,every arrow/.append style={dash}]
& z=F(x,y)
  \arrow[ld,swap,"\frac{\partial z}{\partial x} = F_{x}"]
  \arrow[rd,"\frac{\partial z}{\partial y} = F_{x}"]
& \\
x
  \arrow[rd,swap, "\frac{dx}{dx} = 1"]
 & & y 
  \arrow[ld,"\frac{dy}{dx}"]
\\
& x & \\
\end{tikzcd}
\end{document}
  • Thank you very much @Torbjørn. This does exactly what I want. I really appreciate. – Zilore Mumba May 25 '17 at 20:05

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.