So what I am trying to type is the square of the derivative of vector x. I tried \dot{vec{x}}^{\,2} as well as \dot{\vec{x}^2}, but the outputs came out to be very offset. Is there a correct way to do this?

The code I used is:

\begin{equation}    
L=\frac{1}{2} m \dot{\vec{x^2}}     
\end{equation}

which give me

enter image description here

  • Welcome to TeX.SE! Can you please, as usual here -- show us a short compilable code and an screenshot of your result? – Kurt Dec 7 at 5:04
  • 1
    One reason more for not using the arrow for vectors. – egreg Dec 7 at 8:46
up vote 6 down vote accepted

I'd probably do

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation}    
L=\frac{1}{2} m \Dot{\vec{x}}^2     
\end{equation}
\end{document}

enter image description here

because the Lagrange function is a function of the square of the time derivative of x (and not the time derivative of the square of x).

  • That's what I wanted to write, but did not know how to. Thanks. – Kane Billiot Dec 7 at 5:27
  • Is there a difference between \dot and \Dot? – Kane Billiot Dec 7 at 5:29
  • @KaneBilliot Short answer: \Dot works also when you already have something on top of the symbol. So it would not shift. – marmot Dec 7 at 5:30
  • 1
    @marmot - For the case at hand, using \dot and \Dot produce the same result. – Mico Dec 7 at 5:35
  • 1
    At the beginning, amsmath provided capitalized versions of the math accent commands, which had to be used for “nested accents”. A later version of amsmath made the standard commands (all lowercase) “nesting aware”. The other commands remained for back compatibility. – egreg Dec 7 at 8:46

The first or third option below may be close to what you're looking for. Or, switch from Newton-style to Leibniz-style notation for the derivative, as shown by the fourth option (newly fixed to incorporated @marmot's comment). A separate comment: to make the \frac{1}{2} term less visually dominant, consider using \tfrac instead of \frac.

enter image description here

\documentclass{article}
\usepackage{amsmath} % for \tfrac macro and general accent-placement support
\begin{document}
\[
\tfrac{1}{2}m \dot{\vec{x}} ^2     \quad
\tfrac{1}{2}m{\dot{\vec{x}}}^2     \quad
\tfrac{1}{2}m{\dot{\vec{x}}}^{\,2} \quad
\tfrac{1}{2}m\bigl(\tfrac{\mathrm{d}\vec{x}}{\mathrm{d}t}\bigr)^{\!2}
\]
\end{document}
  • 2
    I'm pretty sure Leibniz didn't use upright d's. ;-) – egreg Dec 7 at 8:52
  • @egreg - I'm pretty sure of that too... I switched to slanted to upright d's mainly on the (now deleted) suggestion of marmot. :-) – Mico Dec 7 at 10:25
  • @egreg That's a very bold statement. Did you know Leibniz personally? I would bet a lot of money on having him typeset the d's upright. Assume you have diameter $d$ that depends on time. How would you typeset its time derivative? \frac{dd}{dt}? Not really, right? And after all this is a question on the typesetting a physics Lagrange function, and at least in physics people won't hurt others' eyes by typesetting \frac{dd}{dt}. – marmot Dec 7 at 13:46
  • @marmot - Wouldn't it be nice to have access to a few first-edition originals -- facsimiles will do too, I suppose -- of Leibniz's own publications? (In case you're curious: I'm afraid I have no such access...) – Mico Dec 7 at 14:08
  • @Mico I guess we will not be able to figure out how Leibniz would have typeset it. However, I have a reason for pushing for upright d's, namely examples of the type \frac{dd}{dt}. Do you have examples in which upright d's lead to an unfortunate output? – marmot Dec 7 at 19:10

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.