# How do I remove gaps between line segments of tikz's draw?

I have read the related question: Tikz Understand white space between node and draw, and tried the solutions proposed therein.

I am trying to draw a phylogenetic tree. I define the leaves and internal node as tikz's \node, and connect them with \draw.

However, I can't seem to get rid of the gap between line segments in the drawn picture: Here's what I'm writing to generate the above diagram:

\begin{tikzpicture}
\tikzstyle{internal}=[inner sep=0, outer sep=0, line cap=rect]
\node (C) at (0, 0) {$C$};
\node (H) at (1, 0) {$H$};
\node[internal] (CH) at (0.5, 0.5) {};
\draw (C) -- (CH) -- (H);
\end{tikzpicture}


It includes the inner sep=0, outer sep=0, and line cap=rect options recommended in a similar question (linked above).

• \coordinate (CH) at (0.5, 0.5);? – Schrödinger's cat Oct 8 at 8:38
• Use of \tikzstyle is discouraged. One should use \tikzset{internal/.style={inner sep=0, outer sep=0, line cap=rect}} instead. Though of course, a coordinate would be the proper solution in this case. And that could be done in the optional argument of tikzpicture: \begin{tikzpicture}[internal/.style={...}] – Skillmon Oct 8 at 8:39
• @Schrödinger'scat You're 100% right, I should have used \coordinate. My bad! – ning Oct 8 at 10:28
• If you are drawing multiple trees, you should consider using one of the libraries or packages designed for this. – cfr Oct 8 at 22:21

You can do it in a single line like this:

\documentclass[tikz, border=2pt]{standalone}

\begin{document}

\begin{tikzpicture}[inner sep=2pt]
\draw (0,0) node [below left]{$C$} -- ++(.5,.5) -- ++(.5,-.5) node[below right]{$H$};
\end{tikzpicture}

\end{document} \draw (0,0) coordinate[label={below left:$C$}](C) -- ++(.5,.5)coordinate(CH) -- ++(.5,-.5) coordinate[label={below right:$H$}](H);

Schrödinger's cat was right. I should be using coordinates instead of nodes for the internal nodes of the tree. This is my preferred solution over AboAmmar's ++ syntax since I want to save the coordinate of the internal node for use later on.