Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.
\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

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.