TeX - LaTeX Asked on February 12, 2021
When I use the following code
documentclass{article}
usepackage[edges]{forest}
begin{document}
begin{forest}
for tree={
grow'=east,
anchor=west,
font=itshape,
forked edge,
fork sep = 2mm,
l sep=4mm,
s sep=2mm,
},
s sep=2mm,
delay={ where content={}{coordinate}{}, },
[XXX-root,
[ % 1
[ % 2
[XXX-children-A
[XXX-children-B]
[XXX-children-C]
]
[XXX-children-D]
]
[ % 3
[XXX-children-E]
[XXX-children-F
[XXX-children-G]
[ % 4
[XXX-children-H]
[XXX-children-I]
]
]
]
]
[ % 5
[ % 6
[XXX-children-J]
[XXX-children-K]
]
[ % 7
[XXX-children-L]
[XXX-children-M
[XXX-children-N]
[ % 8
[XXX-children-O]
[ % 9
[XXX-children-P]
[ % 10
[ % 11
[XXX-children-Q]
[XXX-children-S]
]
[ % 12
[XXX-children-T]
[XXX-children-U]
]
]
]
]
]
]
]
]
end{forest}
end{document}
Everything works fine. However, if I change the text in the nodes in the following code
documentclass{article}
usepackage[edges]{forest}
begin{document}
begin{forest}
for tree={
grow'=east,
anchor=west,
font=itshape,
forked edge,
fork sep = 2mm,
l sep=4mm,
s sep=2mm,
},
s sep=2mm,
delay={ where content={}{coordinate}{}, },
[Nymphalidae,
[ % 1
[ % 2
[Limenitidinae
[Neptini]
[Limenitidini]
]
[Heliconiinae]
]
[ % 3
[Apaturinae]
[Nymphalinae
[Nymphalini]
[ % 4
[Junoniini]
[Melitaeini]
]
]
]
]
[ % 5
[ % 6
[Libytheinae]
[Danainae]
]
[ % 7
[Charaxinae]
[Satyrinae
[Elymniini]
[ % 8
[Coenonymphini]
[ % 9
[Ypthimini]
[ % 10
[ % 11
[Melanargiini]
[Satyrini]
]
[ % 12
[Maniolini]
[Erebiini]
]
]
]
]
]
]
]
]
end{forest}
end{document}
I get the error message
! Dimension too large.
pgf@x
If I change null nodes 11 and 12 to nodes with one or more characters in them everything works fine. This is very confusing, as the only difference between the two pieces of code is the text in each node.
I do not know why precisely there is this error. However, it seems that the purpose of using coordinates is to avoid gaps. Here is a workaround that also avoids the gaps: replace the empty nodes by some short horizontal line stretches.
documentclass{article}
usepackage[edges]{forest}
begin{document}
begin{forest}
for tree={
grow'=east,
anchor=west,
font=itshape,
forked edge,
fork sep = 2mm,
l sep=4mm,
s sep=2mm,
},
s sep=2mm,
delay={ where content={}{outer sep=0pt,inner sep=0pt,
append after command={(tikzlastnode.west) edge (tikzlastnode.east)}}{}, },
[Nymphalidae,
[ % 1
[ % 2
[Limenitidinae
[Neptini]
[Limenitidini]
]
[Heliconiinae]
]
[ % 3
[Apaturinae]
[Nymphalinae
[Nymphalini]
[ % 4
[Junoniini]
[Melitaeini]
]
]
]
]
[ % 5
[ % 6
[Libytheinae]
[Danainae]
]
[ % 7
[Charaxinae]
[Satyrinae
[Elymniini]
[ % 8
[Coenonymphini]
[ % 9
[Ypthimini]
[ % 10
[ % 11
[Melanargiini]
[Satyrini]
]
[ % 12
[Maniolini]
[Erebiini]
]
]
]
]
]
]
]
]
end{forest}
end{document}
Correct answer by user227987 on February 12, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP