Scaling a tikz-cd commutative diagram in TikZ?

It seems tikzcd environment doesn't take the scale argument. Since you are loadin tikz, you can put tikzcd inside a node and that takes a scale argument. (I accept that this a over kill / ugly hack, but things work that way some times)

\documentclass{amsart}
\usepackage{tikz}
\usepackage{tikz-cd}

\begin{document}

\begin{tikzpicture}[baseline= (a).base]
\node[scale=.5] (a) at (0,0){
\begin{tikzcd}
    A\ar{r}\ar{d}&B\\
    C\ar{r}&D\ar{u}\\
\end{tikzcd}
};
\end{tikzpicture}
\begin{tikzpicture}[baseline= (a).base]
\node[scale=1] (a) at (0,0){
\begin{tikzcd}
    A\ar{r}\ar{d}&B\\
    C\ar{r}&D\ar{u}\\
\end{tikzcd}
};
\end{tikzpicture}
\begin{tikzpicture}[baseline= (a).base]
\node[scale=1.5] (a) at (0,0){
\begin{tikzcd}
    A\ar{r}\ar{d}&B\\
    C\ar{r}&D\ar{u}\\
\end{tikzcd}
};
\end{tikzpicture}
\begin{tikzpicture}[baseline= (a).base]
\node[scale=2] (a) at (0,0){
\begin{tikzcd}
    A\ar{r}\ar{d}&B\\
    C\ar{r}&D\ar{u}\\
\end{tikzcd}
};
\end{tikzpicture}
\end{document}

enter image description here


The column seps and row seps are not scaleble in the same way as many other things in TikZ.

You can however install a few matrix scaling keys (that work by installing the scale factor in the row sep and column sep factor).

There are also other ways but I wouldn’t scale the nodes or even use low-level scaling (then \scalebox is better).

Code

\documentclass[varwidth, border={0pt 100pt 0pt 0pt}]{standalone}
\usepackage{tikz-cd}
\makeatletter
\tikzset{
  column sep/.code=\def\pgfmatrixcolumnsep{\pgf@matrix@xscale*(#1)},
  row sep/.code   =\def\pgfmatrixrowsep{\pgf@matrix@yscale*(#1)},
  matrix xscale/.code=%
    \pgfmathsetmacro\pgf@matrix@xscale{\pgf@matrix@xscale*(#1)},
  matrix yscale/.code=%
    \pgfmathsetmacro\pgf@matrix@yscale{\pgf@matrix@yscale*(#1)},
  matrix scale/.style={/tikz/matrix xscale={#1},/tikz/matrix yscale={#1}}}
\def\pgf@matrix@xscale{1}
\def\pgf@matrix@yscale{1}
\makeatother
\begin{document}
Normal:\par
\begin{tikzcd}
    A \ar{r}\ar{d} & B        \\
    C \ar{r}       & D \ar{u}
\end{tikzcd}\bigskip

With \texttt{tikzcd} options (one of \texttt{tiny}, \texttt{small},
  \texttt{scriptsize}, \texttt{normal}, \texttt{large} and \texttt{huge}):\par
\begin{tikzcd}[row sep=large, column sep=small]
    A \ar{r}\ar{d} & B        \\
    C \ar{r}       & D \ar{u}
\end{tikzcd}\bigskip

Sep scaling:\par
\begin{tikzcd}[matrix scale=1.5]
    A \ar{r}\ar{d} & B        \\
    C \ar{r}       & D \ar{u}
\end{tikzcd}\bigskip

Sep scaling, with nodes:\par
\begin{tikzcd}[matrix scale=1.5, transform shape, nodes={scale=1.5}]
    A \ar{r}\ar{d} & B        \\
    C \ar{r}       & D \ar{u}
\end{tikzcd}\bigskip

Everything, including line widths (does not update the bounding box correctly):\par\centering
\begin{tikzcd}[transform canvas={scale=4}]
    A \ar{r}\ar{d} & B        \\
    C \ar{r}       & D \ar{u}
\end{tikzcd}\bigskip
\end{document}

Output

enter image description here


Does the \scalebox command work for you? [But to be honest, I have no idea why the ampersand replacement=\& is needed then]

\documentclass{amsart}

\usepackage{tikz}
\usepackage{tikz-cd}

\usetikzlibrary{matrix}

\begin{document}

\begin{tikzpicture}[column sep=1in,row sep=1in]
    \matrix (A) [matrix of math nodes]
    {
        A& B\\
        C& D\\
    };
    \draw[->] (A-1-1) -- (A-1-2);
    \draw[->] (A-1-1) -- (A-2-1);
    \draw[->] (A-2-1) -- (A-2-2);
    \draw[->] (A-2-2) -- (A-1-2);
\end{tikzpicture}

\scalebox{.5}{
    \begin{tikzpicture}[column sep=1in,row sep=1in,ampersand replacement=\&]
        \matrix (A) [matrix of math nodes]{
            A\& B\\
            C\& D\\
        };
        \draw[->] (A-1-1) -- (A-1-2);
        \draw[->] (A-1-1) -- (A-2-1);
        \draw[->] (A-2-1) -- (A-2-2);
        \draw[->] (A-2-2) -- (A-1-2);
    \end{tikzpicture}
}

\end{document}