The maps package^{∗}

Andrew D. Lewis

1998/02/04

1 Using the maps macros

Well, you know everything is mathematics is supposed to be a set or a map between sets. So mathematicians have made notation for defining maps.

You will see defined in Section 2 a few simple macros for making arrows with labels on them. For example \maprightu{symbol} will make an arrow to the right with symbol “up” (i.e., on top). These all have the same form, but I don’t use them any more, so I won’t describe them in detail. Use a better package…

\map The things I do use are \map{map}{domain}{range} for writing a basic map along with where it’s coming from and going to, and the various versions of \mapdef. \map must be used within math mode. There is also \setmap to define set-valued maps, and its usage is the same as \map. The \mapdef commands

\mapdef* should be used in a display mode. Let me describe how to use \mapdef* and then the use of the other similar macros will then be evident. If you type

     \[ \mapdef*{f}{X}{Y}{x}{y} \]

you’ll get something like

f : X → Y
x ↦ y

In actuality the equation will be a lot tighter since it uses AMS equation environments, not the lame L^{A}TEX eqnarray environment.

\mapdefa The other macro I sometimes find useful is \mapdefa. It’s usage is

     \begin{align*}
     \mapdefa{f}{X}{Y}&x\mapsto y
     \end{align*}

which gives roughly

f : X → Y
x ↦ y

∗This file has version number v1.1, last revised 1998/02/04.

Ummm… this is the same as before. Yes, but in this case you might want some flexibility in typesetting the second row of the equation. Maybe it needs to be split over two lines itself, for example.

2 Implementation

The implementation is pretty basic.

1 ⟨∗package⟩

Here are those various arrows. Use them if you like. I don’t have the heart to get rid of them.

2

 3 \newcommand\maprightu[1]{\smash{\mathop{\longrightarrow}\limits^{#1}}}
 4 \newcommand\maprightd[1]{\smash{\mathop{\longrightarrow}\limits_{#1}}}
 5 \newcommand\mapdownr[1]{\Big\downarrow\rlap
 6 {$\vcenter{\hbox{$\scriptstyle#1$}}$}}
 7 \newcommand\mapdownl[1]{\llap{$\vcenter{\hbox{$\scriptstyle#1$}}$}
 8 \Big\downarrow}
 9 \newcommand\mapsel[1]{\llap{$\vcenter{\hbox{$\scriptstyle#1$}}$}\searrow}
10 \newcommand\mapswl[1]{\llap{$\vcenter{\hbox{$\scriptstyle#1$}}$}\swarrow}
11 \newcommand\mapser[1]{\searrow\rlap{$\vcenter{\hbox{$\scriptstyle#1$}}$}}
12 \newcommand\mapswr[1]{\swarrow\rlap{$\vcenter{\hbox{$\scriptstyle#1$}}$}}

Here’s the easy \map and \setmap macros.

13

14 \newcommand\map[3]{#1\colon#2\rightarrow#3}
15 \newcommand\setmap[3]{#1\colon#2\twoheadrightarrow#3}

Here’s the macro \mapdef in its three incarnations along with \mapdefa.

16

17 \newcommand\mapdef[5]{\begin{aligned}
18 #1\colon&\begin{aligned}[t]#2\end{aligned}\rightarrow
19 \begin{aligned}[t]#3\end{aligned}\\&\begin{aligned}[t]#4\end{aligned}
20 \mapsto\begin{aligned}[t]#5\end{aligned}\end{aligned}}
21 \newcommand\mapdefa[3]{#1\colon&#2\rightarrow#3\\}

22

23 ⟨/package⟩