5

The following code

$\widetilde{aaa} \quad L^{\widetilde{aaa}}$

$\tilde{aaa} \quad L^{\tilde{aaa}}$

$\widehat{aaa} \quad L^{\widehat{aaa}}$

$\hat{aaa} \quad L^{\hat{aaa}}$

$\overline{aaa} \quad L^{\overline{aaa}}$

$\bar{aaa} \quad L^{\bar{aaa}}$

produces the following output:

What is the reason for additional vertical spacing for \widetidle and \widehat in superscript and what can one do about it?

Andrei Smolensky
  • 681
  • 4
  • 11
  • Also related: http://tex.stackexchange.com/questions/100574/really-wide-hat-symbol and http://tex.stackexchange.com/questions/63545/big-tilde-in-math-mode – Steven B. Segletes Feb 23 '17 at 14:20

1 Answers1

7

The default setting for math fonts in LaTeX (and Plain TeX) uses cmex10 at all sizes (no scaling whatsoever).

This is because the omxcmex.fd file contains

\ProvidesFile{omxcmex.fd}
        [2014/09/29 v2.5h Standard LaTeX font definitions]
\DeclareFontFamily{OMX}{cmex}{}
\DeclareFontShape{OMX}{cmex}{m}{n}{%
   <->sfixed*cmex10%
   }{}
\endinput

In Plain TeX the “equivalent” line is

\textfont3=\tenex \scriptfont3=\tenex \scriptscriptfont3=\tenex

You can remedy in LaTeX by loading amsmath that chooses the suitable (optically) scaled fonts at smaller sizes by means of

  \DeclareFontShape{OMX}{cmex}{m}{n}{%
    <-8>cmex7<8>cmex8<9>cmex9%
    <10><10.95><12><14.4><17.28><20.74><24.88>cmex10%
  }{}

This should probably be improved in modern settings where Type1 fonts for cmex are available by saying

\DeclareFontShape{OMX}{cmex}{m}{n}{%
  <-7.5>cmex7<7.5-8.5>cmex8<8.5-9.5>cmex9%
  <9.5->cmex10%
}{}

but this would be necessary only when nonstandard sizes are used.

Here's the example.

\documentclass{article}
\usepackage{amsmath}

\begin{document}
$\widetilde{aaa} \quad L^{\widetilde{aaa}}$

$\tilde{aaa} \quad L^{\tilde{aaa}}$

$\widehat{aaa} \quad L^{\widehat{aaa}}$

$\hat{aaa} \quad L^{\hat{aaa}}$

$\overline{aaa} \quad L^{\overline{aaa}}$

$\bar{aaa} \quad L^{\bar{aaa}}$
\end{document}

enter image description here

If you're using Plain TeX, then add at the top of the file

\font\sevenex=cmex7
\font\fiveex=cmex7 at 5pt
\scriptfont3=\sevenex
\scriptscriptfont3=\fiveex

Complete example

\font\sevenex=cmex7
\font\fiveex=cmex7 at 5pt
\scriptfont3=\sevenex
\scriptscriptfont3=\fiveex

$\widetilde{aaa} \quad L^{\widetilde{aaa}}$

$\tilde{aaa} \quad L^{\tilde{aaa}}$

$\widehat{aaa} \quad L^{\widehat{aaa}}$

$\hat{aaa} \quad L^{\hat{aaa}}$

$\overline{aaa} \quad L^{\overline{aaa}}$

$\bar{aaa} \quad L^{\bar{aaa}}$

\bye

The output is the same as before.

With lmodern

If using lmodern, one has to redeclare the largesymbols font, because lmodern loads the corresponding font at fixed size.

\documentclass{article}
\usepackage{lmodern}
\usepackage{amsmath}

\DeclareSymbolFont{largesymbols}{OMX}{cmex}{m}{n}

\begin{document}
$\widetilde{aaa} \quad L^{\widetilde{aaa}}$

$\tilde{aaa} \quad L^{\tilde{aaa}}$

$\widehat{aaa} \quad L^{\widehat{aaa}}$

$\hat{aaa} \quad L^{\hat{aaa}}$

$\overline{aaa} \quad L^{\overline{aaa}}$

$\bar{aaa} \quad L^{\bar{aaa}}$
\end{document}
egreg
  • 1,121,712
  • When using lmodern, the fixes that amsmath applies get "lost", and neither of your DeclareFontShape statements do work. How can I have them in the right place while using lmodern? – Marian Feb 28 '18 at 16:33
  • @Marian You have to redeclare also the largesymbols font. I'll add it. – egreg Feb 28 '18 at 17:27