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 prefer inserting blank lines between paragraphs, and no indenting. I know that the package parskip can offer this functionality, but it comes with a catch. When writing

\documentclass{article}
\usepackage{parskip}

\begin{document}
  This is a block of text of paragraph 1.

  \begin{equation}
    a + b = c
  \end{equation}

  This is a continuation of paragraph 1.

\end{document}

Using an environment between paragraphs is interpreted as a paragraph of its own, and hence it adds additional blank lines around the environment. To make it one paragraph block a comment symbol can be applied:

\documentclass{article}
\usepackage{parskip}
\begin{document}

  This is a block of text of paragraph 1.
  %
  \begin{equation}
    a + b = c
  \end{equation}
  %
  This is a continuation of paragraph 1.

\end{document}

This solves my typesetting problem, but it creates a different problem for me. I use Vim to edit my .tex files. By using the comment symbol Vim will see the entire block (pre-equation, equation, post-equation) as a single paragraph (a Vim text object). Text objects can be used to move around and do edits. For example, I can skip easily towards the text before the environment, the environment itself and the text after the environment when they are separated by white lines. It is also easy to comment, delete or change entire (Vim) paragraphs with a few key strokes. I lose these editing capabilities when I have to include the comment symbol, because then Vim sees the text before the environment, the environment itself and the text after the environment as one paragraph.

In short: I want LaTeX to see the three-part block as one paragraph to prevent it from adding extra blank lines, but I want to actually keep blank lines between the three parts in the .tex file for ease of editing reasons.

My question therefore is this: can I get the typesetting that results from the second piece of code without having to include the comment symbols, thus allowing me to navigate my files easily by using vim's paragraph text object?

share|improve this question
2  
I'm confused: it is one paragraph (logically). –  Joseph Wright Sep 20 '12 at 8:18
    
Yes, logically it is. So leaving empty spaces around the environment (an equation in this case) will make the parskip package consider it three separate paragraphs and add blank lines accordingly, which is what I don't want. However, for fast editing (and also clarity), it helps for me to add these empty lines in the .tex file. –  Waldheri Sep 20 '12 at 8:29
    
I'm still confused: why leave the lines at all? Perhaps you might explain for non-Vim users what a 'Vim text object' is an how this impedes editing. –  Joseph Wright Sep 20 '12 at 8:32
2  
I think the usual recommendation is to not leave a blank line before and after a display math environment which the cause of this problem -- not just any environment. Other environments won't exhibit this behavior. And this is not related to parskip. –  Peter Grill Sep 20 '12 at 8:42
1  
I believe you should go to a forum about Linux and ask how to tweak the VIm behaviour in this case, instead of trying to "change" LaTeX. Remember, LaTeX is the goal here and VIm is only a tool, and you should not change the goal because the tool wants it. –  tohecz Sep 20 '12 at 11:37
show 3 more comments

2 Answers

This is a correct behaviour and can be hardly changed. It is correct because sometimes the equation starts or ends a paragraph and sometimes not, and you need to distinguish it easily.

If you are concerned with having the code well-organized, I recommend to indent all displayed maths by a tab or at least 4 spaces to make it distinguishible, like in the following. It will obviously not solve your VIm issue, see my comment to the question.

\documentclass{article}
\usepackage{parskip}
\begin{document}

Pellentesque elementum tincidunt viverra. Quisque nec eros sed
lorem tempor convallis sed non nisl. Suspendisse mattis, nisl
eget iaculis ullamcorper, tortor purus cursus ante, non sagittis
erat leo nec ante. Aliquam ac leo sem, vel iaculis lacus.
Phasellus feugiat vehicula nibh, in iaculis mauris mattis id.
Integer diam arcu, cursus ut rutrum quis, laoreet et quam. Cum
sociis natoque penatibus et magnis dis parturient montes,
nascetur ridiculus mus.
    \begin{equation}
        a + b = c
    \end{equation}
Integer metus lectus, volutpat vitae blandit in, ornare eu
nulla. Suspendisse potenti. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae;
Phasellus et malesuada arcu. Maecenas ornare porta sagittis.
Quisque vel ipsum velit, id vehicula ante. Aliquam eget risus
lorem, a sollicitudin nulla. Sed quis eros ac ante dapibus
luctus. In hac habitasse platea dictumst. Nam nec tempor nibh.
Quisque porttitor velit vel tortor semper eleifend.

\end{document}
share|improve this answer
add comment

The parameters controlling the amount of space above and below display math are \abovedisplayskip and \belowdisplayskip. To set them you can add

\AtBeginDocument{
  \setlength{\abovedisplayskip}{0pt plus 6pt minus 0pt}
  \setlength{\belowdisplayskip}{0pt plus 6pt minus 0pt}
}

to your preamble.

It seems to me that the values above should provide some reasonable spacing when one uses the parskip style. However, it produces very cramped results when there are no empty lines above and below.

It seems to me that the issue should be addressed at the editor level (vim) and not at the typesetting level (TeX and friends)

share|improve this answer
add comment

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.