With the gathered
subsidiary environment, the code
\newcommand{\id}{\mathrm{id}}
\[\begin{gathered}
\text{if $g$ is a left-inverse of $f$, then }
\begin{tikzcd}
A\ar[r, "f"]\ar[rr, "\id_A"', bend right = 30] & B\ar[r, "g"] & A
\end{tikzcd}
\text{ commutes; and,}\\
\text{if $g$ is a right-inverse of $f$, then }
\begin{tikzcd}
B \ar[r, "g"]\ar[rr, "\id_B", bend right = 30] & A\ar[r, "f"] & B
\end{tikzcd}
\text{ commutes.}
\end{gathered}\]
Now, I wish to use align the sentences at the commutative diagrams. I try the following using the align*
environment:
\begin{align*}
\text{if $g$ is a left-inverse of $f$, then }
& \begin{gathered}[c]
\begin{tikzcd}
A\ar[r, "f"]\ar[rr, "\id_A"', bend right = 30] & B\ar[r, "g"] & A
\end{tikzcd}
\end{gathered}
\text{ commutes; and,}\\
\text{if $g$ is a right-inverse of $f$, then } &
& \begin{tikzcd}
B \ar[r, "g"]\ar[rr, "\id_B", bend right = 30] & A\ar[r, "f"] & B
\end{tikzcd}
\text{ commutes.}
\end{align*}
But the ampersands of align*
and tikzcd
seem to get mixed up. I get the following error messages:
- Package pgf Error: Single ampersand used with wrong catcode.
\end{align*} - Package pgf Error: No shape named `tikz@f@6-1-3' is
known. I think the culprit is a tikzcd arrow in cell 1-1. - Package pgf Error: Single ampersand used with wrong catcode. \end{align*}
- Package pgf Error: No shape named `tikz@f@7-1-3' is known. I think
the culprit is a tikzcd arrow in cell 1-1. - Package pgf Error: Single
ampersand used with wrong catcode. \end{align*} - Package pgf Error:
No shape named `tikz@f@8-1-3' is known. I think the culprit is a
tikzcd arrow in cell 1-1. - Package pgf Error: Single ampersand used
with wrong catcode. \end{align*} - Package pgf Error: No shape named
`tikz@f@9-1-3' is known. I think the culprit is a tikzcd arrow in
cell 1-1. Overfull \hbox (66.04643pt too wide) detected
How can I get around this?
Best Answer
As mention @David Carlisle in his comment, use of simple table can be solution for your problem: