1

I know the code I need to use to numerate the bottom page in LyX but I don't know where to put it, and I can't find how to numerate equations according to the section where they belong.

  • 1
    Welcome to TeX.SX! Please help us (and also you) and add a minimal working example (MWE), that illustrates your problem. - (1) see package fancyhdr (2) Related: \numberwithin{equation}{subsection} fails for subsections “0” or Numbering equations differently before sections start within chapter – Bobyandbob Aug 27 '17 at 16:17
  • For the first part, you probably need to add it to Document --> Settings --> LaTeX preamble, but I'm not entirely sure what you mean, so I may be wrong. For the second, Document --> Settings --> Modules, add the "Number Equations by Section" module. – Torbjørn T. Aug 27 '17 at 17:40
  • For the second, after load that module, right-click in the equation, then in the contextual menu, check other mode than Inline formula (Eqarray Environment, for instance) and after that you will see in the same menu Number Whole Formula. – Fran Aug 27 '17 at 18:54
  • @Fran Never recommend eqnarray (https://tex.stackexchange.com/questions/196/eqnarray-vs-align). If the equation is inline in first place (I assumed that Moltimor already had numbered, displayed equations), then it likely should be a single line display anyway, so the standard Displayed Formula option is the way to go. – Torbjørn T. Aug 27 '17 at 20:53
  • @TorbjørnT. I did not intend to recommend anything, only show as example one of the several (seven, to be exact) options that activate a new menu section with Number Whole Formula and Number This line and Equation Label. – Fran Aug 27 '17 at 22:44
  • @Fran Fair enough, but you just happened to pick the worst ... – Torbjørn T. Aug 28 '17 at 04:58
  • @ It often happens when I choose randomly ... – Fran Aug 28 '17 at 08:34
  • I edited the equations once a time as Fran said, but it was a little tedious. I didn'h have much equations but if I have had them, isn't there a way to do this automatically? And regarding the number of the page at the bottom, what is the code I must use in the preamble? – Moltimor Aug 28 '17 at 12:29
  • I tried to insert \pagestyle{fancy} in latex preamble, but I get the error "Undefined control sequence" – Moltimor Aug 28 '17 at 12:48
  • Regarding equations: were they displayed equations to begin with, only unnumbered? You might find https://tex.stackexchange.com/questions/83531/numbering-equations-with-lyx/85145#85145 of interest. In general though, it's a bit hard to give specific advice when we don't know what you've done. – Torbjørn T. Aug 28 '17 at 20:57
  • Regarding page number: a) you said you knew the code ... b) page number in the footer is actually the default of the standard class, so you must be using something else. c) You need \usepackage{fancyhdr} before \pagestyle{fancy}. – Torbjørn T. Aug 28 '17 at 21:01
  • Two other things: i) Neither me nor @Fran was notified of your last comments, because you didn't write @username in any of them. Note that you can only ping one user per comment. ii) referring back to what I said about not knowing what you did. It will very often be useful if you can make a minimal example. I.e. not your entire document, but the smallest subset of it needed to demonstrate your issue. The .lyx file is a plain text file, you can open it in a text editor and copy-paste it into your question. – Torbjørn T. Aug 28 '17 at 21:06
  • @TorbjørnT. Thanks for your help. I found the solution, and I was a little dumb for not noticing earlier. LyX numerates automatically the pages, but I had an \pagestyle{empty} at the beggining of my document. So erasing it solved the problem – Moltimor Aug 29 '17 at 15:25

1 Answers1

2

(Summarizing comments.)

To have equations numbered by the section they're in, i.e. have equation numbers of the form <section number>.<equation number>, go to Document --> Settings --> Modules, and add the Number Equations by Section module:

adding module

(This basically just adds \numberwithin{equation}{section} to the preamble, and makes sure amsmath is loaded.)

If your equations isn't numbered, then you should edit them to be so, e.g. via the right-click menu, or the keyboard shortcut Alt + MN. See also Numbering equations with LyX


The default layout of the default class has the page number in the center footer. So unless a different class is used, or customizations has been done to the \pagestyle, you will have the page number in the footer.

Torbjørn T.
  • 206,688