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 have been puzzled by a problem about math equation skip for days. I set the \lineskiplimit, \lineskip, \abovedisplayskip and others length macros before and after equations all to zero, but there has still some skip (see pic). I wanted to know how to get rid of these skip.

There is the code

\documentclass{article}
\usepackage{amsmath}
\usepackage[margin=2in]{geometry}
\begin{document}
\setlength{\lineskiplimit}{0pt}
\setlength{\lineskip}{0pt}
\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}\noindent
Some text some text some text some text some text 
some text
\begin{equation*}
a+b=c
\end{equation*}
Some text some text some text some text some text some text
\begin{equation*}
1^2+2^2+\dotsb+n^2=\frac{n(n+1)(2n+1)}{6}
\end{equation*}
Some text some text some text some text some text some text
\end{document}

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Very strange request but you need (perhaps) \baselineskip=0pt but it's not easy to use it at only some places.

\documentclass{article}
\usepackage{amsmath}
\usepackage[margin=2in]{geometry}
\begin{document}
 \setlength{\lineskiplimit}{0pt}
 \setlength{\lineskip}{0pt}
\setlength{\abovedisplayskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}    
\noindent
{\baselineskip=0pt
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB 
\begin{equation*}
a+b=c
\end{equation*}
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB 
\begin{equation*}
1^2+2^2+\dotsb+n^2=\frac{n(n+1)(2n+1)}{6}
\end{equation*}
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB }
\baselineskip=10pt plus 2pt minus 3pt
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB 
\begin{equation*}
a+b=c
\end{equation*}
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB
\begin{equation*}
1^2+2^2+\dotsb+n^2=\frac{n(n+1)(2n+1)}{6}
\end{equation*}
AAAA BBBBB  AAAA BBBBB AAAA BBBBB AAAA BBBBB
\end{document} 

enter image description here

share|improve this answer
    
@gerx348 The problem is not the equations but the text around. Some skips are used to format lines, paragraphs etc. –  Alain Matthes Jun 27 '11 at 7:25
    
@altermundus if the skip is make because text around, why the second equation can get rid of the skip? –  gerx348 Jun 27 '11 at 9:33
    
@gerx348 I'm not a great TeX expert but I suppose that the skips are elastic as \baselineskip=10pt plus 2pt minus 3pt. This explains to TEX that it should put 10pt (maybe up to 2pt more, maybe up to 3pt less) of glue between the baselines of two consecutive lines in a paragraph (this may depend on \lineskiplimit). Now you need to know the exact mechanism of a lot of things to make what you want. The second equation is higher and with your constraints, the space above is (seems) to be null. I think others skips are used and you need to control all the skips. –  Alain Matthes Jun 27 '11 at 9:46
    
@gerx348 You make a mistake with the second equation because with your code if you put SSSS above the equation there is no space. –  Alain Matthes Jun 27 '11 at 9:52
    
@Altermundus: \showthe\baselineskip shows that \baselineskip is not elastic. –  Hendrik Vogt Jun 27 '11 at 10:04
show 12 more comments

Under usual circumstances you shouldn't want to get rid of that skip. Altermundus told you how you can do it, namely by setting \baselineskip=0pt, but you see that the result is rather ugly. The reason for the skip is that the standard \baselineskip is 12pt, and you can check that the distance between the baselines is exactly 12pt in lines 1--3.

So why is there no skip around the second formula line? The point is: \baselineskip=12pt means that the distance of the baselines has to be at least 12pt, and you get that distance from the large fraction already, so TeX doesn't have put an additional skip.

share|improve this answer
    
vogt I just want all the equations in document have the same sep (above or below) with texts. I think, as in the example Altermundus given, that change the \abovedisplayskip and \belowdisplayskip to 6pt is better than the default appearance (like my pic). –  gerx348 Jun 27 '11 at 12:52
    
@gerx348: Ah, now I see what your aim is - with positive \abovedisplayskip and \belowdisplayskip it sounds quite reasonable. But you should take something strechable, e.g. \abovedisplayskip=6pt plus 2pt minus 1pt. –  Hendrik Vogt Jun 27 '11 at 13:54
    
Yes, I set the \abovedisplayskip to zero just for clarity. –  gerx348 Jun 27 '11 at 14:34
add comment
Some text some text some text some text some text some
Some text some text some text some text some text some
Some text some text some text some text some text some
Some text some text some text some text\par\nointerlineskip
\vbox{\baselineskip=0pt\centering
\[a+b=c\]}\nointerlineskip
\noindent Some text some text some text some text some text some text

Other solutions, such as setting \baselineskip=0pt, have the defect that all the paragraph will be typeset with that parameter, with no separation between lines. Setting only \lineskip is also not a solution, as it will give uneven spacing between lines.

share|improve this answer
    
Thank you for the better solution. But I think the vbox cannot handle as \begin{align*}a&=b\\c&=d\end{align*} situation which could break page between the lines. –  gerx348 Jun 28 '11 at 0:43
    
Of course not. But if you assign it to a box register, you can measure it and even split it. As you see, grid typesetting involving displayed math formulas is quite hard. –  egreg Jun 28 '11 at 8:28
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.