9

I have a vector defined as \begin{bmatrix}x \\ \hat{x}\end{bmatrix} and it displays as expected, however if i try to add a dot derivative it gets misaligned.

minimal example:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$$\dot{
\begin{bmatrix}x \\ \hat{x}\end{bmatrix}}
$$
\end{document}

results in:

Misaligned vector

  • 4
    Unrelated never use $$...$$ as this is not LaTeX syntax and does not follow LaTeX configuration. Use \[ ... \] or similar. – daleif Mar 16 '23 at 12:20

1 Answers1

8

enter image description here

amsmath is working hard to enable a dot accent over a hat accent.

You can reset things inside \dot so it "forgets" it is in a nested accent construct.

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\let\mathaccentV@@\mathaccentV
\def\resetaccents{%
\macc@depth=\z@
\let\mathaccentV\mathaccentV@@
}
\makeatother

\begin{document}

[\dot{\hat{x}}]

[ \dot{\resetaccents \begin{bmatrix}x \ \hat{x}\end{bmatrix}} ] \end{document}

David Carlisle
  • 757,742