4

I have 2 questions :

  • What is the maximum limit of dots that I can display above a variable to indicate its derivative ? (I read it somewhere that 4 is the limit. Still not sure)
  • How do I print more dots than these in a general form?
  • 8
    Usually, higher derivatives are written using a number, since it is difficult to read if there are too many dots or primes. For example, the sixth derivative of y would be written as $y^{(6)}$. – Håkon Marthinsen Dec 17 '15 at 17:42
  • 1
    Welcome to TeX.SX! Are you asking about the style of using dots for higher order derivatives? Most times, higher order derivatives (order > 3) are indicated as f^{(4)} etc. –  Dec 17 '15 at 17:42
  • dot typically denotes "time derivative" whereas a prime is a more general derivative notation. And if the prime is OK, I've seen roman-numerals as superscripts to denote bigger than 3rd order derivatives. – Steven B. Segletes Dec 17 '15 at 17:43
  • @StevenB.Segletes: True, but higher order time derivatives (order > 2) rarely occur (in Physics,unless using the Abraham - Lorentz - Dirac equation of interaction of a charged particle with it's own field). Most likely, the dot indicates derivatives with respect to some parameter. –  Dec 17 '15 at 17:46
  • @HåkonMarthinsen: I think your reasoning is the best one: It's hard to recognize more then three dots (or primes) –  Dec 17 '15 at 17:59

1 Answers1

8

Edit: Improved version in the second half of this post.

If you really want to, you could define a new command to include as many dots as you want in the same way as amsmath does for three and four dots. Here is an example with any number of dots, using the multido package:

\documentclass{article}
\usepackage{amsmath}
\usepackage{multido}

\makeatletter
\ams@newcommand{\vardot}[2]{%
  {\mathop{#2\kern0pt}\limits^{\vbox to-1.4\ex@{\kern-\tw@\ex@
   \hbox{\normalfont\multido{}{#1}{.}}\vss}}}}
\makeatother

\begin{document}
$\vardot{6}{x}$
\end{document}

The command \vardot{n}{x} will print n dots over x.


Improved version

Generalizing the related answer of Hendrik Vogt, we get much nicer output that fixes many typographical problems of the original amsmath commands \dddot and \ddddot. This version implements the command \vardot[n]{x}, where n is the number of dots to put above x. The number n is an optional argument with default value of 1.

\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\usepackage{accents}

\ExplSyntaxOn\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}%
  }
\NewDocumentCommand \vardot {O{1} m }
  {
    \int_compare:nNnTF
      {#1} = {1}
      {\dot #2}
      {\placeaccent{\prg_replicate:nn {#1-1} {\acc@dot\mkern1.4mu}\acc@dot}{#2}}
  }
\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\ExplSyntaxOff

\begin{document}
$\vardot[6]{x}$
\end{document}

I'm sure this code can be improved a lot, since I am not an experienced TeX programmer. I'm not sure if mixing expl3 code with the LaTeX code of Hendrik Vogt is a good idea, but it seems to work.

  • Now define a command \makehugenumberofdotscommand that automatically defines \dddddddddddd etc. ;-) –  Dec 17 '15 at 18:12
  • expl3 will help with @ChristianHupfer's challenge :-) (Well, if you want to autogenerate the command name. It could be done quite simply with plain ole' TeX if you provide the command token yourself.) – Sean Allred Dec 17 '15 at 18:17
  • @SeanAllred: Go ahead :D –  Dec 17 '15 at 18:17
  • @ChristianHupfer I cheated and used multido. ;-) – Håkon Marthinsen Dec 17 '15 at 18:20
  • @HåkonMarthinsen You should use \mathop{#2\kern0pt}. The added kern prevents TeX from vertically centering #2 if it happens to be a single symbol. This is a bug in the amsmath code. – Dan Dec 17 '15 at 18:57
  • @Dan: I tried your suggestion, but I couldn't see any difference in the output for many different test cases. Can you provide a case where the current version fails? – Håkon Marthinsen Dec 17 '15 at 19:26
  • @Dan: Nevermind, I see the problem. Fixed it now. – Håkon Marthinsen Dec 18 '15 at 16:29