8

In LyX user interface, there is a good-enough large space between a chapter text and the next paragraph, but between the paragraphs there is no space and it makes harder to see the structure of what I am writing.

I'd like to increase the spacing between two paragraphs only in the UI. I have not found any relevant options in the application preferences so far. So... Is there any setting file somewhere under the hood which I could tweak?

Thanks for any help!

3 Answers 3

8

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.

5
  • 1
    Nifty modification. Cool stuff!
    – Dennis
    Commented Jan 1, 2013 at 22:43
  • Since LyX is written in Qt (correct me if Im wrong) and there is nothing OS related here... do you think the same would also work for all platforms? I would then loose the OSX tag (and any refs to Macs) from the question. Commented Jan 1, 2013 at 22:48
  • Works in Windows 7, at least, I get an empty line between paragraphs. Commented Jan 1, 2013 at 23:12
  • Are... are they joking? Why is it this complicated? All I want is a bit of space between paragraphs! On any other text editor I would just hit enter twice.
    – Jack M
    Commented Aug 9, 2018 at 20:04
  • @Jack M I agree that there should be an option to change paragraph spacing in the UI. (Note that this does not change the spacing in the PDF output.) Also, if you write a book or a thesis, in other editors you may want to go with changing paragraph spacing with the spacing tools, not repeated enters. Otherwise you'll have a hell of a time trying to adjust spacing in the end when you'll want to shape up the whole thing. Commented Aug 12, 2018 at 7:47
5

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;.

2
  • 3
    Regarding your last paragraph, a possible command would be command-sequence break-paragraph;layout --Separator--;break-paragraph;. Search the keyboard shortcut list for break-paragraph to find the right one. (Note: it appeared when I tried that the "original" cannot be removed or modified, but if one tries to modify it, a new one will be created, and the original deactivated.) Commented Jan 1, 2013 at 19:59
  • I just checked your suggestion and it works. I'll add that to my answer with appropriate acknowledgment.
    – Dennis
    Commented Jan 1, 2013 at 20:07
4

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.

1
  • In MaxOS it's in the Lyx application package (Applications/Lyx/Show Package Content) in Contents/Resources/layouts Commented Apr 16, 2020 at 7:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .