1

In Lyx, how can I reset the line numbers between display-style equations?

For example, if I have the following setup:

Some text
   Line of display-style equation
   Another line of display-style equation
   A third line of the same
More text
   Line of a new display-style equation
   Another line of the same new one
Text again

and activate MathNumber Whole Formula on both equations, the line numbers are (1) (2) (3) as expected for the first equation, but (4) (5) for the second. This is unexpected. I would like the numbers to be (1) (2) (3) for the first, then (1) (2) for the second.

I tried this, adding \@addtoreset{equation}{part} to my preamble (the equations happen to be in different parts, even though that's not always true), in the hope that equation numbering rules might also apply to line numbering rules, but to no avail.

How can I achieve this?

2

You can reset the numbering of equations by adding the following to your document preamble (Document > Settings... > LaTeX preamble):

\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\makeatletter
\let\old@start@align\start@align
\def\start@align{\setcounter{equation}{0}\old@start@align}
\makeatother

This patches the align-related macro used at the start of the environment to always reset your counter to 0 (counters are typically incremented before setting them). Your LyX display will resemble

enter image description here

but the output will be

enter image description here

| improve this answer | |

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.