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}

2
  • 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, 2014 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, 2014 at 10:36

1 Answer 1

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}
3
  • 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, 2014 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, 2014 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. Nov 30, 2014 at 16:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .