3

I want to use arrows to talk about edges in graphs. For example I write $\to \to$ to represent two adjacent directed edges.

An undirected edge followed by a directed edge would be represented by something like $- \to$, but this looks bad, because the line $-$ is shorter than $\to$.

How do you make $-$ longer? Line drawing commands like rule or \tikz\draw do not look right, because they make a rectangle with sharp corners unlike the rounded corners of \to. (or perhaps making $\to$ shorter is the better way?)

BeniBela
  • 553

1 Answers1

3

Here's a solution:

\documentclass{article}

\usepackage{mathtools}
\newcommand{\mathdash}{\relbar\mkern-9mu\relbar}

\begin{document}

     \[ \begin{array}{l}
     A - B \\A \rightarrow B \\
     A \mathdash B\\
     \end{array} \]%

\end{document} 

enter image description here

Bernard
  • 271,350
  • Not perfect. How do you prevent the line breaking algorithm from splitting this symbol into two symbols when the box is too small? \parbox{1em}{$\mathdash$} – BeniBela Jun 08 '18 at 22:16