With \twoheadrightarrow
we can get arrow with two heads. Is there any command for getting two heads with up arrow?
2 Answers
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}
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}
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 \uparrow
s:
\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}
-
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.– manjushaJul 9, 2013 at 7:21
-
@manjusha Why wouldn't one be allowed to use
graphicx
? The symbols is not predefined inamssymb
(there's a\twoheaduparrow
in theMnSymbol
package, butMnSymbol
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.– manjushaJul 10, 2013 at 13:06
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}
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}
If one would prefer a stretch to a scale, just substitute \stretchrel
for \scalerel
, to get
-
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
-
-
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
\twoheaduparrow
fromMnSymbol
perhaps?:)
MnSymbol
symbols at the default ones when usingmathptmx
package. Is it so strange (or even bad practice)?