Graphics, Figures & TablesUnwanted space between text and table in Lyx

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
mkbh10
Posts: 17
Joined: Thu Jun 12, 2014 1:14 pm

Unwanted space between text and table in Lyx

Post by mkbh10 »

I am struggling to remove unwanted space between two paragraphs in Lyx.

The last line at the top and the first line at the bottom (both marked blacked) in the attachment show unwanted white space which i need to remove. The same is happening between a table and the new paragraph that starts below it.
1.jpg
1.jpg (6.77 KiB) Viewed 14829 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Unwanted space between text and table in Lyx

Post by Stefan Kottwitz »

It seems that you are using a class with settings that try to fill a page equally. That's desirable for a book which is printed two-sided, for example. So, if necessary, LyX (LaTeX) stretches vertical whitespace so the page ends at the same place on every page. For normal text, this is often fine, since it is distributed over several stretchable spaces on the page.

In a case, when we have a very bad page break, which means like 10 cm white space at the page, this stretch looks crazy. So, you could improve the page break, or disable that vertical page balancing.

It could be that you use figures or tables without floating. So they would not move within the text for better page breaks. I could tell you more, if you would post a LaTeX exported file as attachment here.

Switching of vertical balancing is easy: simply add \raggedbottom to the document preamble. I just recommend to check the page break situation at that pass though, such as: what comes directly after that page with the big spaces.

Stefan
LaTeX.org admin
mkbh10
Posts: 17
Joined: Thu Jun 12, 2014 1:14 pm

Re: Unwanted space between text and table in Lyx

Post by mkbh10 »

Hi Stefan,

Thanks for the reply, I am using RevTex 4.1 document class but with custom class option of aip,preprint.

I observed that in both the cases where a large space is present between the table and the paragraph or between two paragraphs, the following page has a figure in the beginning. Since the figure with its caption won't fit in the same page, Lyx is generating white space to keep the page margins same.
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Unwanted space between text and table in Lyx

Post by Johannes_B »

Do you use floats to prevent this behaviour? Would be a good idea.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Unwanted space between text and table in Lyx

Post by Stefan Kottwitz »

If you use figure with caption, which is also called a float in LaTeX and LyX, you can adjust settings for optimal page breaks.

Have a look at this LyX dialog - I would consider this "Here definitely" generally as problematic:
lyx-figure.png
lyx-figure.png (27.5 KiB) Viewed 14820 times
"Here, definitely" is a problem if there's simply not enough space Here. So it has to move anyway, but leaves a big gap at the end of a page. The automatism with the other points prevents that.

I would remove the checkmark for "Here definitely", and check Top, Bottom, Page and Here if possible, furthermore I would check "Ignore LaTeX rules" for easier placement.

Try and take a look how the page is filled then.

Stefan
LaTeX.org admin
mkbh10
Posts: 17
Joined: Thu Jun 12, 2014 1:14 pm

Re: Unwanted space between text and table in Lyx

Post by mkbh10 »

The \raggedbottom solved my problem. I'll keep other points in my mind if I face a problem like this in the future. Thanks a lot for your help.
Post Reply