TransWikia.com

Space between equations/figure depends on previous paragraph/newline

TeX - LaTeX Asked by Tom Müller on May 11, 2021

I need to rewrite a Latex book and optimze the code and found a "problem" which I cant solve and dont find a global solution.

In my opinion the code is better to read, if there is a newline/paragraph between text and equation-block.
But this leads to an bigger cap between text and equation, which I try to avoid.

My question is, is it possible to insert a new line in code (for easier code reading) without increasing the gap between text and equation?

Here is my minimal code example:

documentclass{book}
begin{document}
chapter{Gap}
section{testcase 1}
This is a test sentence and has nothing to do with the real problem.
    begin{equation}
        a=b+x
    end{equation}
This is a test sentence and has nothing to do with the real problem.


section{testcase 2}
This is a test sentence and has nothing to do with the real problem.

    begin{equation}
        a=b+x
    end{equation}

This is a test sentense and has nothing to do with the real problem.

end{document}

Here a picture how it looks like:
Text

I know its not a big difference but still.

One Answer

Actually, there is a semantic difference as well.

Compare where the second sentence starts (paragraph indent). In one case you have started a new paragraph (with the empty line), in the other (without the empty line) you have just continued the current paragraph.

If you want to have an "empty line" in the source code without an impact on the typesetting, use % at its beginning to comment it.

Answered by ivankokan on May 11, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP