Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm a LaTeX newbie. I am writing a document in which I need to have a two-headed bidirectional arrow. Two-headed like \twoheadleftarrow, bidirectional like \leftrightarrow.

Is there any package that offers something like this? If not, how do I "roll my own"?

Thank you a lot!

share|improve this question

1 Answer 1

up vote 8 down vote accepted

\twoheadleftarrow and \twoheadrightarrow can be combined to \twoheadleftrightarrow:

\documentclass{article}
\usepackage{amssymb}

\newcommand*{\twoheadleftrightarrow}{%
  \twoheadleftarrow
  \mathrel{\mkern-15mu}%
  \twoheadrightarrow
}

\begin{document}
\[
  \twoheadleftrightarrow
  \scriptstyle \twoheadleftrightarrow
  \scriptscriptstyle \twoheadleftrightarrow
\]
\end{document}

Result

The symbols can also be combined using \joinrel, which is some negative space that should counteract the side bearings. However, I could see a small gap in \scriptscriptstyle with class option 10pt, thus I have removed another -0.5mu. And the new \longtwoheadleftrightarrow has an optional argument, which allows further adjustment if necessary.

\documentclass{article}
\usepackage{amssymb}

\newcommand*{\longtwoheadleftrightarrow}[1][.5]{%
  \twoheadleftarrow
  \joinrel
  \mathrel{\mkern-#1mu}%
  \twoheadrightarrow
}

\begin{document}
\[
  \longtwoheadleftrightarrow
  \scriptstyle \longtwoheadleftrightarrow
  \scriptscriptstyle \longtwoheadleftrightarrow
\]
\end{document}

Result \longtwoheadleftrightarrow

An even longer version can be composed with \relbar in the middle.

Also an expandable version can be constructed similar to \xrightarrow:

\documentclass{article}
\usepackage{amsmath,amssymb}

\makeatletter
\newcommand*{\xtwoheadleftrightarrow}[2][]{%
  \ext@arrow 99{10}{10}\twoheadleftrightarrowfill@{#1}{#2}%
}
\newcommand*{\twoheadleftrightarrowfill@}{%
  \arrowfill@\twoheadleftarrow\relbar\twoheadrightarrow
}
\makeatother

\begin{document}
\[
  \xtwoheadleftrightarrow[\text{under}]{\text{over}}
\]
\end{document}

Result \xtwoheadleftrightarrow

share|improve this answer
    
Sweet, thanks a lot! –  Tobia Tesan Jul 22 at 17:16
    
While we are at it - how would one go making them longer? I guess one would do the same kind of "composition" adding a dash-like symbol in the middle. –  Tobia Tesan Jul 22 at 17:42
2  
@tobiatesan Look into Herbert Voß's “Math Mode” (texdoc mathmode); in section 38 it is explained how to define \xleftrightarrow and it should suffice to adapt the definition in order to use the double head arrows. –  egreg Jul 22 at 18:02
    
Wunderbar. Thanks a whole lot. –  Tobia Tesan Jul 22 at 19:03
1  
The strange behavior of \joinrel is also visible when you try \longrightarrow in scriptscript style: see i.stack.imgur.com/wgVZb.png –  egreg Jul 22 at 20:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.