1

I would like to create a structure like the one in the picture, where the \draw line connects two elements without a gap at the node. The closest I've gotten is:

\documentclass[tikz]{standalone}


\usepackage{tikz} 
\usepackage{tikz-qtree} 

\begin{document}

\begin{tikzpicture}[sibling distance=40pt]
        \Tree [.D [.\node(Bup){\ };  ] [.C [.A  ] [.\node(Bdown){B};  ] ] ] 
        \draw (Bup.south)..controls +(1,-4) and +(-1,1.5) ..(Bdown.south);
    \end{tikzpicture}

\end{document}

but it leaves a gap at both nodes. Plus the standalone pdf it creates has a lot of white space underneath the tree. Any help is appreciated.

enter image description here

1 Answer 1

1

Welcome. Use the north anchors to avoid the gaps, slightly different control points, and the bbox library to obtain a tight bounding box.

\documentclass[tikz]{standalone}
\usetikzlibrary{bbox}
\usepackage{tikz-qtree} 
\begin{document}
\begin{tikzpicture}[sibling distance=40pt,bezier bounding box]
        \Tree [.D [.\node(Bup){\ };  ] [.C [.A  ] [.\node(Bdown){B};  ] ] ] 
        \draw (Bup.north)..controls +(1,-4.5) and +(-1,0.75) ..(Bdown.north);
\end{tikzpicture}
\end{document}

enter image description here

5
  • Thanks, this works! I get an error for \usetikzlibrary{bbox} though, saying this library could not be found. Commented Mar 11, 2020 at 16:49
  • @aktualitaet This means that the Aktualität of your TeX installation is not sufficient. You need to update it, the bbox library was only added recently.
    – user194703
    Commented Mar 11, 2020 at 16:59
  • Thanks for the info (and kudos on the pun). I'm using Overleaf, so I guess I'll just have to wait? Commented Mar 11, 2020 at 17:08
  • @aktualitaet I do not know anything about overleaf. Either you wait, or you copy tikzlibrarybbox.code.tex from here to somewhere where TeX can find it (I have no idea how that works under overleaf), or you ask the support for help.
    – user194703
    Commented Mar 11, 2020 at 17:17
  • Note that the bbox library was removed from TikZ with version 3.1.6 due to licensing issues: github.com/pgf-tikz/pgf/releases/tag/3.1.6 Commented Sep 28, 2020 at 18:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .