I am having such a hard time to write this formula in the LaTeX form. I have never used LaTeX before and I know this is not difficult, but how to get that long square root and exponential? Any help will be appreciated. Thanks.

enter image description here

  • 6
    Is there a problem with \sqrt{} ? – HcN Dec 12 '15 at 0:21
  • 2
    What you've done so far? I believe any tutorial about latex for beginners definitely addresses this issue. By the way, there is no difference between having a long or short expression inside the \sqrt{}. It expands as you wish. – CroCo Dec 12 '15 at 1:14
  • 2
    I'm pretty sure you should ask a new question rather than completely overhaul this one. Assuming this is even a question worth asking... – pjs36 Dec 12 '15 at 5:19
  • 2
    If you have a second question, please ask it as a second question. Rewriting your previous question makes good answers look out of place. – Charles Staats Dec 12 '15 at 5:20
  • Please post a new question and revert this one back to the original question so that the answer below has is relevant and could help someone else in the future who has the same problem as you. Only edit questions to clarify things, not to ask a new question. – Peter Grill Dec 12 '15 at 6:36

This is the answer to your question.


\mathit{dist} = 
\sqrt{ \left( \frac{dx}{hx} \right)^{\!\!2} +  \left( \frac{dy}{hy} \right)^{\!\!2} +  \left( \frac{dz}{hz} \right)^{\!\!2}}

enter image description here

  • 1
    I would hesitate to call it 'the' answer, especially as dist should be set as text with \text{} (if loading amsmath) or \mbox{}, or - at least - using \mathit{} so it is treated as a unit and not as the product of four variables, giving the correct spacing between, especially, i and s – Au101 Dec 12 '15 at 1:43
  • @Au101, you are correct. I've updated 'the' answer. But still an answer though. :) – CroCo Dec 12 '15 at 1:48
  • 1
    And now a very good one :) I personally agree that it is best to set fractions under the radical in in-line style, rather than display style – Au101 Dec 12 '15 at 1:53
  • @Sally7874, you are welcome. – CroCo Dec 12 '15 at 2:37
  • 1
    A good refinement would be typing in the exponents as ^{\!\! 2}, in order to compensate for the large parenthesis. At least one \! is needed anyway. – egreg Dec 12 '15 at 15:31

It is actually pretty easy ... if you do not see any problem with this of course.



\mathit{dist} = \sqrt{\left(\dfrac{dx}{hx}\right)^2 + \left(\dfrac{dy}{hy}\right)^2 + \left(\dfrac{dz}{hz}\right)^2}


In summary :

  • \sqrt for the square root
  • \left( and \right) to enclose the fractions inside brackets matching the height of the \dfrac fraction inside.
  • Since the material is in displaystyle math mode, \dfrac and \frac produce the same output. – Mico Dec 12 '15 at 15:19
  • apologies for overhauling and thank you all for your answers!:) – Sally7874 Dec 12 '15 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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