2
    \documentclass{article} 
    \usepackage{unicode-math}
    \setmathfont{XITS Math}

    \begin{document} 
    The quadratic formula is 
    \\\\
    $x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}$
    \end{document}

I am running this program using Xelatex but it gives the error in line 3. !undefined control sequence and !Latex error Missing \begin{document}

  • 1
    What TeX distribution are you using? By the way, you should never use \\ in order to “leave a blank line”, and \\\\ will always end up in an error (No line to end). – egreg Nov 21 '14 at 10:35
  • You will have to load \usepackage{mathtools} or amsmath in front of unicode-math (or get rid of the dfrac) – LaRiFaRi Nov 21 '14 at 10:36
2

\dfrac is defined in amsmath but never use \\ to force line breaks:

  \documentclass{article} 
    \usepackage{amsmath}
 \usepackage{unicode-math}
    \setmathfont{XITS Math}


    \begin{document} 
    The quadratic formula is 
    \[
    x = \dfrac{-b \pm \sqrt{b^2 - 4ac}}{2a}
     \]
    \end{document}
  • The OP says the error is at line 3, which makes me suspect \setmathfont is the problem; the processing didn't get past \begin{document}. – egreg Nov 21 '14 at 10:48
  • Now it is giving the same error on line 4 If i remove \usepackage{unicode-math} and \setmathfont{XITS Math} it works fine. – Shaheryar Nov 30 '14 at 16:22
  • @Shaheryar the above document worked without error for me, if it fails for you put the entire log in your question in a {} code block. – David Carlisle Nov 30 '14 at 16:27

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.