I don't really get the question so I hope this is what you wanted. If you include a full document (such that we copy paste and see the problem on our systems) things are much more easier.
Here, you can change the default setting within a scope but your block
style had a node distance
which was resetting every time it is issued. I've made it 2mm such that we can see the difference easier.
\documentclass[tikz]{standalone}
\usetikzlibrary{arrows,shapes.geometric,positioning}
\begin{document}
\begin{tikzpicture}[decision/.style={diamond, draw, text width=4.5em, text badly centered, node distance=3.5cm, inner sep=0pt},
block/.style ={rectangle, draw, text width=6em, text centered, rounded corners, minimum height=4em, minimum height=2em},
cloud/.style ={draw, ellipse, minimum height=2em},
line/.style ={draw,-latex'},
node distance = 1cm,
auto]
\node [block] (1st) {1st};
\node [block, right= of 1st] (2nd1) {2nd1};
\begin{scope}[node distance=2mm and 10mm]%Here we change it for everything inside this scope
\node [block, above= of 2nd1] (2nd2) {2nd2};
\node [block, below= of 2nd1] (2nd3) {2nd3};
\node [block, right= of 2nd1] (3rd1) {3rd1};
\node [block, above= of 3rd1] (3rd2) {3rd2};
\node [block, above= of 3rd2] (3rd3) {3rd3};
\end{scope}
\node [block, below= of 3rd1] (3rd4) {3rd4};
\node [block, below= of 3rd4] (3rd5) {3rd5};
\path [line] (1st) -- (2nd1);
\path [line] (2nd1) -- (2nd2);
\path [line] (2nd1) -- (2nd3);
\path [line] (2nd2) -- (3rd3);
\path [line] (2nd1) -- (3rd1);
\path [line] (1st) -- (2nd1);
\end{tikzpicture}
\end{document}
The first thing to try is, of course, reducing the arrow lengths. If all else fails, use \mathclap
that, however, requires ampersand replacement
; or enclose the diagram in an lrbox
.
I'll show all three possibilities.
\documentclass[12pt,a4paper]{article}
\usepackage{mathtools}
\usepackage{tikz-cd}
\newsavebox{\wideeqbox}
\newcommand{\sample}{Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate.}
\begin{document}
\sample
\[
\mathclap{
\begin{tikzcd}[ampersand replacement=\&]
\bullet \dar \rar \&
\bullet \dar \rar \&
\bullet \dar \rar \&
\bullet \dar \rar \&
\bullet \dar \rar \&
\bullet \dar \rar \&
\bullet \dar \rar \&
\bullet \dar \rar \&
\bullet \dar \rar \&
\bullet \dar \\
\bullet \rar \&
\bullet \rar \&
\bullet \rar \&
\bullet \rar \&
\bullet \rar \&
\bullet \rar \&
\bullet \rar \&
\bullet \rar \&
\bullet \rar \&
\bullet
\end{tikzcd}
}
\]
\sample
\[
\begin{lrbox}{\wideeqbox}
$\begin{tikzcd}
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \\
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet
\end{tikzcd}$
\end{lrbox}
\makebox[0pt]{\usebox{\wideeqbox}}
\]
\sample
\[
\begin{tikzcd}[column sep=2em,row sep=1.5em]
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \rar &
\bullet \dar \\
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet \rar &
\bullet
\end{tikzcd}
\]
\sample
\end{document}
The lrbox
solution can be packaged into an environment:
\newsavebox{\wideeqbox}
\newenvironment{wideeq}
{\begin{displaymath}\begin{lrbox}{\wideeqbox}$\displaystyle}
{$\end{lrbox}\makebox[0pt]{\usebox{\wideeqbox}}\end{displaymath}}
Then
text
\begin{wideeq}
\begin{tikzcd}
...
\end{tikzcd}
\end{wideeq}
text
will do. Any math mode material can be used.
Best Answer
The definition of
\Dif
incommath.sty
iswhich is simply wrong. The
\!
backspace is the cause of your problem. It's not the only part incommath
that I consider wrong, so I can't recommend using the package.A more correct definition would be
that you can add to your document (with
\renewcommand
if you insist in usingcommath
).