1

I would like to decrease the spacing between start and end of an edge so that edged .

Take the following illustration as example (Left: before; right: after): enter image description here

Code for the left tree:

\documentclass{standalone}
\usepackage{forest}

\begin{document}    
\begin{forest}
[A 
    [B] 
    [C]
]
\end{forest}  
\end{document}
3

You can adjust the inner sep, the l and l sep options:

\documentclass{article}
\usepackage{forest}

\begin{document}
\begin{forest}
[A
    [B]
    [C]
]
\end{forest}

\begin{forest} for tree={inner sep=2pt,l=10pt,l sep=10pt}
[A
    [B]
    [C]
]
\end{forest}
\end{document}

enter image description here

  • Note that l'=10pt, l sep'=10pt is quicker. @Paddre. – cfr Jan 29 '18 at 23:17
  • @cfr Thanks for the hint. Could you explain why this the case and why inner sep'=2pt is not working? – Paddre Jan 30 '18 at 11:50
  • @Paddre Because inner sep is a TikZ key and TikZ doesn't make a fast version available, whereas l and l sep are Forest keys and Forest does make fast versions available, which it calls l' and l sep'. You can say l sep'+=2pt for the same reason, but not inner sep'+=2pt or even inner sep+=2pt. TikZ doesn't support these keys. Perhaps it helps to say that l' is a different key from l. It is just that, by design, it does the same thing faster in simple cases. – cfr Jan 30 '18 at 23:21
  • @cfr Thanks for the clarification. I always understood '= as an operator ;-) – Paddre Jan 31 '18 at 14:20
1

By using inner sep you can change size of the node

\documentclass{standalone}
\usepackage{forest}

\begin{document}    
\begin{forest}
for tree = {inner sep = 1pt}
[A 
    [B] 
    [C]
]
\end{forest}  
\end{document}

enter image description here

  • Thanks for your answer. I've been looking for that parameter. Right after posting the question I realized that my image was not exactly representing what I was looking for (less spacing rather than longer edges). I was hoping, that less spacing keeps the edge length but apparently there is some other parameter I need to adjust. Do you know, how I can achieve something like shown in the updated image? – Paddre Jan 29 '18 at 10:20

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.