# How do I add numbers to all existing align environments in a Lyx document?

I saw a similar post at Automatic equation numbering in LyX but it didn't answer my question, so hopefully someone can help me out.

I have one of my key bindings set to:

command-sequence math-mode; math-mutate align;


I used this to insert align environments all over my document. None of these are numbered. My goal is

1. to number every existing equation in the document, or
2. to selectively number existing equations without having to cut and paste my equations into new environments.

My LaTeX preamble is listed below. Does anyone know how to turn on numbering?

\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsmath,graphics, setspace}
\usepackage{braket}
\usepackage{color}
\usepackage{multicol}
\let\oldvec\vec
\let\oldsum\sum
\let\oldlim\lim
\let\oldint\int
\renewcommand{\vec}[1]{\oldvec{\mathbf{#1}}}
\renewcommand{\sum}{\displaystyle\oldsum}
\renewcommand{\lim}{\displaystyle\oldlim}
\renewcommand{\int}{\displaystyle\oldint}
\newif\ifsols
\renewcommand{\ifsols}{\ifsols\color{red}}


Edit:

Your suggestions work for my purposes. Thanks for the clear explanations! There is still one problem though. Ideally I would like the equation numbering to continue across multiple align environments. I don't want the numbering to reset at each align environment. Right now, when I click "View" and make my Lyx file into a PDF, the numbers do not reset between environments, which is what I want to happen. However, within the Lyx program, before I make the PDF file the numbers appear to reset at each new align environment. Is it possible to fix this?

• Please provide a MWE (minimum working example) in order to be clearer which is actually the problem. Also, it would be useful to mention in your question how the similar topic you mentioned didn't solve your problem. – Yorgos Jun 11 '15 at 12:39
• If you want to number all unnumbered align environments, the redefinition of align* I describe in the question you mention should work. How does it fail for you? You can of course number individual equations by right clicking -> Number whole formula. (Keyboard shortcut Alt + M, N). – Torbjørn T. Jun 13 '15 at 9:34
• What if I don't want to change the definition of align*? The environments I'm using are align, not align*. I want to be able to use numbered align and unnumbered align* – Ian Jun 13 '15 at 17:47
• The command sequence you specified inserts an align* environment. Starred math environments (from amsmath) are unnumbered. You said numbering all equations in the document was an option, and the redefinition does just that. But as that is not an option, the method I described in my previous comment should work. – Torbjørn T. Jun 13 '15 at 20:46
• Have you turned on Instant Preview in Tools --> Preferences --> Display? I can reproduce that behaviour with instant preview, but not without. (It doesn't matter of course, as you say the PDF is correct.) Edit: Note that I'm not notified of comments to your post unless you write @TorbjørnT. There is tab-completion of usernames, so type @To and you should be able to press Tab to finish the rest. – Torbjørn T. Jun 15 '15 at 8:09

• The more I see how easy ;-) is LyX, the less I like it. – egreg Jun 13 '15 at 23:00