I'm trying to us TikZcd to create a better isomorphic mapping symbol. I've seen the other posts about this issue and they're all terrible, and they even acknowledge their solutions aren't great. The symbol for a map which is an isomorphism?
I personally think the arrow below is kind of nice (with some adjustments), where the example is the arrow from 1 to 2:
This is produced by the code
$1 \hspace{-0.4cm}
\begin{tikzcd}
\phantom{1} \arrow[r, "\sim"] & \phantom{1}
\end{tikzcd}
\hspace{-0.4cm}
2$
Since, this is a bit messy, I wanted to put this into a command like so
\newcommand*\isomap{
\hspace{-0.4cm}
\begin{tikzcd}
\phantom{1} \arrow[r, "\sim"] & \phantom{1}
\end{tikzcd}
\hspace{-0.4cm}
}
But I get the error
Package pgf: Single ampersand used with wrong catcode.
I've looked up this error but the results aren't relevant to my situation (as far as I can tell). Any ideas on how I can get this into a command?
\xrightarrow
?\xlongrightarrow
but that also looks strange to me.ampersand replacement
:\newcommand*\isomap{ \hspace{-0.4cm} \begin{tikzcd}[ampersand replacement=\&] \phantom{1} \arrow[r, "\sim"] \& \phantom{1} \end{tikzcd} \hspace{-0.4cm} }
but is unnecessarily complicated IMHO. Once you loadtikz
(whichtikz-cd
does) you have much simpler options.