3

I want a single equation number located between the second and third lines (vertically centered behind the lines):

Screenshot of four-line equation with number to right

as in Section 18.6 of the LyX detailed Math manual:

Screenshot from manual

In Lyx, I choose "insert" → "Math" → "numbered formula", then right-lick the written equation to choose AMS align environment, and use \hspace and Ctrl+Space to adjust manually, but I get all lines numbered!

Screenshot showing a number to the right of each line of a four-line equation

I try to delete the unwanted numbers by right clicking and unticking "number this line". This removed only the last number: the top three are still numbered, which is weird:

Screenshot showing a number to the right of the first three lines of a four-line equation

TRiG
  • 213
  • 1
  • 12
Wendy
  • 221
  • 6
  • 17
  • Before any numbering is done, can you just right-click on the line that you want numbered and click on "Number this line" ? (that is to say, I don't understand why you are starting with all lines numbered). – scottkosty Mar 23 '16 at 04:48
  • But I want the number to be located between the second and third lines (vertically centered behind the lines), as in the Section 18.6 of LyX detailed Math Manual Version 1.5.6. I have updated the manual section into my question. – Wendy Mar 23 '16 at 04:58
  • @Wendy If you have worked it out, please record your solution as an "answer": comments are ephemeral, and don't show up in searches. It would also help enormously if you supplied what code you can. In LyX, go to the menu and select View > Source Pane to show the code (see this example). The more of this kind of thing you can do, the better help you will get! – Dɑvïd Mar 23 '16 at 11:43
  • Thx David, I just did it. It is exciting to write my first answer on this site: ) – Wendy Mar 23 '16 at 12:19

2 Answers2

5

You should select first Insert/Math/Numbered Formula ("Formule numérotée" in my French version of Lyx), and then Insert/Math/Aligned Environment ("Environnement aligné" in French). If I export the resulting program to LaTeX, it contains the aligned environment.

\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{luainputenc}
\usepackage{amsmath}
\usepackage{babel}
\begin{document}
\begin{equation}
\begin{aligned}1 & 2\end{aligned}
\end{equation}

\end{document}
Franck Pastor
  • 18,756
  • Thank you for your reply. I followed your instruction, and two blue boxes appeared. Then which part shall I put in each box? Could you please provide a step-by-step guide (in LyX, as I have limited knowledge in LateX) on how I can get the result I want as shown by the first picture? That is, the number is located between the second and third lines (vertically centered behind the lines). This question bothered me for many hours! – Wendy Mar 23 '16 at 05:23
  • 2
    W in the first box, =a+b+c+d+e+f+g in the second. Then add a new line (there is a button in the math tool line for it) and do similar things for the other lines. Sorry, I've got not enough time for more help until this evening… – Franck Pastor Mar 23 '16 at 05:30
  • 1
    I think the missing step for Wendy might be to right click and then click on on "Number Whole Formula" (or "label"). – scottkosty Mar 23 '16 at 05:31
  • Thx a lot for both of your prompt help. Franck's second post works perfectly. Scttkosty's second post may help others but not for the mistake I made: I right click the written equation to choose the AMS aligned, instead of inserting AMS aligned first, and then copy relevant parts into the two blue boxes. – Wendy Mar 23 '16 at 05:58
  • Another issue: I have many long equations like this, converted from word to Latex code and imported into LyX with line-breakings in unwanted places. If I follow the instructions, I have to copy and paste relevant parts into the two boxes in each line in LyX. Is this the only way or there is a more efficient way? – Wendy Mar 23 '16 at 05:58
  • 1
    My tip for those who have the same problem in the future: ensure your mouse is at the end of the line you just entered, so that it is within the slightly smaller four pink rectangles (not the most outside four pink rectangles), then click "Add row" from the math panel. – Wendy Mar 23 '16 at 06:18
0

I have the following final solution based on the prompt and great help from the experts. According to the suggestion, I included the source code as well: enter image description here

Wendy
  • 221
  • 6
  • 17