4

Consider the following example, to be compiled with lualatex:

\documentclass{article}

\RequirePackage{unicode-math} \setmathfont{texgyrepagella-math.otf}

\begin{document}

( f \overline{f} f )

( i \overline{i} i )

( j \overline{j} j )

( l \overline{l} l )

\end{document}

The result is:

enter image description here

As you can see, the placement of \overline is not very appropriate for these letters (but for other letters or longer things \overline seems fine). Is there some LuaTeX magic that can somehow improve this behavior?

Jinwen
  • 8,518
  • @mickep Thank you for mentioning this. This behavior is actually introduced by the second font, I shall simplify my MWE. – Jinwen Jun 05 '22 at 08:24
  • There are two problems here: (1) the wrong kerning LuaTeX applies; (2) \overline should be \bar. – egreg Jun 05 '22 at 08:47
  • @egreg I defined a command for complex conjugation to use \overline, \bar would be too short if the content is not a single letter. – Jinwen Jun 05 '22 at 08:51
  • You should look into the posting Can I get a \widebar without using the mathabx package? and especially this answer for the definition of a macro called \widebar, which is to \bar as \widetilde is to \tilde. – Mico Jun 05 '22 at 09:12
  • @Mico Thank you for this. But since this command is based on \overline, the result is still not good under LuaLaTeX. – Jinwen Jun 05 '22 at 09:18
  • @Jinwen \wideoverbar is your friend. – egreg Jun 05 '22 at 09:29
  • @egreg Thank you for this. Two problems: 1) f \wideoverbar{f} and \wideoverbar{f} f has different whitespace between the two letters, 2) is it safe to redefine \overline to be \wideoverbar? Though \wideoverbar is not perfect, it certainly looks a lot better than \overline under LuaLaTeX. – Jinwen Jun 05 '22 at 09:47

1 Answers1

4

I don't like at all the standard way of LuaTeX that suppresses italic correction in math formulas. Anyway, \overline is not the answer you're looking for. Use \wideoverbar.

\documentclass{article}

\usepackage{unicode-math} \setmathfont{texgyrepagella-math.otf}

\mathitalicsmode=1

\begin{document}

( f \overline{f} f )

( i \overline{i} i )

( j \overline{j} j )

( l \overline{l} l )

( f \bar{f} ff ) (f\overbar{f}ff) (f\wideoverbar{f}ff)

( i \bar{i} ii )

( j \bar{j} jj )

( l \bar{l} ll )

Now a serious formula (\wideoverbar{a+b})

\end{document}

enter image description here

This is the output when removing \mathitalicsmode=1

enter image description here

No, thanks!

egreg
  • 1,121,712