Elegant way to align two tikz diagrams in a line

I wish to put two tikz diagrams in a same line so that they are aligned, centered on the quarters as below:

The only way I know for now is to put the tikz diagrams in a common equation and then add spaces by hand, for example:

$\begin{tikzcd} \ast\times X\arrow[r,"{(1,1_X)}"]\arrow[dr,swap,"\cong"] & G\times X\arrow[d,"\alpha"]\\ &X \end{tikzcd} % \qquad\qquad % \begin{tikzcd} G\times G\times X\arrow[r,"{(m,1_X)}"]\arrow[d,swap,"{(1_G,\alpha )}"] & G\times X\arrow[d,"\alpha"]\\ G\times X \arrow[r,"\alpha"]&X \end{tikzcd}$


To adjust the spacing is really a waste of time, so I'd like to know whether there is any elegant way that aligns the diagram automatically.

• And what is now problem? Mar 17 at 11:17

• in equation environment had not to be empty lines
• it is not entirely unclear, what you mean with centering.

Is the following simple solution close to what you after?

(red lines shows text borders)

\documentclass{article}
\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}[column sep=large] \ast\times X\arrow[r,"{(1,1_X)}"]\arrow[dr,swap,"\cong"] & G\times X\arrow[d,"\alpha"]\\ &X \end{tikzcd} % \qquad % \begin{tikzcd}[column sep=large] G\times G\times X\arrow[r,"{(m,1_X)}"]\arrow[d,swap,"{(1_G,\alpha )}"] & G\times X\arrow[d,"\alpha"]\\ G\times X \arrow[r,"\alpha"]&X \end{tikzcd}$
\end{document}


Addendum: It seems that OP looking for the following:

(red lines indicate text borders, vertical black lines show positions of image bisectors)

\documentclass{article}
\usepackage{tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\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}

\noindent\begin{tabularx}{\linewidth}{ C | C } % in real document delete |
\begin{tikzcd}[column sep=large,
ampersand replacement=\&]
\ast\times X\arrow[r,"{(1,1_X)}"]\arrow[dr,swap,"\cong"]
\& G\times X\arrow[d,"\alpha"]\\
\&   X
\end{tikzcd}
&   \begin{tikzcd}[column sep=large,
ampersand replacement=\&]
G\times G\times X\arrow[r,"{(m,1_X)}"]\arrow[d,swap,"{(1_G,\alpha )}"]
\&  G\times
X\arrow[d,"\alpha"]\\
G\times X \arrow[r,"\alpha"]
\&  X
\end{tikzcd}    \\
\vline  & \vline  % in real document delete this code line
\end{tabularx}
\end{document}

• This is exactly what I mentioned in my question, where I put two empty lines around \qquad to emphasize it, unrealizing that this is not allowed in equation environment. Mar 17 at 11:23
• But I still not know, what is your problem. Your sketch is not clear. Do you like to have that images are equidistant to text simetrale? Mar 17 at 11:25
• I mean that I want the geometric center of the diagrams be located exactly on the blue lines in my sketch, without adding spaces by hand to adjust the distance. Mar 17 at 11:47
• Thanks, this is exactly what I want. Mar 17 at 12:54