Bad positioning of slanted (italic) math accents

computer-modernfontsmath-fontsmath-modeplain-tex

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?
enter image description here

Best Answer

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

enter image description here