25

I only know that we have to make at least one blank line between two adjacent paragraphs.

My question is:

What is the proper way to make use of a blank line ?

For example:

  1. Is it recommended to make a blank line between heading command call, e.g. \chapter{}, and the first text content as follows?

    \chapter{Introduction}
    
    In this chapter we ....
    

    or

    ... that is proven true.
    
    \chapter{Limit}
    
  2. Is it recommended to make a blank line between two consecutive display equations as follows?

    \[ \sin x \] 
    
    \[ \cos x \]
    
  3. Is it recommended to make a blank line between a sentence and a display equation as follows?

    Assume we have
    
    \[
      \cos x
    \]
    

    or

    \[
      \cos x
    \]
    
    that satisfies ...
    
  4. etc...


Edit 1:

  1. How about \bigskip, \vspace{}? Does each of them needs one blank line before and one blank line after as follows:

    Yes. This is a book.
    
    \bigskip
    
    Commander, please open the silo!
    

    or

    Yes. This is a book.
    
    \vspace{1km}
    
    Commander, please open the silo!
    
Display Name
  • 46,933
  • @Joseph, a pair of back-tiks cannot span multiple lines I think. – Display Name Dec 28 '10 at 10:18
  • See also the explanation in http://tex.stackexchange.com/questions/565/how-can-i-get-rid-of-indentation-after-an-equation/566#566 – Caramdir Dec 28 '10 at 11:05
  • 1
    Oops, I accidentally left the following comment on Hendrik's answer instead of the question. Hendrik has the right answer, I think. I'd only point out (and this doesn't deserve its own answer) that a blank line after \chapter doesn't matter. It will display the same. In the other cases, starting a new paragraph (by using a blank line) will have an effect. – TH. Dec 28 '10 at 11:12
  • 1
    @xport: for source code in lists, you need to indent the code by an additional four spaces. I’ve changed the text for you. If you don’t like how this renders, you can roll the change back. One thing that is still wrong about this posting is that two empty lines are inserted in the code, in place of just one. This appears to be a bug, and I’m reporting it on meta. – Konrad Rudolph Dec 28 '10 at 11:13
  • @Konrad, thanks for editing. It looks much better than my setting before. – Display Name Dec 28 '10 at 11:49
  • @Konrad, Back-tick back-slash opening-square-brace back-tick DOES NOT WORK: \[ – Display Name Dec 28 '10 at 13:50
  • 1
    @xport: only in comments (markup in comments is amputated, don’t rely on it too much). In the actual question/answer text, the same code works. – Konrad Rudolph Dec 28 '10 at 13:59

3 Answers3

20

I can tell you what I'd do in these 3 cases:

1.: After \chapter{} and similar command I'd always use a blank line as it makes the document structure clearer. Moreover, "In this chapter ..." is the start of a paragraph.

2.: I wouldn't use a blank line here if both displays belong to the same paragraph. However, I usually wouldn't use two consecutive displays at all; I'd use align* or gather* instead.

3.: In that particular case don't use blank lines as everything is within one paragraph. Speaking of clarity of the document structure, I'd say that

Assume we have    
\[
  \cos x
\]
that satisfies ...

is clear enough. Only use a blank line after the display if the paragraph ends after the display.

4.: As for your extra question about vertical spacing commands: In the context you provide, I'd always surround them with blank lines for clarity of the document structure. I sometimes use them before a display like this; then you mustn't put a blank line:

... some text
\vspace{-1ex}
\[
  ...
\]

I should point out that manual corrections like in this last example are rarely needed, and you should only use them if you're sure that you know what you're doing.

Hendrik Vogt
  • 37,935
  • 4
    In 3 also the blank lines produces bad spacing. – Caramdir Dec 28 '10 at 11:06
  • @Hendrik, thanks for almost complete answer. One more case has been added above regarding \bigskip and vspace. – Display Name Dec 28 '10 at 13:53
  • @Hendrik: no4 looks wrong for correct typesetting with TeX. because the lengths abovedisplayskip and abovedisplayshortskip should only be used here. –  Dec 29 '10 at 07:17
  • @Herbert: I tried to word it carefully: Note the "sometimes". I do know about the displayskips, but sometimes they don't work out nicely for me, so I put manual corrections. The situation in no.4 happens, e.g., if there's a lonely integral sign in my display and the overlap is just too small for the shortskip. I know that I must only do stuff like that in the very end. – Hendrik Vogt Dec 29 '10 at 07:22
  • @Hendrik: please give an example –  Dec 29 '10 at 07:41
  • @Herbert: I'm not sure what you mean. Do you mean I should add a more explicit example to my answer, or can't you imagine why I would want to use this kind of \vspace{-1ex} at all? – Hendrik Vogt Dec 29 '10 at 07:59
  • @Hendrik: I am interested in mathematical typesetting and want to know where a vspace{-1ex} should make sense when using \[ ... \]. From my point of view it is wrong. But I cannot say more without a complete example. –  Dec 29 '10 at 08:06
  • @Hendrik: here an example were it is totally wrong: \documentclass{article} \begin{document} ... some text \vspace{-1ex} \[ \int_1^\infty \frac{1}{x^2}\mathrm{d}x \] bar \end{document} –  Dec 29 '10 at 11:53
  • @Herbert: Please be patient with me; I won't really have time before tomorrow. In your above example, it could be that I'd do something like that if there is some additional expression before the integral sign. – Hendrik Vogt Dec 29 '10 at 15:17
  • @Herbert: OK, here's a snippet of something I really wrote. I did use \vspace{-1ex} before the \[ to achieve the spacing. (And I think the reduced spacing before the display looks better.) If you have a better suggestion, I'm very interested. – Hendrik Vogt Dec 30 '10 at 07:41
  • @Hendrik: looks like a complete wrong spacing. Can you send me the code snippet to hvoss@tug.org, please. And with the used documentclass –  Dec 30 '10 at 07:50
  • @Herbert: It's part of a really long text, so before I send you anything, can you please tell me what's wrong about it? – Hendrik Vogt Dec 30 '10 at 07:54
  • @Hendrik: the line over the formula ends before it starts, the reason why TeX should use \abovedisplayshortskip to insert less vertical space. It seems that in this case \abovedisplayshortskip has the same value as \abovedisplayskip which is wrong. –  Dec 30 '10 at 08:07
  • @Herbert: Thanks a lot for your comment. I'm sorry, I did indeed mess around with the shortskips, for reasons you can find here. Here's a minimal example without messing around: \documentclass{article} \textheight=2cm \begin{document} \def\blah{blah blah blah blah } \blah\blah\blah\blah\blah\blah\blah and we infer that \vspace{-1ex} \[ T(\xi_\theta)f(\theta) \le \bigl(T(\xi_0)f(0)\bigr)^{1-\theta} \bigl(T(\xi_1)f(1)\bigr)^\theta. \] Blah \blah\blah$\|f(j)\|_{p_j}\le1$ \blah \end{document} – Hendrik Vogt Dec 30 '10 at 09:09
  • @Hendrik: without the \vskip you get the correct typesetting for displayed math equations when the line above ends before the math expressions begins. It is a vertical space which is 10pt smaller than for a longer line. However, if you do not like this, you can alternatively define \abovedisplayshortskip=-1ex plus 3pt –  Dec 30 '10 at 18:33
  • @Herbert: As I said, I do know about the displayskips. And I did already mess around a bit with them to adjust them to what I like. However, they make some automatic rough decision what skip should look good, and sometimes I'm not happy with the automatic decision. I still don't quite see what I can do except manual corrections at that specific places. Do you see what I mean? – Hendrik Vogt Dec 30 '10 at 21:41
  • @Herbert: Thanks for your above comments. They made me add a word of caution to my answer. If you think that the answer is OK with this addition, and if it was you who cast the downvote, then please consider reverting it. (If you think it's still not OK, then I'd be glad to know an alternative. The only point that I'm quite sure about is that sometimes I do need manual corrections.) – Hendrik Vogt Dec 31 '10 at 16:03
  • @Hendrik: the downvote was already by mistake, didn't know what the "golden" pen should be ... –  Dec 31 '10 at 16:35
  • @Herbert: Oh, I see, you haven't really voted so far. The faq tells you that your votes are most welcome! – Hendrik Vogt Dec 31 '10 at 17:35
5

it gives wrong vertical spacing, when you use blank lines before, between and after display math environments. Compare the following output, where the equation environment has not the same spacing over and under the math expression.

\documentclass{article}
\begin{document}

\begin{minipage}{0.49\linewidth}
The line above the equation.

\[ f(x)=\prod_{i=1}^n\left(i-\frac{1}{2i}\right) \]

The line below the equation.
\end{minipage}\hfill\begin{minipage}{0.49\linewidth}
The line above the equation.

\begin{equation} 
f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right) 
\end{equation}

The line below the equation.
\end{minipage}

\bigskip
\begin{minipage}{0.49\linewidth}
The line above the equation.
%
\[ f(x)=\prod_{i=1}^n\left(i-\frac{1}{2i}\right) \]
%
The line below the equation.
\end{minipage}\hfill\begin{minipage}{0.49\linewidth}
The line above the equation.
%
\begin{equation} 
f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right) 
\end{equation}
%
The line below the equation.
\end{minipage}
\end{document}
  • thanks for your answer. From this I know that blanks lines before and/or after display equation (either \ [...\ ] or \begin{equation}...\end{equation}) will produce different spacing on the output. – Display Name Dec 28 '10 at 13:44
2

For your new part 4, the answer is it doesn't matter. \bigskip expands to \vspace\bigskipamount and \vspace contains code that deals with it be used in horizontal mode (namely, it inserts the \vskip into the surrounding vertical list after the current line using \vadjust).

TH.
  • 62,639