15

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

6
  • 3
    \twoheaduparrow from MnSymbol perhaps? :) Jul 4, 2013 at 16:54
  • @PauloCereda I love that package, but many people here seems to advise against its use... Jul 4, 2013 at 17:52
  • 1
    @karlkoeller perhaps is not advise against its use, but to warn that it changes some symbols? Jul 4, 2013 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)? Jul 4, 2013 at 18:36
  • @karlkoeller I wouldn't say it is a bad practice as long as consistency is guaranteed. Jul 4, 2013 at 18:41

2 Answers 2

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

7
  • 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}{...} Jul 4, 2013 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. Jul 4, 2013 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, 2013 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. Jul 9, 2013 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, 2013 at 13:06
4

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

SUPPLEMENT

A commenter asks if the vertical size can be made to match the normal \uparrow. One could clip the bottom. However, here, I choose to scale down the result to the same height as the \uparrow.

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

enter image description here

If one would prefer a stretch to a scale, just substitute \stretchrel for \scalerel, to get

enter image description here

4
  • Is there a way to downsize this so it looks good next to a single-head arrow? $\doubleuparrow$ is taller than $\uparrow$. Jul 31, 2021 at 19:22
  • @CharlesRezk Please see the SUPPLEMENT to my answer. Jul 31, 2021 at 19:28
  • Thanks! I'll note this looks as desired when using pdflatex, but not in a .dvi file created from the same Tex. Jul 31, 2021 at 19:41
  • @CharlesRezk When I try to compile a dvi, I get an error that some pdfspecials cannot be rendered. However, I'm not sure what those specials woud be, since I don't recall either stackengine nor scalrel using pdfspecials. Problem seems to arise with scalerel package. Jul 31, 2021 at 19:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .