[Tex/LaTex] overline over no text

formattingmath-mode

Suppose I want to have the function $\bar: A \to B$ where instead of $\bar$ it's a longer bar. What is the proper way to do this? Note that the bar here is floating on top of no text. It's just floating.

I also wasn't sure what tags to use. Sorry.

Thanks.

Best Answer

If I understand what you're trying to do, you can use \overline{\phantom{<text>}}:

\documentclass{article}
\pagestyle{empty}
\begin{document}

$\overline{\phantom{A}}: A\to B$

$\overline{\phantom{AA}}: A\to B$

$\overline{\phantom{AAA}}: A\to B$

\end{document}