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?
I have 2 questions :
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.
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.
\makehugenumberofdotscommand that automatically defines \dddddddddddd etc. ;-)
–
Dec 17 '15 at 18:12
\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
ywould be written as$y^{(6)}$. – Håkon Marthinsen Dec 17 '15 at 17:42f^{(4)}etc. – Dec 17 '15 at 17:42