2

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: enter image description here

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?

  • Do you know \xrightarrow? – Sigur Jan 25 at 22:22
  • Yes, but I think it looks a bit weird. There's also \xlongrightarrow but that also looks strange to me. – trujello Jan 25 at 22:24
  • Please, tell us, why do you think strange? Is the arrow too short? Or too long? – Sigur Jan 25 at 22:24
  • I think it's too short. – trujello Jan 25 at 22:28
  • To make your command work, you can use an 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 load tikz (which tikz-cd does) you have much simpler options. – Schrödinger's cat Jan 25 at 22:35
6

Another suggestion, with stackengine:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}%
\usepackage{old-arrows}
\usepackage[usestackEOL]{stackengine}
\newcommand{\isomarrow}{\mathrel{\setstackgap{S}{-0.5pt}\ensurestackMath{\Shortstack{\scriptstyle\sim\\ \longrightarrow}}}}

\begin{document}

\[ 1 \isomarrow 2\]%

 \end{document} 

enter image description here

  • This is pretty nice, thank you! – trujello Jan 26 at 0:11
4

A possible solution without tikz-cd, using \xrightarrow with a box in predefined length (I used 1cm).

enter image description here

The command contains 2 arguments to be used as domain and codomain, like \isomap{x}{y} for example.

\documentclass[11pt,a4paper]{report}
\usepackage{amsthm,amsmath,amssymb,amsfonts}

\newcommand{\isomap}[2]{$ #1 \xrightarrow{\makebox[1cm]{$\sim$}} #2 $}

\begin{document}
the operator $\otimes$ is invariant up to isomorphism \isomap{1}{2}.

the operator $\otimes$ is invariant up to isomorphism \isomap{x}{y}.    
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.