\bar vs. \overline - when to use what, semantically?
Semantically, don't use either. Use \conj
, or \mean
, or \variant
or whatever the overline is meant to mean. Then in your preamble, do:
\newcommand*\conj[1]{\bar{#1}}
\newcommand*\mean[1]{\bar{#1}}
Then:
- Your document source becomes readable: you can determine the meaning right there and then.
- Your document becomes more flexible: if you decide to denote complex conjugation by a star instead you can simply redefine
\conj
without worrying about changing what\mean
does. - You can change from
\bar
to\overline
on a whim and don't have to make that crucial decision now.
\bar{a}
can mean just "another thing" like if you used a'
or \tilde{a}
or \diamondclub
. You never use \overline
for this.
However, if you denote an operation like complex conjugation, reversal, set closure or whatever, you can use whichever you want. You found out that somehow (to some people) \bar{a}
seems "too subtile" for this purpose, and you can use the reasonable solution proposed in the other question. This goes along the fact that in this case, things like \overline{x+y}
, \overline{2U+V}
, \overline{a_1a_2
dots a_n}
have their meaning as well.
I have indeed observed a difference between \overline
and \bar
:
Having 3 lines of formula in one \align
environment, using overline in combination with a 3rd power like this:
\overline{b}^3
causes the 3rd equation to need more vertical space and the 3rd equation was shifted down a bit, which looked quite disturbing. Using
\bar{b}^3
solved the Problem, so all three equations have the same vertical distance now.
The following code produces a little sheet of pdf which illustrates some differences between bar and overline:
\documentclass{standalone}
\usepackage{amsmath}
\begin{document}
$\begin{array}{r}
a+b+c\\
a+b^3+c\\
a+\overline{b}+c\\
a+\overline{b}^3+c\\
a+\bar{b}+c\\
a+\bar{b}^3+c\\
a+\overline{b^3}+c\\
a+\bar{b^3}+c\\
a+b+c
\end{array}$
\end{document}
Note the different distances of equations and the different commutation behavior of the \bar
and \overline
commands with the power command.
Finally, I recommend always using \bar
for single numbers for example.
For complex conjugation of many numbers \overline
of course is the appropriate choice.