Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm a new user of LyX, and reading the tutorial I found that I can't add freely spaces and empty lines to the LaTeX code, since it's about formatting the text, and it's done by the compiler.

I can really understand the philosophy, and that's why I decided to use that tool; what I find hard to understand, is why I can't use spaces and empty lines to improve the readability of the code itself, and maybe let the compiler ignore them. Or maybe there is a "dummy" marker, that allows to insert a space in the code ignored by the compiler?


Follow up: I eventually switched to LaTeX right after that document and sticked to it.

share|improve this question
    
I'm not sure if I understand. I would have thought that adding whitespace and adding multiple lines to separate paragraphs should be allowed. Can you provide a small example (the entire source)? –  Marc van Dongen Jan 8 '12 at 15:08
1  
As Lyx aims to show you the output, not the input, I'm not quite sure how this might work. In 'raw' LaTeX there is no issue with adding additional lines to help with readability. –  Joseph Wright Jan 8 '12 at 15:12
4  
Lyx is not really a LaTeX IDE so much as a system which uses LaTeX 'behind the scenes'. If you are interested in working directly with LaTeX, take a look at tex.stackexchange.com/questions/339/latex-editors-ides –  Joseph Wright Jan 8 '12 at 16:03

7 Answers 7

up vote 9 down vote accepted

Since LyX is attempting to show something that represents the output and not the raw LaTeX input, there isn't a way (that I'm aware of) to put extra spaces in the editor since that would imply having them in the output.

One thing you can do as a "dummy marker" is to insert an "ERT" box (Ctrl+L or Alt+I+X) on the line you want to preserve as empty. The ERT box is copied verbatim into the LaTeX source, so if you leave it empty, it will have no effect on the final document.

Alternatively, you could set the document to use vertical space to separate paragraphs rather than indents (Document > Settings > Text layout). Note that this will change your output as well as the LyX representation, but it's easy to change back when you're ready to export your finished document.

share|improve this answer
    
+1 Good idea! (Sorry, I didn't notice that your answer appeared while I was typing mine, which basically describes the same idea.) –  Daniel Jan 8 '12 at 16:28
    
I think that this is basically what i was looking for, but at the same moment seems that it's against what LyX is conceived for, so thank you for the answer, but i'll try to avoid the need of extra spaces :) –  clabacchio Jan 8 '12 at 17:33

this doesn't address LyX, which i'm nor really familiar with.

however, (la)tex interprets a blank line as a new paragraph. furthermore, paragraph breaks are not permitted within math, so will result in error messages.

you can simulate a blank line in your code by adding a line containing only a % sign at the beginning; this give a reasonable visual equivalent of a blank line.

(la)tex (except when explicitly set up in verbatim mode) interprets multiple spaces as a single space, so adding a few extra (keyed) spaces to provide a visual gap in the input is okay, and often a good idea, especially in strings of math, or to visually simulate column positioning in a table. beware, however, of wysiwyg input software that interprets multiple keyed spaces as indications that multiple spaces are wanted in output, and translates an "additional" keyed space to \ (backslash space) in the tex file; i don't know whether LyX does that, so you should check.

share|improve this answer
    
LyX doesn't accept at all more than one space or a newline; maybe adding commented lines, but i'm not sure if this is possible or not; maybe you can suggest a good IDE for newbies? –  clabacchio Jan 8 '12 at 15:44
    
Maybe TexMaker is a good starter? –  vaettchen Jan 8 '12 at 16:00
1  
@vaettchen: Yes, I've recently switched from TeXnicCenter (my first) to Texmaker and I can recommend both for beginners (comparison of these two). There are several questions on editors here, the one that Joseph linked to above, and more at {editors}. –  doncherry Jan 8 '12 at 16:34

This is not directly possible, and also discouraged by the LyX WYSIWYM philosophy (What You See Is What You Mean), which attempts at show you a formatting that (structure-wise) resembles the output.

A possible workaround is to add an ERT box ("Evil Red Text"), which is LyX's built-in facility to escape to LaTeX (Insert -> Tex Code or Ctrl+L). In this box you can put empty lines that are, as you wrote, ignored by LaTeX if given between paragraphs. If you additionally set the "style" of the ERT inset to "Open" (Right Click -> Settings...), the LyX editor will not collapse the ERT box:

screen shot

share|improve this answer
    
For my own education, what makes this preferable to a LyX note? –  vaettchen Jan 8 '12 at 17:28
    
@vaettchen: Nothing, really. It is more that I find LyX notes to be visually more significant, so they do disturb me a bit if used as "space holders" But in any case it is just a matter of taste. –  Daniel Jan 8 '12 at 18:54

Ctrl + Return. That way is the easiest. For double space you may try Ctrl+ Space.

Hope it helps.

share|improve this answer
3  
Welcome to TeX.SE. I believe that this answer does not address the issue. clabacchio wants to format the source code, not the document itself. –  yo' Jan 11 '13 at 8:24

You can do what you want by adding the following to Document > Settings > Local Layout

Style Standard
    Category              MainText
    Margin                Static
    LatexType             Paragraph
    LatexName             dummy
    ParIndent             MM
    ParSkip               0.4
    Align                 Block
    AlignPossible         Block, Left, Right, Center
    LabelType             No_Label
    KeepEmpty             true
    FreeSpacing           true
    HTMLStyle
        div.standard {
            margin-bottom: 2ex;
        }
    EndHTMLStyle
End

KeepEmpty allows for multiple returns and FreeSpacing allows for multiple spaces. If you decide you want to make this change permanent, either create a layout and put it in your LyX user directory's layout folder or if you want it on a per-document basis, create a module.

All of this information and much more is in Help > Customization

share|improve this answer

In the menu, go to

-> Document | Settings | Text Layout | Line Spacing | Double

That should achieve what you want?

share|improve this answer
    
No, what i mean is the possibility to add empty lines in specific points of the code (f.e. between two sections) to make more easy to find parts of text while writing. –  clabacchio Jan 8 '12 at 15:59
    
You could use bookmarks (menu: Navigate | Bookmarks ). You also can Insert | Note | LyX Note anywhere in the text and also between paragraphs. –  vaettchen Jan 8 '12 at 16:07

In LyX, which I am using, there is a dropdown menu you can use. Insert->formatting->Vertical Space. This provides your printout with extra room, for readability of your product. Does that help?

share|improve this answer
1  
Welcome to TeX.SX! Please check the question again. I think it is about inserting space in the source code of the document which does not go into the printout. –  Stephan Lehmke Jan 1 at 7:47

Your Answer

 
discard

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.