One of possible ways is break your long expressions into two line. For example by use of multlined
math environment defined in the mathtools
package:
\documentclass{article}
\usepackage{mathtools}
\usepackage{tikz-cd}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\[
\begin{tikzcd}[sep=large]
\begin{multlined}
BAAAAAAAAAAAAA \\
AAAAAAAAAAAAAAA
\end{multlined} \ar{r} \ar{rd} & \begin{multlined}
BAAAAAAAAAAAAA \\
AAAAAAAAAAAAAAA
\end{multlined} \\
\begin{multlined}
AAAAAAAAAAAAAA \\
AAAAAAAAAAAAAAA
\end{multlined} \ar{u} \ar{r} & \begin{multlined}
BAAAAAAAAAAAAA \\
AAAAAAAAAAAAAAA
\end{multlined} \ar{u}
\end{tikzcd}
\]
\end{document}

(red lines shows text borders)
Of course, you can use other amsmath
environments as are aligned
, gathered
, split
, ...
Addendum (1):
Remarks/response to your comment:
Sorry, but we haven't any information about real content of your diagram. However, from my (poor) knowledge of math (it is only my every day tool), any math expression can be broken into two line. If this is not a option for you, than you have the following options:
- use smaller font,
- locally enlarge text width,
- rotate diagram to landscape orientation.
Anyway, I would stick with suggested solution.
Addendum (2):
A example of ugly diagram without split math expression:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
positioning}
%---------------- Show page layout. Don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\begin{document}
\[
\begin{tikzpicture}[
node distance = 8mm and 1mm,
every edge/.style = {draw, -{Straight Barb[scale=0.8]}, semithick}
]
\node (a) {AAAAAAAAAAAAAAAAAAAAAAAAAAAAA};
\node (b) [below right=of a.south] {BBBBBBBBBBBBBBBBBBBBBBBBBBBBB};
\node (c) [below left=of b.south]{CCCCCCCCCCCCCCCCCCCCCCCCCCCCC};
\node (d) [below right=of c.south] {DDDDDDDDDDDDDDDDDDDDDDDDDDDDD};
%
\path (a) edge (b)
(a) edge[out=0, in=15, looseness=3.4] (d)
(c) edge[bend left] (a)
(c) edge (d)
(d) edge[bend right] (b);
\end{tikzpicture}
\]
\end{document}
