TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I center/right/left align text in LyX? In Microsoft Word, I can just click the 3 buttons on the toolbar.

share|improve this question
up vote 8 down vote accepted

Horizontal alignment is associated with a paragraph style in LyX. Select the paragraph, click Edit>Paragraph Settings... (or click the LyX paragraph settings button button in the toolbar) and choose one of the Alignment options:

LyX paragraph settings

Click OK or Apply for the selection to take effect. Checking Immediate Apply allows one to toggle and visualize the difference between selected options.

For inserting horizontal fill (or \hfill; which also leads to a flush left and flush right formatting on the same line), you follow Insert>Formatting>Horizontal Space... and for the Spacing choose Horizontal Fill:

enter image description here

Upon clicking OK, your document will show the horizontal fill as a stretchable dotted line which shrinks/expands to fit the window

enter image description here

and eventually typesets/compiles to

enter image description here

A similar output would have been obtain through the insertion of "TeX code":

enter image description here

share|improve this answer
That works. However when I try aligning "within" certain parts of text, those options move all the text. For example, on a certain line, I want to right align some text and left align others. How can I do that? – GTyler Jan 6 '12 at 1:14
@GTyler: Yes, that's why they are called "paragraph settings", so they apply to an entire paragraph. If you want to have left- and right-aligned text in the same "line", and that line is a paragraph, then you can insert \hfill between the text components. Is this what you're after? – Werner Jan 6 '12 at 4:22
@GTyler For reference, \hfill is in LyX found in Insert --> Formatting --> Horizontal space. Choose "Horizontal fill" for Spacing. – Torbjørn T. Jan 6 '12 at 7:08
Yes that's what I am after. Since I am still new to Lyx, I prefer the click-and-choose rather than remembering LaTex code. – GTyler Jan 9 '12 at 6:09
@GTyler: I've added that description to my answer. – Werner Jan 9 '12 at 6:28

Select all the lines that you need to align (middle/left/right). Then right click and under text style select structure Now, the whole part is one structure Again select this complete structure Next, use paragraph settings to align the texts :)

share|improve this answer
As it seems, this solution is working for mathematical statements. You are welcome to tweak the solution to fit your purpose – Mrinal Singh Nov 17 '13 at 19:19
Hi, welcome to TeX.SX. I don't see a Structure under Text style in the right click menu when right clicking on selected text. – Torbjørn T. Nov 17 '13 at 19:42

The simple and fastest way is: once you are in the desired place just click on the "TEX" button (next to the hyperlink one) and in the box just add the following:


To have dots between just do:


And to have a line:


You can find more information here: http://www.personal.ceu.hu/tex/spacebox.htm

share|improve this answer
Welcome to TeX.SX! Can you explain how your solution is different from the last part of Werner's answer? – Paul Gessler Oct 17 '14 at 22:59
@PaulGessler I just updated my answer. I think it adds more information. – magamig Oct 18 '14 at 0:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.