2
\documentclass[preview,border=3pt,varwidth]{standalone}
\usepackage{pst-tree}

\psset{levelsep=2,treesep=-2,angleA=90,angleB=-90,arm=12pt}

\def\psedge#1#2{\ncangle{#2}{#1}}

\begin{document}

\psTree{\Tcircle{36}}
    \Tcircle{2}
    \psTree{\Tcircle{18}}
        \Tcircle{2}
        \psTree{\Tcircle{9}}
            \Tcircle{3}
            \Tcircle{3}
        \endpsTree
    \endpsTree
\endpsTree

\end{document}

The code produces a trimmed output as follows.

enter image description here

How to fix this issue so I can get a correct tight output?

Edit:

For comparison purposes, let's comment some code in the preamble as follows.

\documentclass[border=3pt,preview,varwidth]{standalone}
\usepackage{pst-tree}

%\psset{levelsep=2,treesep=-2,angleA=90,angleB=-90,arm=12pt}
%
%\def\psedge#1#2{\ncangle{#2}{#1}}

\begin{document}

\psTree{\Tcircle{36}}
    \Tcircle{2}
    \psTree{\Tcircle{18}}
        \Tcircle{2}
        \psTree{\Tcircle{9}}
            \Tcircle{3}
            \Tcircle{3}
        \endpsTree
    \endpsTree
\endpsTree

\end{document}

The output looks fine!

enter image description here

3

Instead of

treesep=-2

use

treesep=2,
treeflip

which mirrors the orientation and calculates the bounding box correct.

Code

\documentclass[preview,border=3pt,varwidth]{standalone}
\usepackage{pst-tree}
\psset{levelsep=2,treesep=2,treeflip,angleA=90,angleB=-90,arm=12pt}
\def\psedge#1#2{\ncangle{#2}{#1}}

\begin{document}

\psTree{\Tcircle{36}}
    \Tcircle{2}
    \psTree{\Tcircle{18}}
        \Tcircle{2}
        \psTree{\Tcircle{9}}
            \Tcircle{3}
            \Tcircle{3}
        \endpsTree
    \endpsTree
\endpsTree

\end{document}

Output

enter image description here

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.