2

enter image description here

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.

larrybr
  • 21
  • 2
    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 08 '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 08 '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 08 '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 09 '15 at 00:14
  • Does http://tex.stackexchange.com/questions/83509/hfill-in-math-mode help? – scottkosty Aug 09 '15 at 00:27
  • Just aside: when I use regular LaTeX to compile your example I get the right output right away! – Ruben Aug 09 '15 at 01:48
  • does this answer help? How to put a text right-sided in centered an equation? if not, then please draw (on paper) a more detailed picture of what you want, scan it, and add it to your question. – barbara beeton Aug 09 '15 at 12:23
  • Hi scottkosty, thx but the link you post didn't help much:( It's not exactly the same question. – larrybr Aug 09 '15 at 21:12
  • Thx barbara, I have edited my post again. sry for the confusion. – larrybr Aug 09 '15 at 21:13
  • The latex code would help. Note a package like ntheorem can do that automatically. – Bernard Aug 09 '15 at 22:30

2 Answers2

1
  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".
Sean Allred
  • 27,421
  • 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 08 '15 at 20:44
0

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 08 '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 09 '15 at 00:09