# How to add horizontal fill after an displayed equation in lyx?

So how to put the horizontal fill immediately after the displayed equation? I mean, I want the "(equation 1)" to be in the same line as the displayed equation. How should I do that? Guys please help! Thx!

I clicked "View" then "Source Pane" and it appears a window with the following Latex codes:

$1+1=2$

\hfill{}(equation 1)


I want to make my displayed equation look like the following one, where the text (the conclusion mark here in the picture) is in the same line as the equation, and it's at the right end. Lyx wouldn't allow me to do so. Whenever I insert a horizontal fill right after the displayed equation, after I press enter, it will automatically move the horizontal fill to the next line, and that's my problem.

• welcome to tex.sx. we really need more information; just a picture doesn't say how this was input, and knowing that is essential to being able to give a diagnosis. please add a "minimum (non)working example" (mwe), starting with \documentclass and ending with \end{document} that demonstrates the problem. – barbara beeton Aug 8 '15 at 12:20
• sry i don't quite understand u. how to add a diagnosis? I'm using lyx rather than typing latex myself. – larrybr Aug 8 '15 at 20:45
• maybe you can cut and paste the code that is in your lyx window. we really do need to see code. i have never seen a result like the one you are showing, so i am unable even to guess what may be happening. if you specify a displayed equation, it should never be necessary to add horizontal fill; a displayed equation is either automatically centered, or (if that is specified) flush left with the equation number at the right margin. – barbara beeton Aug 8 '15 at 20:50
• Hi barbara, thx but the thing is I want to put a text at the end of the same line with the displayed equation, with the equation still in the middle. I edited my post and add the latex code for ur view. – larrybr Aug 9 '15 at 0:14
• – scottkosty Aug 9 '15 at 0:27

1. Write "equation 1".
2. Click Ctrl+m then write your equation.
3. Put the cursor between the text and the equation.
4. From the main menu, "insert" then "horizontal fill".
• but I also want to make the equation a displayed one, not an inline one. after i press enter, the horizontal fill will automatically jump to the next line. How to make the horizontal fill to be in the same line as the equation? – larrybr Aug 8 '15 at 20:44

you can do it by:

- from "insert">math>matrix...

- in matrix window, let rows=1 and columns=5

- write your equestion formula in first cell (num1).

- write your text in last cell (num5).

• Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Martin Schröder Aug 8 '15 at 23:40
• Hi mandrivagnome, thx but it doesn't work well. They are in the same line now but the text is not at the end of the line. How should I put the text at the end of the line while keeping the equation displayed in the middle? – larrybr Aug 9 '15 at 0:09