Dot Derivative Discrepancy
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}
:
\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
The short answer
The accents
package fixes this buggy behaviour of \dddot
and \ddddot
(and also a few other issues; see below). If the accents
versions still don't make you happy, give the code at the end of this answer a try.
The long answer
Werner gave a great explanation of how the vertical positioning problem arises and how it can be fixed. I'd like to discuss a few more (not quite as conspicious) issues I see with \dddot
and \ddddot
. These occur also without using the fouriernc
package (which in addition leads to overly large dots, as Mico noted in his comment to the question), so I didn't load fouriernc
for producing the screenshots below.
As one sees in the image, the dots in
\dddot{y\hspace{0pt}}
are quite a bit farther apart than in\ddot{y}
. (I don't think that this is intentional.)If one looks a bit closer, then one sees that the dots from
\dddot
are also a bit higher than those from\ddot
.With
\dddot
and\ddddot
, the horizontal positioning of the dots isn't satisfactory either, in my opinion. Namely, these commands don't take into account the skew of the character like the math accents\dot
and\ddot
do. This isn't obvious in the image withy
above, but a comparison of\dddot{J\hspace{0pt}}
and\ddot{J}
makes it clear: . (And this is not the fault of the\hspace{0pt}
fix.)\dddot
and\ddddot
don't work properly in sub- and superscripts: the dots have the same size and spacing as in\textstyle
. But I don't see a real problem here since probably one shouldn't use those commands in sub- and superscripts anyway.On an overly pedantic note, the dots in
\dddot
(black) are a few percent larger than those in\ddot
(red). Moreover, the bounding box of\dddot{y}
is not quite high enough. The latter might be a minor issue, but I didn't encounter any problems.
The accents
package fixes some of the above issues by redefining \dddot
and \ddddot
appropriately. In particular, the dots are placed like accents to that the skew is taken into account, and the dots are closer together. For \ddddot
, they are in fact noticeably closer together than in \ddot
. All in all, it looks much better:
One clearly sees that one would have to put some extra space around \ddddot{l}
in the right hand side of the above formula. The reason is that the dots are defined in a way that they take up no horizontal space. (This is a side effect of \ddddot
being defined as a math accent.) On the left hand side this behaviour leads to nice spacing in the left hand side.
Issue #2 is not fixed by accents
: strangely enough, the package sets the dots a bit lower than in \ddot
. Actually the dots are lowered a bit more than they're raised with amsmath
. Also point #4 in the list isn't quite fixed, the most obvious point being that \dddot
doesn't work properly in \scriptstyle
since the definition contains a \textstyle
that should be removed:
\def\dddot{\accentset{{\cc@style.\mkern-1.7mu\textstyle.\mkern-1.7mu.}}}
If you're still not quite satisfied with the versions from the accents
package, then you can use my implementation of \dddot
and \ddddot
below which fixes all the issues above (except for the marginally too large dot-size mentioned in #5 :-)
). The code only works together with amsmath
since it hacks into amsmath
's accent placement (just like here). In the image below I compare my implementation (line 1) with the accents
(line 2) and amsmath
(line 3) implementations. (Note that I didn't use Werner's fix for amsmath
.)
\documentclass{article}
\usepackage{amsmath}%, fouriernc}
\let\amsdddot\dddot
\let\amsddddot\ddddot
\usepackage{accents}
\let\accdddot\dddot
\let\accddddot\ddddot
\makeatletter
\renewcommand*\dddot[1]{%
\placeaccent{\acc@dot\mkern1.4mu\acc@dot\mkern1.4mu\acc@dot}{#1}%
}
\renewcommand*\ddddot[1]{%
\placeaccent{\acc@dot\mkern1.4mu\acc@dot\mkern1.4mu\acc@dot\mkern1.4mu\acc@dot}{#1}%
}
\newcommand*\placeaccent[2]{%
\begingroup
\def\acc@dot{\kern-0.08em.\kern-0.08em}%
\def\acc@skip{\ifx\macc@style\displaystyle0.32
\else\ifx\macc@style\textstyle0.32
\else\ifx\macc@style\scriptstyle0.22
\else0.15\fi\fi\fi ex}%
\def\mathaccent##1##2{%
\setbox6\hbox{$\m@th\macc@style#1$}%
\@tempdima\wd4
\advance\@tempdima\macc@kerna
\advance\@tempdima-\wd6
\divide\@tempdima\tw@
\@tempdimb\z@
\ifdim\@tempdima<\z@ \@tempdimb-\@tempdima \@tempdima\z@ \fi
\vbox{\offinterlineskip
\moveright\@tempdima\box6
\kern\acc@skip
\moveright\@tempdimb\box4}%
}%
\macc@depth\@ne
\let\math@bgroup\@empty \let\math@egroup\macc@set@skewchar
\mathsurround\z@ \frozen@everymath{\mathgroup\macc@group\relax}%
\macc@set@skewchar\relax
\let\mathaccentV\macc@nested@a
\macc@nested@a\relax111{#2}%
\endgroup
}
\makeatother
\begin{document}
\fboxrule0.0001pt
\fboxsep0pt
\begin{enumerate}
\item $\dot y + \ddot y + \dddot y + \ddddot{y} = \cos(\ddddot l)$,
\quad \fbox{$\dddot{y}$}, \quad
$\ddot{A}_{\dddot{x}_{\ddddot{x}}} \ne \dddot{A}_{\ddot{x}_{\dot{x}}}$
\let\dddot\accdddot
\let\ddddot\accddddot
\item $\dot y + \ddot y + \dddot y + \ddddot{y} = \cos(\ddddot l)$,
\quad \fbox{$\dddot{y}$}, \quad
$\ddot{A}_{\dddot{x}_{\ddddot{x}}} \ne \dddot{A}_{\ddot{x}_{\dot{x}}}$
\let\dddot\amsdddot
\let\ddddot\amsddddot
\item $\dot y + \ddot y + \dddot y + \ddddot{y} = \cos(\ddddot l)$,
\quad \fbox{$\dddot{y}$}, \quad
$\ddot{A}_{\dddot{x}_{\ddddot{x}}} \ne \dddot{A}_{\ddot{x}_{\dot{x}}}$
\end{enumerate}
\end{document}
Unicode has dedicated accent characters for those: 0x20DB
and 0x20DC
.
So with unicode-math
, \dddot
and \ddddot
should work correctly. It should be noted that Will Robertson, the author of unicode-math
, states in the README:
I am a little wary of encouraging people to use this package for production work
Nevertheless, Unicode is certainly The Way Of The Future™.