6

I would like to display a matrix with a dot (derivative) on top of it. The entry of this matrix shall consist of arbitrary symbols.

When I write

 \begin{align}
   \dot{\begin{pmatrix} x \\ y \end{pmatrix}}
 \end{align}

everything works fine. However,

 \begin{align}
   \dot{\begin{pmatrix} \hat{x} \\ \hat{y} \end{pmatrix}}
 \end{align}

results in a weird series of errors (Illegal units of measure etc.).

How can I display a matrix derivation with hats (or other ornaments) on my x and y variables? Neither changing from pmatrix to array nor setting brackets did bring any improvements.

A complete example of the problem reads:

 \documentclass{report}
 \usepackage[utf8x]{inputenc}
 \usepackage{amsmath,amsfonts,mathrsfs,amssymb,dsfont}
 \begin{document}
   \begin{align}
     \dot{\begin{pmatrix} \hat{x} \\ \hat{y} \end{pmatrix}} % Problem!
   \end{align}
 \end{document}
Enrico
  • 63
  • welcome to TeX.sx! Could you provide a MWE? – Federico Nov 28 '13 at 13:04
  • 2
    this is kind of a recurring problem and there is a duplicate somewhere. My personal recommendation is that put d\dt next to the matrix instead of the dot. It often looks like a dirt on the screen. – percusse Nov 28 '13 at 13:13
  • 1
    @percusse - Agreed, this might me more of a mathematical point but I think a dot above a matrix would be poor notation. d/dt is much clearer Also, dot above the vector may be ambiguous of whether it is just a dot above the first element. – oLas Nov 28 '13 at 13:25
  • I am aware of the mathematical and optical ambiguities of this notation. Nevertheless, dots are commonly used as derivation symbols in physics. – Enrico Nov 28 '13 at 13:34
  • Your complete example is incomplete please make it show the problem described, not missing \begin{document} – David Carlisle Nov 28 '13 at 13:39
  • @Mico that's expected, \dot in latex is just the tex primitive mathaccent.\dot in amsmath is a different thing altogether:-) – David Carlisle Nov 28 '13 at 13:51
  • 1
    @Enrico, well aware that physicists use the dot notation for derivation, however I've never seen a single physicist use that notation on a matrix presumably because it may get lost as others have mentioned. – daleif Nov 28 '13 at 14:23

1 Answers1

7

amsmath has some fancy code for double accents and having \hat inside \dot triggers bits of that in unintended ways. Easiest is to pre-set the inner expression in a box.

enter image description here

\documentclass{report}
 \usepackage[utf8x]{inputenc}
 \usepackage{amsmath,amsfonts,mathrsfs,amssymb,dsfont}
\begin{document}

 \begin{align}
 \sbox0{$\begin{pmatrix}\hat{x} \\ \hat{y} \end{pmatrix}$}\dot{\usebox{0}}
 \end{align}
\end{document}
David Carlisle
  • 757,742
  • See http://tex.stackexchange.com/questions/30327/why-do-arguments-to-nested-tilde-or-breve-commands-reappear-when-amsmath-is-us for reference – egreg Nov 28 '13 at 13:48
  • 7
    After seeing the image I'd warmly recommend the OP not to use this notation. – egreg Nov 28 '13 at 13:49
  • 1
    @egreg yes:-) although after seeing your other answer maybe this could be closed as duplicate (same answer although question is a bit different) – David Carlisle Nov 28 '13 at 13:52
  • 1
    @ egreg I did not find this question although I searched for quite a wile. And I agree, it does not look so good. – Enrico Nov 28 '13 at 14:04