Generaldisplaymath and top margin

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
seson
Posts: 4
Joined: Thu Mar 20, 2008 11:18 am

displaymath and top margin

Post by seson »

Hi,

when I use the displaymath environment, there's a pretty large space between the text. Although I'd like a certain space there, the default one is much to big for me.

Does anyone know how to change it?

Sebastian

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

balf
Posts: 158
Joined: Sat Jan 12, 2008 1:11 am

Re: displaymath and top margin

Post by balf »

Modify the default values of that length, which isn't \topmargin (something completely different) but \abovedisplayskip and \belowdisplayskip ; beware there are two other lengths: \abovedisplayshortskip and \belowdisplayshortskip. They're rubber lengths.

Another possibility for a casual use is the command \useshortskip from the nncmath package. Also, one reason for a too large space might be the default \flushbottom for the layout of your document. Try to see what's happening if you set \raggedbottom in your preamble.

B.A.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

displaymath and top margin

Post by Stefan Kottwitz »

Hi Sebastian,

additionaly, just in case: do not let empty lines (paragraph breaks) before or after displaymath expressions.

balf already mentioned the lengths before and after math expressions, you can read it in even more detail in this math mode document 11.5 Vertical whitespace.

Stefan
seson
Posts: 4
Joined: Thu Mar 20, 2008 11:18 am

displaymath and top margin

Post by seson »

Hi,

thanks for your answers.
additionaly, just in case: do not let empty lines (paragraph breaks) before or after displaymath expressions.
That was my problem. Removing all line breaks solved it.
However, I'd really like to make a line break there in my .tex file, as otherwise, the tex-file becomes very messed up. Text and \begin{xyz} directly behind, \end{xyz} and text again. That's not very convenient to read.

Any ideas?

Sebastian
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

displaymath and top margin

Post by localghost »

As a matter of fairness, I would appreciate if you would have mentioned that you posted your request in other forums, too [1]. I hate to participate in a race for the fastest answers just to find out that the solution is already given in another forum.

[1] CQF.info :: View topic - displaymath and topmargin


Best regards
Thorsten¹
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

displaymath and top margin

Post by Stefan Kottwitz »

seson wrote:Any ideas?
Just begin the otherwise empty line with a % symbol.

Stefan
seson
Posts: 4
Joined: Thu Mar 20, 2008 11:18 am

displaymath and top margin

Post by seson »

Thanks Stefan, that was exactly what I was looking for.

Thorsten: Sorry for that, but you didn't really engage in a race as you didn't even give an answer. Also, there was no "solution given in another forum", it was rather a link to this thread [1].

[1] LaTeX Community • View topic - displaymath and top margin

Sebastian
Post Reply