Is there a package for doing this in LaTeX?

I'd like to do something like this

What would be the code? does it use a package for doing the $$f\mapsto f\circ \pi$$ part?

• Not at all. Math mode will do. Either between \$ signs (as you already have it) or in display mode between $ $ or and . Or are you referring to the indentation? May 12 '13 at 19:19
• I think you might be interested in Math Mode by Herbert Voß which provides much useful information May 12 '13 at 19:21

2 Answers

You can use the following.

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align*}
\pi^{\ast} \colon C^{k}(P,N) &\to     C^{k}(M,N)  \-1ex] f &\mapsto f \circ \pi \end{align*} \end{document}  Remember to use \colon for maps; with : you will get wrong spacing acound the colon. • »I don't think there is a package for this« - but you are loading amsmath ;) May 12 '13 at 19:23 • @cgnieder Well, I meant a package for typing only this specifically in an easier way. :) May 12 '13 at 19:24 • the problem with this approach is the spacing between the upper and the lower part I guess it's too big, is there a way to fix it? – Dion May 12 '13 at 19:25 • @Dion See updated answer. May 12 '13 at 19:28 • @Dion You can change -1ex to whatever length fits your needs. May 12 '13 at 19:31 You can use a self-defined command with a better syntax than using five arguments: \documentclass{article} \usepackage{xparse,array} \NewDocumentCommand{\map}{s m >{\SplitArgument{1}{\to}}m >{\SplitArgument{1}{\mapsto}}m} {\IfBooleanTF{#1}{\onelinemap{#2}#3#4}{\twolinemap{#2}#3#4}} \NewDocumentCommand{\onelinemap}{mmmmm} {#1\colon #2\to#3,\quad #4\mapsto #5} \NewDocumentCommand{\twolinemap}{mmmmm} {\begin{array}{@{}r@{}>{{}}l@{}} #1\colon #2 & \to #3\\ #4 & \mapsto #5 \end{array}} \begin{document} \[ \map*{\pi}{C^k(P,N) \to C^k(M,N)}{f \mapsto \pi\circ f}
$\map{\pi}{C^k(P,N) \to C^k(M,N)}{f \mapsto \pi\circ f}$
\end{document}


The *-variant prints a one line version.

• you could also define this way: \newcommand{\map}[5]{\displaystyle #1:#2&\longrightarrow #3\[-2ex]#4&\longmapsto #5} The command would be: \begin{align*} \map{\pi}{C^k(P, N)}{C^k(M, N)}{f}{\pi\circ f} \end{align*} \end{document} The way I defined it makes it works only inside the align environment... I guess you save some charachters when typing..
– Dion
May 13 '13 at 20:46