Can I change the paragraph spacing in LyX UI?

I don't think there is any option here.

I checked the .ui files (the obvious place) and they seem to only allow for configuration of the toolbars.

I checked the configuration file and the preference file, again no luck.

A quick google search returned this page which offers the following suggestion, which is the best I can figure as well, and likely to be the only option short of rewriting the LyX binary: insert a --Separator-- between paragraphs (check the pull-down menu to find it).

There might be a way, e.g., through messing with key bindings, to have LyX automatically insert a --Separator-- every time you hit "Enter" to start a new paragraph.

UPDATE: Following Torbjørn T.'s suggestion (see comments to this answer), you can redefine the break-paragraph keyboard shortcut in order to insert a --Separator-- every time you hit enter. Go to LyX->Preferences->Editing->Shortcuts and search "break-paragraph". Select the break-paragraph command and click "Modify". Then, in the "function" text box, delete the "break-paragraph" text and replace it with command-sequence break-paragraph;layout --Separator--;break-paragraph;.


The answer is yes! :) Giant thanks to Dennis and Torbjørn T.!
Here I collected and simplified all info to make paragraph separation work.
NOTE: Nothing you set up here will affect the rendered output, just the look of your LyX UI!

Step 1. Setting up margins and a style which will act as the spacer between paragraphs.
Open Document Settings dialog, go to Local Layout and copy-paste the following:

Format 11
RightMargin 10pt
LeftMargin 10pt

Style --Separator--
         Category            MainText
         KeepEmpty        1
         Margin                Dynamic
         LatexType           Paragraph
         LatexName         dummy
         ParIndent            MM
         Align                    Block
         LabelType           Static
         LabelString          ""
         LabelFont
           Color                 Blue
         EndFont
End

Press "Validate", then press "Apply".

Step 2. Making enter add the paragraph separating space.
Open LyX preferences dialog, go to Editing/Shortcuts. Search for break-paragraph, then select the break-paragraph command and click "Modify". Then, in the "function" text box, delete the "break-paragraph" text and replace it with

command-sequence break-paragraph;layout --Separator--;break-paragraph;

Press "Ok", press "Apply" and press "Save".

Step 3. Add option to be able to access the old paragraph break.
Again, in LyX preferences dialog/Editing/Shortcuts, search for break-paragraph, select the break-paragraph command and click "Modify". Click "Delete Key" and press shift+enter.

Again, press "Ok", press "Apply" and press "Save".

This last step is important, otherwise you would have problems when trying to make an enumeration.

Done.


Tested:

  • OK, LyX 2.0.5 on OSX Lion,
  • OK, LyX 2.0.0 on Windows 7.

If these steps work with your LyX and you don't see it on the list, please edit the post and add yours!


The original ideas are taken from Dennis's answer (appreciate a lot again!).
I slightly modified the text to be typed into Local Layout, so the separator style does really just make a space between two paragraphs.


The best way to get this effect is to add the following style blocks to /usr/share/lyx/layouts/stdlayouts.inc:

Style "Plain Layout"
    ParSep .5
    ParIndent ""
End

Style Standard
    ParSep .5
    ParIndent ""
End

This changes how paragraphs are rendered in the GUI, such that they aren't indented and are separated by a half-line of whitespace. It doesn't change anything about the way the document itself is ultimately typeset. In my configuration I also put "Align left" in both blocks, so words don't move around so much as I'm typing, but that's just my taste.

The above path is for Linux, but you can find the "Library Directory" for your system in the Help > About LyX dialog. You could also put the above blocks in your "User Directory" (e.g. ~/.lyx/layouts for Linux) or in a particular document (e.g. Document > Settings > Local Layout), but I prefer the global file because it applies automatically to all documents.

The nice thing about this solution compared to the others in this thread is that it applies retroactively even to documents you've already written, and it doesn't require putting weird pseudo-elements all over the place.

Alternatively, for people who want space between paragraphs in the GUI and the final output, the Document > Settings > Text Layout > Vertical Space setting will do exactly that.

Tags:

Spacing

Lyx