1

I want to define 3 commands similar to \vec. The first, \Mono, must place over the argument an arrow just like in \vec, but with another arrowhead in the beginning of the arrow, and also pointing rightwards. This is to represent injections or monomorphisms.

The second,\Epi, must place over the argument an arrow just like in \vec, but with two arrowheads in the end of the arrow, both pointing rightwards. This is to represent surjections or epimorphisms.

The third, \Iso, must place over the argument an arrow just like in \vec, but with another arrowhead in the beginning of the arrow, but pointing leftwards. This is to represent bijections or isomorphisms.

My first attempt was to define the following commands

\newcommand{\Mono}[1]{\overset{\rightarrowtail}{#1}}
\newcommand{\Epi}[1]{\overset{\twoheadrightarrow}{#1}}
\newcommand{\Iso}[1]{\overset{\leftrightarrow}{#1}}

But these commands create too much space between the letter in the argument and the arrows above them, and the arrows themselves are too big. Ideally, I would like to know how \vec is defined and also to have commands that behave well in superscripts etc.

1 Answers1

2

I don't know exactly how you defined \rightrightarrow, but my main point is to show the layout will be better if you do that with the accents package, as it takes into account the italic angle of the maths variables, so I replaced it with \hookrightarrow, which is a standard way to denote an injective homomorphism.

Here is a comparison of both ways:

\documentclass{article}
\usepackage{mathtools}
\usepackage{accents} 
\usepackage{amssymb}
\newcommand{\Mono}[1]{\overset{\hookrightarrow}{#1}}
\newcommand{\Epi}[1]{\overset{\twoheadrightarrow}{#1}}
\newcommand{\Iso}[1]{\overset{\leftrightarrow}{#1}}

\begin{document}

[ \begin{matrix}\Mono{f}: A \rightarrow B &\quad & \accentset{\hookrightarrow}{f}: A \rightarrow B \% \Epi{f}: A \rightarrow B & & \accentset{\twoheadrightarrow}{f}: A \rightarrow B \ \Iso{f}: A \rightarrow B & & \accentset{\leftrightarrow}{f}: A \rightarrow B \end{matrix}]%

\end{document}

enter image description here

Bernard
  • 271,350
  • Thanks for the answer, I will test this, but I still rather define a command instead of using this whole package just for this. – Pedro G. Mattos Feb 09 '21 at 19:29
  • I changed \rightrightarrow to \rightarrowtail, I just didn't remember I used this command at the time I asked the question... – Pedro G. Mattos Feb 09 '21 at 19:30
  • Of course, you may define new commands with accents. I did not want to do it in your place. – Bernard Feb 09 '21 at 19:31
  • I didn't remember \rightarrowtail. It's quite fine. – Bernard Feb 09 '21 at 19:33
  • Oh, that's not what I meant. I mean, instead of defining a command using \accentset from thr package accents, I would prefer to define some kind of command (like \accentset, possibly) explicitly, directly. – Pedro G. Mattos Feb 09 '21 at 19:34
  • Would it be too complicated? – Pedro G. Mattos Feb 09 '21 at 19:34
  • Why reinvent the wheel? Accents is a well established package, which works fine. Too complicated… – for me, it wouldn't be easy to declare a math accent correctly. – Bernard Feb 09 '21 at 19:35
  • I use \hookrightarrow for embeddings and (sometimes) extremal monomorphisms, that's why I choose the not-so-conventional \rightarrowtail – Pedro G. Mattos Feb 09 '21 at 19:36
  • I see. Conventions also depend on the domain in which you work. – Bernard Feb 09 '21 at 19:38
  • This command seems to work fine, and does not create extra space between lines when a write \accentset{\leftrightarrow}{C} on a the middle of the paragraph, which is great. When I use it with \mathscr, for instance \accentset{\leftrightarrow}{\mathscr{C}}, the arrow is placed too much to the right to my taste. Is there a way to correct this? Using \accentset{\leftrightarrow\ }{\mathscr{C}} gives a better result, but I wonder if there is a way to correct this for every time I use \accentset with \mathscr. – Pedro G. Mattos Feb 09 '21 at 19:58
  • You can correct it by hand adding \mkern - n mu (number of mathematical units) after the arrow in the argument of \accentset. – Bernard Feb 09 '21 at 20:05