In using tikz, I often have the following situation:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\tikz\draw node (A) {A} node[right=of A] (B) {B} (A) -- (B);
\end{document}
In other words, I draw a node (B) and immediately connect it to another node (A). even if I don't use the positioning syntax but explicit coordinates, the first produces wrong lines:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\tikz[nodes={draw}]\draw (0,0) node (A) {A} -- (1,0) node (B) {B};
\tikz[nodes={draw}]\draw (0,0) node (A) {A} (1,0) node (B) {B} (A) -- (B);
\end{document}
because the first picture connects the coordinates (0,0) and (1,0), but not the nodes' borders.
Is there any convenient way of creating and connecting nodes in one go?


\draw node (A) at (0,0) {A} node (B) at (1,0) {B} (A) -- (B);but this is probably not what you mean with "one go" ...\draw (0,0) node (A) {A} -- (1,0) node [anchor=west] (B) {B};but this will alter the position ofB. or you canfillthe node.\newcommandor a\pic, depending on the context.nodeif you use the syntax in your example. in order to invoke the implicit use of node borders, you have to be drawing to/from those nodes.