[Tex/LaTex] Numbered equations in Lyx


I'm using Lyx and every time I try to enter a numbered equation, the number comes as (1), nothing else.
I'm using Insert->Math->numbered equation. What do I do?

The code

Lyx output

Best Answer

This is a long-standing bug in LyX. The reason it exists is that when you add an equation, LyX runs LaTeX in the background to generate a preview of the equation. But because it does not want to rerun the previews of all of the other equations (because of performance considerations), only the new equation is compiled and thus there is one equation and it receives a "1". There are a few workarounds:

  1. Don't worry about it: The behavior you describe is only for LyX's display. The PDF output is correct.
  2. Turn off instant preview: Tools > Preferences > Look & Feel > Display and turn "Instant preview" to either "Off" or "No math".
  3. You can force a regeneration of all previews (and thus all equations will be regenerated at the same time and have the correct number) by doing e.g. zoom in. This workaround might only work for LyX 2.2.0 (we are almost in beta by the way if you want to test!).
  4. You can save your .lyx file, exit LyX and reopen. The previews should be correct.