14

With \twoheadrightarrow we can get arrow with two heads. Is there any command for getting two heads with up arrow?

  • 3
    \twoheaduparrow from MnSymbol perhaps? :) – Paulo Cereda Jul 4 '13 at 16:54
  • @PauloCereda I love that package, but many people here seems to advise against its use... – karlkoeller Jul 4 '13 at 17:52
  • 1
    @karlkoeller perhaps is not advise against its use, but to warn that it changes some symbols? – Gonzalo Medina Jul 4 '13 at 17:57
  • @GonzaloMedina Yes, I'm aware of that, and that's why I like it. But why is it a so bad practice to change several symbols in your document? For example, see this answer of mine. I prefer MnSymbol symbols at the default ones when using mathptmx package. Is it so strange (or even bad practice)? – karlkoeller Jul 4 '13 at 18:36
  • @karlkoeller I wouldn't say it is a bad practice as long as consistency is guaranteed. – Gonzalo Medina Jul 4 '13 at 18:41
7

One can rotate one of the existing two-headed arrows (some adjustment might be required depending on the desired position for the arrow baseline):

\documentclass{article}
\usepackage{amssymb}
\usepackage{graphicx}

\newcommand\twoheaduparrow{\mathrel{\rotatebox{90}{$\twoheadrightarrow$}}}

\begin{document}

\[
A\twoheadrightarrow B\quad A\twoheaduparrow B
\]

\end{document}

enter image description here

Adding [origin=<origin>] as an option to \rotate, the center for rotation can be changed (possible values for <origin> are t (top),b (bottom),l (left),r (right),c (center), and B (baseline)):

\documentclass{article}
\usepackage{amssymb}
\usepackage{graphicx}

\newcommand\twoheaduparrow{\mathrel{\rotatebox[origin=c]{90}{$\twoheadrightarrow$}}}

\begin{document}

\[
A\twoheadrightarrow B\quad A\twoheaduparrow B
\]

\end{document}

enter image description here

In a comment it has been requested a definition without using additional packages; in this case, with a little more work, one can build the symbol using \ooalign and two shifted \uparrows:

\documentclass{article}

\makeatletter
\newcommand\twoheaduparrow{%
\mathrel{\mathchoice
  {\raise2pt\hbox{%
  \ooalign{\hss$\uparrow$\hss\cr\lower2pt\hbox{%
  $\uparrow$}}}}
  {\raise2pt\hbox{%
  \ooalign{\hss$\uparrow$\hss\cr\lower2pt\hbox{%
  $\uparrow$}}}}
  {\raise1.5pt\hbox{%
  \ooalign{\hss$\scriptstyle\uparrow$\hss\cr\lower1.5pt\hbox{%
  $\scriptstyle\uparrow$}}}}
  {\raise1.1pt\hbox{%
  \ooalign{\hss$\scriptscriptstyle\uparrow$\hss\cr\lower1.1pt\hbox{%
  $\scriptscriptstyle\uparrow$}}}}
}}

\begin{document}

\[
A\twoheaduparrow B\quad {\textstyle A\twoheaduparrow B}\quad A_{A\twoheaduparrow B}\quad L_{A_{A\twoheaduparrow B}}
\]

\[
A\uparrow B\quad {\textstyle A\uparrow B}\quad A_{A\uparrow B}\quad L_{A_{A\uparrow B}}
\]

\end{document}

enter image description here

  • i'd have assumed that the arrow should be aligned vertically around the math axis. to do that, all that's necessary is to add an option to the rotation: \rotatebox[origin=c]{90}{...} – barbara beeton Jul 4 '13 at 18:26
  • @barbarabeeton yes; I mentioned that some adjustments might be needed, depending on the desired alignment. I've added to my answer an example with origin=c as you suggested. – Gonzalo Medina Jul 4 '13 at 18:38
  • How about if one cannot use graphicx package? Is there any straight forward way to use it? Looks like this symbol is not in amssymb. – manjusha Jul 9 '13 at 7:21
  • @manjusha Why wouldn't one be allowed to use graphicx? The symbols is not predefined in amssymb (there's a \twoheaduparrow in the MnSymbol package, but MnSymbol changes the look of many other symbols). In any case, I've updated my answer with a definition of the symbol not requiring additional packages. – Gonzalo Medina Jul 9 '13 at 13:24
  • @GonzaloMedina, actually while converting the tex file to other web supported formats with such user defined commands there need more server side configurations. Which I am trying to avoid. – manjusha Jul 10 '13 at 13:06
3

The gap between arrow heads is set at .3\arrowheight and can be changed. Of note in this solution is the \ThisStyle{...\SavedStyle...} construct which allows the current (at invocation) math style to be imported into places where it would otherwise be lost.

That feature allows a four-pronged \mathchoice to be replaced with a single \ThisStyle{} (of course, the \mathchoice resides within \ThisStyle, but it sure saves on typing). And because I defined the arrow gap (.3\arrowheight) in terms of the length of the current mathstyle arrow, I didn't need to apply different stackgaps (i.e., arrowhead shift lengths) for each mathstyle. Furthermore, using the arrow height itself to define the magnitude of the shift means that this solution works just fine if presented in \Huge. Other solutions will not hold up so well.

As a final note, this solution preserves the baseline of the original \uparrow, which a rotated-arrow solution will not do without further manipulation.

\documentclass{minimal}
\usepackage{scalerel}
\usepackage{stackengine}
\newlength\arrowheight
\newcommand\doubleuparrow{%
  \mathrel{\ThisStyle{%
    \setlength{\arrowheight}{\heightof{$\SavedStyle\uparrow$}}%
    \stackengine{.3\arrowheight}{$\SavedStyle\uparrow$}%
      {$\SavedStyle\uparrow$}{O}{c}{F}{F}{L}}
}}
\begin{document}
\begin{equation}
A \doubleuparrow C \quad A_{A \doubleuparrow C}
\end{equation}
\end{document}

enter image description here

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.