# Bad positioning of slanted (italic) math accents

The math accents are usually taken from textfonts (only \vec from the math italic font). I would like to have an italic accent over an italic letter also in math mode. To present the problem quickly I load the text italic font into fam0.

MWE:

Good: $\ddot f$,
%
\textfont0=\tenit% to get italic accents
%
bad: $\ddot f$

\bye


This results in bad positioning of the italic accent. What is happening?

I don't understand that.

Edit: The skewchar should solve all the problems with the accent spacing, shouldn't it?

• I think an MWE would help here (reduce the likelihood of wrong guessing about the setup). Feb 19 at 19:10
• @Dr.ManuelKuehner that is a mwe (plaintex). Feb 19 at 19:11
• @UlrikeFischer Ah thanks, that was not clear to me from the description or the tags (I added plain-tex now to the tags and the title). Feb 19 at 19:17
• @Dr.ManuelKuehner: There will be the same problem in LaTeX as long as you use the standard math fonts. Feb 19 at 19:22
• Ok, please keep or discard my changes as you wish. Feb 19 at 19:27

I'm not sure what would be the reason for doing it: the math accents are symbols on their own and don't depend on the accentee. Anyway, your approach is flawed: see the lines 2 and 3 above the rule. And the fix I propose.

% your attempt
\textfont0=\tenit

1. $\ddot{f}\ddot{\mathop f}f$

2. $\ddot{x}\ddot{\mathop x}x$

3. $\sin x$

\bigskip
\hrule
\bigskip

% revert
\textfont0=\tenrm
\newfam\italicaccents
\textfont\italicaccents=\tenit
\skewchar\textfont1=-1

\def\gobble#1{}
\def\newaccent#1{%
\edef\temp{\expandafter\gobble#1}%
\edef#1{\mathaccent\the\numexpr\temp+256*\the\italicaccents\relax\space}%
}
\newaccent\ddot

1. $f\ddot{f}f$

2. $x\ddot{x}x$

3. $\sin x$

\bye


The double-dot accent character in font \tenit is itself skewed to the right, and this effect is added to the \skewchar correction of the \teni f, moving it too far to the right in total.

After reading rule 12 in appendix G of The TeXbook, I found that you can avoid the \skewchar correction by replacing the single character f with a \mathpunct f (not \mathop, because that might center the character vertically). Alternatively, you can set \skewchar\teni=-1. The italicized accent is then somewhat more to the left than the straight accent.

If you don't like that, you can use a non-math accent.

\textfont0=\tenit
$\ddot f - \ddot{\mathpunct f} - \hbox{\tenit\"{\teni f}}$
\bye


• do you mind scaling up your screenshot, so that readers may appreciate the details? Feb 20 at 20:27
• I have enlarged it. Feb 21 at 6:54
• Try \mathop x and you'll have a surprise. Feb 21 at 13:42
• @egreg, thanks, I have edited my answer. Feb 21 at 14:03