0

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

enter image description here

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.

Thanks in advance.

1
  • And what is now problem?
    – Zarko
    Mar 17, 2022 at 11:17

1 Answer 1

4
  • 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?

enter image description here

(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:

enter image description here

(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}
4
  • 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.
    – Shana
    Mar 17, 2022 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?
    – Zarko
    Mar 17, 2022 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.
    – Shana
    Mar 17, 2022 at 11:47
  • Thanks, this is exactly what I want.
    – Shana
    Mar 17, 2022 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .