How to increase the horizontal distance between nodes?
You can specify the relative x
and y
positions separately using the tikz library positioning
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
[align=center,node distance=2cm] %< no need of this global node separation
\node[label=above:A] (A)
{(1)};
\node[label=above:B1] (B1) [above right=0.7cm and 4cm of A]
{($m+1$)};
\node[label=above:B2] (B2) [below right=0.7cm and 4cm of A]
{($m+1$)};
\node[label=above:C] (C) [below right=0.7cm and 4cm of B1]
{($2m-1$)};
\end{tikzpicture}
\end{document}
The first method uses positioning
and node distance=2cm and 4cm]
but I don't appreciate it.
/tikz/node distance=⟨shifting part⟩ (no default, initially 1cm and 1cm) The value of this key is used as ⟨shifting part⟩ is used if and only if a ⟨of-part⟩ is present, but no ⟨shifting part⟩.
and
When the ⟨shifting part⟩ is of the form ⟨number or dimension⟩ and ⟨number or dimension⟩, it has (essentially) the effect of shifting the node vertically upwards by the first ⟨number or dimension⟩ and to the left by the second.
I think it's strange to shift first vertically and I prefer to make a shift manually by myself.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}
[align=center,node distance=2cm and 4cm]
\node[label=above:A] (A) {(1)};
\node[label=above:B1] (B1) [above right= of A] {($m+1$)};
\node[label=above:B2] (B2) [below right= of A] {($m+1$)};
\node[label=above:C] (C) [below right= of B1] {($2m-1$)};
\end{tikzpicture}
\end{document}
I prefer +(2, 2)
and ++(2, 2)
it's like above right
and it's more flexible. But It's fine to have a lot of possibilities !!!
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture} [align=center]
\path (0, 0) node[label=above:A] (A) {(1)}
+(2, 2) node[label=above:B1] (B1) {($m+1$)}
++(2,-2) node[label=above:B2] (B2) {($m+1$)}
++(2, 2) node[label=above:C] (C) {($2m-1$)};
\end{tikzpicture}
\begin{tikzpicture} [align=center,xscale=2] % or x=2cm
\path (0, 0) node[label=above:A] (A) {(1)}
+(2, 2) node[label=above:B1] (B1) {($m+1$)}
++(2,-2) node[label=above:B2] (B2) {($m+1$)}
++(2, 2) node[label=above:C] (C) {($2m-1$)};
\end{tikzpicture}
\end{document}
As Harish mentioned, you can use the positioning
library and adjust horizontal and vertical position.
Another way, allowing you to specify distances for horizontal and vertical distances, is to use matrices. With this you can set the row and column distances. The code, for you diagram, is
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}[align=center]
\matrix[matrix of nodes,row sep=0.5cm,column sep=2cm]{
&|[label=above:B1]| ($m+1$)&\\
|[label=above:A]| (1)&&|[label=above:C]| ($2m-1$)\\
&|[label=above:B2]| ($m+1$)&\\
};
\end{tikzpicture}
\end{document}
The result is