I'm new to LyX. I'm writing my next homework with it to give it a try. My example code is below:

% Preview source code

%% LyX created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
This is an expression with dfrac:

\[ f(x) = \dfrac{2}{x} \]

Under another question, they offered me to use \dfrac fractions for a better view. However, using dfrac causes compiler error like below:

Compiler Error

I thought this error with dfrac may be due to not using the amsmath package. I went to Menu > Document > Settings > Math Options, I unchecked Use AMS math package automatically and I checked Use AMS math package. LyX added \usepackage{amsmath} and \usepackage{amssymb} lines into the source code. Now when I try to preview my article in PDF format, it gives LaTeX Error: File 'amsmath.sty' not found. error.

I used to use online Latex editors, then copy screen shot of their output and paste it into MS Word. It was so simple doing that way. Now all these packages, uneditable source code, and all these complexity for writing a simple fraction is making me too frustrated. I have started to question if I did the right thing with switching to LyX. Because those online editors perfectly displaying that dfrac fraction in my example.

How do I write a simple dfrac fraction after opening a new article from Menu > File > New in a fresh LyX installation?

1 Answer 1


go to documents->settings->math-> enable amsmath

  • When I try to preview it says "LaTeX Error: File 'amsmath.sty' not found.". Commented Mar 21, 2013 at 21:10
  • @hkBattousai: See How do I update my TeX distribution?
    – Werner
    Commented Mar 21, 2013 at 21:12
  • @hkBattousai: the \dfrac in your example has no effect, the equation is alread set in displastyle. However, I cannot believe that amsnmath isn't installed. What system do you have?
    – user2478
    Commented Mar 21, 2013 at 21:14
  • My OS is Windows 7 Ultimate x64. I installed LyX a few days ago. It installed packages during installations from a default online repository. I'm updating packages by MiKTeX update tool again at the moment. Commented Mar 21, 2013 at 21:20
  • Result: It only found update to a package named "fontspec". Then my code suddenly started to work. I don't know why but it now works. I did make any change in a bit other than running the update tool. I have a hard time understanding this LyX editor... Commented Mar 21, 2013 at 21:28

You must log in to answer this question.

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