我的问题是关于在乳胶中创建这棵精确的树。
我尝试了几种方法,但没有结果。
我的代码如下
\documentclass[a4paper,12pt,twosided]{book}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[sibling distance=9em,
every node/.style = {shape=rectangle, rounded corners,
draw, align=center,
top color=white, bottom color=blue!20}]]
\node {Numri i firmave ?}[a]
child { node {1 firm\"e}
child { node {}
child {node{monopol}}}}
child { node {Pak firma}
child {node {}
child {node {oligopol}}}
}
child { node {Shum\"e firma}
child { node {lloji i produktit}
child{node {konk monop}}
child{node {konk e plt}
}}};
\end{tikzpicture}
\end{document}
答案1
你的MWE和你的图不完全一样,我遵循的是前者。
\documentclass[a4paper,12pt,twosided]{book}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{figure}[ht]
\centering
\begin{tikzpicture}[
sibling distance=10em,
mynode/.style = {
shape=rectangle, rounded corners,
draw, align=center,
top color=white, bottom color=blue!20
},
myquest/.style = {shape=rectangle, draw, align=center,
fill=blue!20},
]
\node[myquest] {Numri i firmave ?}
child { node[mynode, yshift=-4em] (monop) {monopol}
edge from parent
node[left=16pt] {1 firm\"e}
}
child {node[mynode, right=of monop] (olig){oligopol} edge from parent node[right] {Pak firma}}
child {
node[myquest] {lloji i produktit}
child{node[mynode, right=of olig] (monocomp) {konk monop}}
child{node[mynode, right=of monocomp] {konk e plt}}
edge from parent node[above right] {Shum\"e firma}
};
\end{tikzpicture}
\caption{A figure from your MWE}
\end{figure}
\end{document}