[Tex/LaTex] Dot Derivative Discrepancy

amsmathmath-modevertical alignment

I am trying to typeset some higher-order time derivatives using the dot notation, and I've noticed something strange. The expressions

$\dot y + y = \cos(\dot y)$
$\ddot y + y = \cos(\dot y)$

give the expected results. However,

$\dddot y + y = \cos(\dot y)$
$\ddddot y + y = \cos(\dot y)$

causes the higher derivative term to be slightly raised, see below. Any thoughts?

enter image description here

Here is my preamble:

\documentclass{article}
\usepackage{amsmath, amssymb, amsfonts, amsthm, fouriernc}

Best Answer

The problem in placement stems from the fact that both \dddot and \ddddot construct their arguments as \mathop in order to place a "limit" on top of it. However, \mathop centres its contents vertically on the math axis if the argument is a single character (see mathop shifts the baseline, DeclareMathOperator doesn't) - a feature.

So, you should trick LaTeX in thinking it is actually more than a single character by adding (say) \hspace{0pt}:

enter image description here

\documentclass{article}
\usepackage{amsmath, amssymb, amsfonts, amsthm, fouriernc}
\begin{document}
\begin{enumerate}
  \item $\dot{y} + y = \cos(\dot y)$
  \item $\ddot{y} + y = \cos(\dot y)$
  \item $\dddot{y\hspace{0pt}} + y = \cos(\dot y)$
  \item $\ddddot{y\hspace{0pt}} + y = \cos(\dot y)$
\end{enumerate}
\end{document}

One can correct automatically the behavior by adding the following code after \usepackage{amsmath}:

\makeatletter
\renewcommand{\dddot}[1]{%
  {\mathop{\kern\z@#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@
   \hbox{\normalfont ...}\vss}}}}
\renewcommand{\ddddot}[1]{%
  {\mathop{\kern\z@#1}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@
   \hbox{\normalfont....}\vss}}}}
\makeatother