# Ugly edge insertion with thick oblique line

With the following MWE:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[draw,circle] (a) at (0,0) {$A$};
\node[draw,circle] (b) at (1,1) {$B$};
\draw[line width=3pt] (a.north) to (b.south);
\end{tikzpicture}
\end{document}


I obtain the following image:

Is there a way to have a nice insertion of the thick edge in the nodes?

• What do you mean a nice insertion? Do you want the line behind the circles? – darthbith Feb 29 '16 at 12:40
• Yes, and that it doesn't interrupt before the node (in the outer parts) – Filippo Bistaffa Feb 29 '16 at 12:42

Here is one way:

• Fill the circles with white,
• Use layers to put the thick line in the background and
• Shift the two end points vertically:

## Code:

\documentclass{article}
\usepackage{tikz}

%% -------------------------------------- Declare the layers
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}

\begin{document}
\begin{tikzpicture}
\begin{pgfonlayer}{main}
\node[draw,circle,red,  fill=white] (a) at (0,0) {$A$};
\node[draw,circle,blue, fill=white] (b) at (1,1) {$B$};
\end{pgfonlayer}
% -----------------------
\begin{pgfonlayer}{background}
\draw[line width=3pt]
([yshift=-0.30ex]a.north) to ([yshift=+0.30ex]b.south);
\end{pgfonlayer}
\end{tikzpicture}
\end{document}

• That might work, but this would require to manually modify several images in which I use thick edges. I was thinking of a solution that applies to the edge's style, avoiding this problem. – Filippo Bistaffa Feb 29 '16 at 13:18