15

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

Count Zero
  • 17,424
manjusha
  • 445

2 Answers2

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

Gonzalo Medina
  • 505,128
  • 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 04 '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 04 '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 09 '13 at 07: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 09 '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
  • In general if \twoheadleftarrow and \twoheadrightarrow is in amssymb. Then is'nt it easy to have two more commands with \twoheaduparrow and \twoheaddownarrow in amssymb? – manjusha Jul 10 '13 at 13:11
  • @manjusha that is a question you should ask to the maintainers of the AMS packages. You can contact them using tech-support@ams.org. – Gonzalo Medina Jul 10 '13 at 15:56
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

  • Is there a way to downsize this so it looks good next to a single-head arrow? $\doubleuparrow$ is taller than $\uparrow$. – Charles Rezk Jul 31 '21 at 19:22
  • @CharlesRezk Please see the SUPPLEMENT to my answer. – Steven B. Segletes Jul 31 '21 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. – Charles Rezk Jul 31 '21 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. – Steven B. Segletes Jul 31 '21 at 19:55