GeneralTree runs off of page

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
ZooBot23
Posts: 1
Joined: Tue May 21, 2019 9:28 pm

Tree runs off of page

Post by ZooBot23 »

Code: Select all

%\title{Using the forest package to create trees in LaTeX}
% From http://tex.stackexchange.com/a/108728/23931 
\documentclass[10pt,twoside,a4paper]{memoir}
\usepackage{graphicx}
\usepackage{forest}
\usepackage{tikz-qtree}
\begin{document}


\begin{forest} for tree={
    edge path={\noexpand\path[\forestoption{edge}] (\forestOve{\forestove{@parent}}{name}.parent anchor) -- +(0,-12pt)-| (\forestove{name}.child anchor)\forestoption{edge label};}
}
[Eukaryota
[Animalia
[Porifera]
[Cnidaria [Mobilia [Aquaderia [Gigabellidae [Jellicent [J. ][J. ][J. ]][Tentacruel [T. vulgaris][T. polarus][T. equatorus]]]][Leviteridea [Nihileidae [Nihilego [N. ][N. ]]][Ribbonidae [Chimecho [C. ][C. ][C. ]][Driftblim [D. ][D. ][D. ]]]][Terraidea [Blacephalidae [Blacephalon [B. ][B. ]]]]]]]]

\end{forest}
\end{document}
Whenever i put this code into an overleaf editor, the tree it makes starts to run off the page. is there any way to fix this? I am new to latex/related things, so i have no clue what i am actually doing here. any help will be appreciated.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Tree runs off of page

Post by Ijon Tichy »

If something is to wide, you either can make it smaller:

Code: Select all

\documentclass[10pt,twoside,a4paper]{memoir}
\usepackage{graphicx}
\usepackage{forest}
\usepackage{tikz-qtree}
\usepackage{showframe}% make page areas visible (for demonstration only)
\begin{document}
     
\tiny\noindent
\begin{forest} for tree={
    edge path={\noexpand\path[\forestoption{edge}]
      (\forestOve{\forestove{@parent}}{name}.parent anchor) --
       +(0,-\baselineskip)-| (\forestove{name}.child
      anchor)\forestoption{edge label};},
}
    [Eukaryota
    [Animalia
    [Porifera]
    [Cnidaria [Mobilia [Aquaderia [Gigabellidae [Jellicent,s sep=0pt
    [J. ][J. ][J. ]][Tentacruel, s sep=0pt
    [T. vulgaris][T. polarus][T. equatorus]]]][Leviteridea [Nihileidae
    [Nihilego,s sep=0pt [N. ][N. ]]][Ribbonidae [Chimecho,s sep=0pt
    [C.][C. ][C. ]][Driftblim,s sep=0pt [D. ][D. ][D. ]]]][Terraidea
    [Blacephalidae [Blacephalon,s sep=0pt [B. ][B. ]]]]]]]]
\end{forest}
\end{document}
or rotate it:

Code: Select all

\documentclass[10pt,twoside,a4paper]{memoir}
\usepackage{graphicx}
\usepackage{forest}
\usepackage{tikz-qtree}
\usepackage{showframe}% make page areas visible (for demonstration only)
\begin{document}
\noindent\rotatebox{90}{%
\begin{forest} for tree={
    edge path={\noexpand\path[\forestoption{edge}]
      (\forestOve{\forestove{@parent}}{name}.parent anchor) --
      +(0,-\baselineskip)-| (\forestove{name}.child
      anchor)\forestoption{edge label};},
}
    [Eukaryota
    [Animalia
    [Porifera]
    [Cnidaria [Mobilia [Aquaderia [Gigabellidae [Jellicent
    [J. ][J. ][J. ]][Tentacruel
    [T. vulgaris][T. polarus][T. equatorus]]]][Leviteridea [Nihileidae
    [Nihilego,s sep=-5pt [N. ][N. ]]][Ribbonidae [Chimecho,s sep=-5pt
    [C.][C. ][C. ]][Driftblim,s sep=-5pt [D. ][D. ][D. ]]]][Terraidea
    [Blacephalidae [Blacephalon, [B. ][B. ]]]]]]]]
\end{forest}}
\end{document}
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Post Reply