Sign up ×
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.

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.


share|improve this question
Welcome to! :) –  clemens Jul 21 '14 at 19:09
I wouldn't go for that notation. It would be clearer to write it out: We define $x\to \overline{x}$ as a map $A\mapsto B$. Or something like that, I'm not a very good English speaker. If you go for the direct notation anyways, use parentheses to clarify the notation: $(\overline{\phantom{A}}):A\mapsto B$. –  yo' Jul 21 '14 at 19:19
Not what you're asking about but $f\colon A\to B$ puts the colon in the right place: something like f: A -> B instead of f : A -> B. –  David Richerby Jul 21 '14 at 21:24

2 Answers 2

up vote 5 down vote accepted

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


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

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

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

share|improve this answer

If I may, there is another alternative that provides more flexibility. i.e., Use of


The \rule command is used to produce horizontal lines. The arguments are defined as follows.

raise-height specifies how high to raise the rule (optional)

width specifies the length of the rule (mandatory)

thickness specifies the thickness of the rule (mandatory)

enter image description here


\usepackage[paper size={12cm,8cm}

baseline + 0cm \hfil shorter \hfil thicker

\hfil $\rule[0cm]{1cm}   {0.1pt}: A\to B$  
\hfil $\rule[0cm]{0.5cm} {0.1pt}: A\to B$  
\hfil $\rule[0cm]{1cm}   {1pt}:   A\to B$  \hfil

\medskip    baseline + 0.1cm    \medskip

\hfil $\rule[0.1cm]{1cm}  {0.1pt}:  A\to B$ 
\hfil $\rule[0.1cm]{0.5cm}{0.1pt}:  A\to B$ 
\hfil $\rule[0.1cm]{1cm}  {1pt}:    A\to B$ \hfil

\medskip    baseline + 0.3cm     \medskip

\hfil $\rule[0.3cm]{1cm}   {0.1pt}: A\to B$ 
\hfil $\rule[0.3cm]{0.5cm}{0.1pt}:  A\to B$ 
\hfil $\rule[0.3cm]{1cm}  {1pt}:    A\to B$ \hfil

\medskip    baseline + 0.5cm    \medskip

\hfil $\rule[0.5cm]{1cm}   {0.1pt}: A\to B$
\hfil $\rule[0.5cm]{0.5cm} {0.1pt}: A\to B$ 
\hfil $\rule[0.5cm]{1cm}   {1pt}:   A\to B$ \hfil

share|improve this answer

Your Answer


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.