8

I am looking to write this simple product of two powers of complex numbers, but the difference in positioning of the powers in the conjugated and non-conjugated cases bothers me. The potential \vphantom-fix turns out to break the kerning of the subscript, such that subscript and superscript are directly underneath each other, instead of slightly offset according to the tilt of the letter.

\documentclass{article}
\begin{document}
\[
  \zeta^m_\theta\overline\zeta^n_\theta = \zeta^m_\theta\overline\zeta\vphantom{\zeta}^n_\theta
\]
\end{document}

the output of the above minimal example and image of the described problem

Would there be some way, to pretend to the surrounding letters, that the overlined letter has the same shape, as the original one?

0

3 Answers 3

6

If you insist on \overline, you can simplify the usage. But do use \bar instead.

\documentclass{article}
\usepackage{amsmath,mathtools}

\NewDocumentCommand{\xovl}{m}{\mathrlap{\overline{\phantom{#1}}}#1}

\linespread{1.1}

\begin{document}

$\zeta^{m}_{\theta}\bar{\zeta}^{n}_{\theta}$ is good

$\zeta^{m}_{\theta}\xovl{\zeta}^{n}_{\theta}$ is bad

$\zeta^{m}_{\theta}\overline{\zeta}^{n}_{\theta}$ is ugly

\end{document}

enter image description here

If you plan to have many such symbols, I recommend using more interline space as in the example above.

2
  • Is \bar recommended for single letter complex conjugation? I feel like it's a little less fitting on wider letters like w. And if I were to conjugate \zeta w+z, I would certainly need to use \overline and wouldn't that make the positioning of these accents and even the line widths inconsistent over the whole document when deciding case-by-case? I felt like \overline was the only possible answer.
    – David
    Jun 30, 2023 at 21:45
  • 1
    @David I use \bar also over w, where's the problem? If an expression needs to be conjugated, then \overline becomes the choice and you don't have the superscript problem, in this case.
    – egreg
    Jun 30, 2023 at 21:59
4

You can use a \bar accent

enter image description here

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
 \zeta_\theta^m\bar\zeta_\theta^n
\]
\end{document}
2
  • 1
    Replace “can’ with ‘should’😉
    – egreg
    Jun 30, 2023 at 19:27
  • @egreg Fine, then I’ll go get a should of beer. 😁
    – Gaussler
    Jul 1, 2023 at 9:56
2

I found a way, that does seem somewhat hacky to me, but seems to yield pretty much perfect results up to this point. I got the idea, when following the link that was provided by Willie Wong in the comments, although it's barely similar to the solution there.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\[
  \zeta^m_\theta\overline\zeta^n_\theta = \zeta^m_\theta\overline\zeta\vphantom{\zeta}^n_\theta = \zeta^m_\theta\mathrlap{\overline{\phantom{\zeta}}}\zeta^n_\theta
\]
\end{document}

result of my current solution

2
  • I am pretty sure this is the "correct" solution (especially since \overline already draws lines that are a bit too-long for slanted characters). Jun 30, 2023 at 18:31
  • 1
    For comparison, if you look at the code in the accents package which is designed to factor in the slant the way you want, you see that what it does there is pretty much exactly what you did here: it prints the accent without the actual character, kerns back to the location before the accent is printed, and then print the actual character, so that the sub/superscripts are attached to the character and ignores the accents. Jun 30, 2023 at 19:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .