# Numbering equations with LyX

I am using LyX with layout report for my thesis. I would like to have numbering on my equations but dont know how to do it. I'd like the first number to show the chapter and the second one the number of equation in this chapter. For example

4.2 (second equation on chapter 4)

How can i make this possible in LyX?

• You make the equations numbered without changing the preamble. Right click the equation --> Number this formula. Of course, if you already have a bunch of equations, your method is easier ... – Torbjørn T. Nov 20 '12 at 15:45

The "proper" way to do this would, I suppose, be to turn on the numbering of the equations you want to number. You can do this by right clicking the equation and selecting Number this formula. There is also a keyboard shortcut, Alt + M N (hold down Alt, press M, release both, press N), which will work if the cursor is inside in equation.

Of course this is tedious work if you have a lot of equations, so it is better to number as you go. Either by adding a normal displayed equation and numbering as mentioned above, or inserting a numbered equation directly, with Insert --> Math --> Numbered formula.

This is also quite tedious, Ctrl+Shift+M is much easier. What one can do is to modify this shortcut to insert a numbered formula instead, or add a new shortcut for this purpose. Changing keyboard shortcuts are done in Tools --> Preferences --> Editing --> Shortcuts, see e.g. Shortcuts for Lemma, Claim, Theorem etc for details. A function you can use for such a shortcut is

command-sequence math-mode on; math-mutate equation;math-number-toggle


Again though, this doesn't help if one already has written the entire document with unnumbered equations. Then the trick mentioned in the LyX wiki, that you seem to have found, is more convenient: go to Document --> Settings --> LyX preamble and add the following two lines:



This won't add numbering of the equations within LyX, but in the PDF they will be numbered.

• How can this be extended to number equations in an align environment? – Richard Border Mar 8 '18 at 18:01
• @RichardBorder Not sure, but I would turn on numbering manually as described in the first paragraph of my answer. I think that is the best approach anyway. – Torbjørn T. Mar 8 '18 at 20:34
• Unfortunately that appears only to automatically number unaligned displayed equations – Richard Border Mar 8 '18 at 21:52
• @RichardBorder You seem to be referring to the last paragraph of my answer, I was referring to the first paragraph. – Torbjørn T. Mar 8 '18 at 21:56
• Ah! You;'re right, got it! – Richard Border Mar 9 '18 at 19:02

You can type in $$a=b$$, select it and then use "Ctrl + M".

• This does not guarantee a per-chapter numbering of equations. – Werner Feb 16 '17 at 16:42
• @Werner If you want a chaper numbering of equations you can simply add \numberwithin{equation}{chapter} in the preamble. – Doris Feb 16 '17 at 20:16