
Aqui está o meu código, que foi compilado por pdflatex.
\documentclass[11pt]{article}
\usepackage[a5paper,margin=5pt]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{tikz-qtree}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=.6]\Tree
[.(0,0)
[.(0,1)
[.(1,1)
[.(1,2)\\$\downarrow$\\(2,0)
[.(3,0)
[.(4,0)\\$\downarrow$\\\textcolor{olive}{(1,3)} ]
[.\textcolor{olive}{(3,1)} ]
]
[.\textcolor{cyan}{(2,1)} ]
]
[.\textcolor{cyan}{(2,1)} ]
]
[.(0,2)
[.(0,3)
[.(1,3)\\$\downarrow$\\\textcolor{purple}{(4,0)} ]
[.\textcolor{purple}{(0,4)} ]
]
[.(1,2)\\$\downarrow$\\(2,0)
[.(3,0)
[.(4,0)\\$\downarrow$\\\textcolor{olive}{(1,3)} ]
[.\textcolor{olive}{(3,1)} ]
]
[.\textcolor{cyan}{(2,1)} ]
]
]
]
[.(1,0)
[.(2,0)\\$\downarrow$\\(1,2)
[.(1,3)\\$\downarrow$\\\textcolor{purple}{(4,0)} ]
[.\textcolor{blue}{(2,2)} ]
]
[.(1,1)
[.(1,2)\\$\downarrow$\\(2,0)
[.(3,0)
[.(4,0)\\$\downarrow$\\\textcolor{olive}{(1,3)} ]
[.\textcolor{olive}{(3,1)} ]
]
[.\textcolor{cyan}{(2,1)} ]
]
[.\textcolor{cyan}{(2,1)} ]
]
]
]
\end{tikzpicture}
\end{center}
\end{document}
De acordo com a documentação do pacote, é possível tikz-qtree
o uso de para quebra de linha em nós. \\
Mas o código acima não pode ser compilado corretamente. Se eu mudar as partes que \\
o contêm, funcionará.
Por que é tão? Como posso quebrar linhas em um nó?
Responder1
Parece que você não adicionou
\tikzset{every tree node/.style={align=center,anchor=north}}
depois
\begin{tikzpicture}[scale=.6]
antes de ligar \Tree
. Também, por precaução, verifique \pgfversion
se é> 2.1, como diz a documentação
\documentclass[11pt]{article}
\usepackage[a5paper,margin=5pt]{geometry}
\usepackage{amsmath,amssymb}
\usepackage{tikz-qtree}
\begin{document}
\begin{center}
\begin{tikzpicture}[scale=.6]
\tikzset{every tree node/.style={align=center,anchor=north}}
\Tree
[.(0,0)
[.(0,1)
[.(1,1)
[.(1,2)\\$\downarrow$\\(2,0)
[.(3,0)
[.(4,0)\\$\downarrow$\\\textcolor{olive}{(1,3)} ]
[.\textcolor{olive}{(3,1)} ]
]
[.\textcolor{cyan}{(2,1)} ]
]
[.\textcolor{cyan}{(2,1)} ]
]
[.(0,2)
[.(0,3)
[.(1,3)\\$\downarrow$\\\textcolor{purple}{(4,0)} ]
[.\textcolor{purple}{(0,4)} ]
]
[.(1,2)\\$\downarrow$\\(2,0)
[.(3,0)
[.(4,0)\\$\downarrow$\\\textcolor{olive}{(1,3)} ]
[.\textcolor{olive}{(3,1)} ]
]
[.\textcolor{cyan}{(2,1)} ]
]
]
]
[.(1,0)
[.(2,0)\\$\downarrow$\\(1,2)
[.(1,3)\\$\downarrow$\\\textcolor{purple}{(4,0)} ]
[.\textcolor{blue}{(2,2)} ]
]
[.(1,1)
[.(1,2)\\$\downarrow$\\(2,0)
[.(3,0)
[.(4,0)\\$\downarrow$\\\textcolor{olive}{(1,3)} ]
[.\textcolor{olive}{(3,1)} ]
]
[.\textcolor{cyan}{(2,1)} ]
]
[.\textcolor{cyan}{(2,1)} ]
]
]
]
\end{tikzpicture}
\end{center}
\end{document}