Horizontal line in the middle (text alignment)

MWE:

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

\begin{document}

\begin{gather*}
y=3x-6 --- {1}\\
y=-x+5 --- {2}\\
\end{gather*}

\end{document}


Picture:

How do I join the three dashes?

I tried \rule and \line but they only give me a line aligned to the bottom of the text.

• A simple solution is to put --- in an \mbox{---} command. – Guido Apr 4 '15 at 9:27

If you want rule:

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

\begin{document}

\begin{gather*}
y=3x-6 \mathrel{\vcenter{\hbox{\rule{2cm}{1pt}}}} {1}\\
y=-x+5 \mathrel{\vcenter{\hbox{\rule{2cm}{1pt}}}} {2}\\
\end{gather*}

\end{document}


Depending on how long the rule should be, you may change the dimension or simply use \text{---}..