Consider the following MWE
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw (0,0)--(1,1) node[auto,midway] {$A$}
-- (2,0) node[auto,midway] {$B$};
\end{tikzpicture}
\end{document}
I am using auto here to get automatic left/right positioning. However, I am not satisfied with the distance between the edge labels and the edge itself, which is a bit too large (my real example is a picture with much more nodes in it, so there is room for confusion if they are not very close).
Is there a way to alter this distance? I tried adding node distance=something almost everywhere, but it seems to be ignored.

circleoption to the nodes as well, so that the spacing won't depend on the direction of the edge. – T. Verron Dec 10 '12 at 16:38autoplacement only uses thenorth,north west,west, etc. anchors to place the nodes. Try putting a circle node on a line from(0,0)to(1,3): The circle will intersect the line. I posted a code snippet at TikZ parallel Edges between Nodes that makes TikZ use degree-accuracy for placing the nodes. Also,ellipsenodes are better for ensuring consistent distance in case your text isn't square. – Jake Dec 10 '12 at 16:54\tikz \draw (0,0) -- node [auto] {A long label} (4,0);. If you use acirclethere, the label will be moved really far from the edge, while usingellipsewould keep it close to the edge. – Jake Dec 10 '12 at 17:45