# \dot{\vec{\hat{x}}}} fails to compile with svjour3

The title says it all. I would like to typeset the time-derivative of a vector whose symbol shall be \hat{x}. The documentclass svjour3 is used in Springer journals. The following MWE reproduces the behaviour in the article class:

\documentclass{article}
\if@mathematic
\def\vec#1{\ensuremath{\mathchoice
{\mbox{\boldmath$\displaystyle\mathbf{#1}$}}
{\mbox{\boldmath$\textstyle\mathbf{#1}$}}
{\mbox{\boldmath$\scriptstyle\mathbf{#1}$}}
{\mbox{\boldmath$\scriptscriptstyle\mathbf{#1}$}}}}
\else
\def\vec#1{\ensuremath{\mathchoice
{\mbox{\boldmath$\displaystyle#1$}}
{\mbox{\boldmath$\textstyle#1$}}
{\mbox{\boldmath$\scriptstyle#1$}}
{\mbox{\boldmath$\scriptscriptstyle#1$}}}}
\fi

\usepackage{amsmath}

\begin{document}
$$\dot{\vec{\hat{x}}} % Failure \vec{\dot{\hat{x}}} % OK \dot{\hat{\vec{x}}} % OK$$
\end{document}


Pdflatex output contains

! Undefined control sequence.


How can I typeset such a vector in the svjour3 class?

• The code as posted has \if@m which tests if @ is m so it is always false. Sep 11 '14 at 13:56
• Where is that if@mahtematic even coming from? And why does your mwe use article but you talk about svjour3? Sep 11 '14 at 13:58
• The code posted runs without error and the warning Package amsmath Warning: Unable to redefine math accent \vec.  Sep 11 '14 at 13:58
• I figured that not everybody has access to the class svjour3 thus I copied the vector definition into an article in order to construct a mwe. Sep 11 '14 at 14:24
• @user1225999 but you need to check that your "mwe" is actually an example of the problem, the above code clearly is not. Sep 11 '14 at 14:34

The svjour3 class uses a wrong way for redefining \vec.

Just load the class and do

\let\vec\mathbf


Full example

\documentclass{svjour3}
\usepackage{amsmath}

\let\vec\mathbf % fix svjour3 wrong definition

\begin{document}

$$\vec{\dot{\hat{x}}} \dot{\vec{\hat{x}}} \dot{\hat{\vec{x}}}$$

\end{document}


If you prefer bold italic vectors, add \usepackage{bm} and do

\let\vec\bm


• I assume the author of the svjour3 class had his/her reasons to define the vector this way. In what way does your definition behave differently? Sep 11 '14 at 14:28
• @user1225999 I can see no good reason in defining \vec that way. The only reason I see is: let's port this code from a very old version of LaTeX to the new version, changing {\bf#1} into \mathbf{#1}. Sep 11 '14 at 14:39
• @egreg -- it seems that your example shows up a bug (haven't tracked down where). the middle "x" really shouldn't be italic; it should be bold and upright like the other two. (but not your fault.) Sep 11 '14 at 18:40
• @barbarabeeton Math accents in amsmath should be revised. Sep 11 '14 at 20:04
• @egreg -- true, but an amsmath overhaul hasn't been scheduled, and probably won't be soon. i think i'll suggest that the maintainer of mathtools do it there as a "temporary" expedient. Sep 11 '14 at 20:14

The cleanest way to do it is:

\RequirePackage{amsmath}
\documentclass{svjour3}


Like that, amsmath is loaded first and defines \vec, then svjour3 can redefine the command.

Unfortunately, you have to put the \vec into the outermost braces:

\RequirePackage{amsmath}
\documentclass{svjour3}
\begin{document}
$$\vec{\dot{\hat{x}}} %OK %\dot{\vec{\hat{x}}} %Failure %\dot{\hat{\vec{x}}} %Failure$$
\end{document}

• I don't think this will actually solve the problem in the question, as that problem is caused by the definition in svjour3.cls, as I understand it. Dec 3 '15 at 14:50
• First, it did in my case. Second, like this, you don't have to redefine '\vec{ }' as the other solutions did. Dec 14 '15 at 14:40
• So if you try the example at bitbucket.org/snippets/torbjornt/ayyMb it compiles without error? That is not the case here, but it works fine after uncommenting the \let statement. (Admittedly, the error I get is not the same as reported in the question.) Dec 14 '15 at 15:48
• I tried your example. I have to admit, that it does NOT compile. However, if you put the arguments in this exact order: \vec{\hat{\dot{x}}} it does. I'm sorry, i'll edit my answer. Dec 16 '15 at 14:16
• Fair enough, so that's one more combination that works, but the combination that the OP wants to use is different -- the dot on top of the hat. Dec 16 '15 at 14:22