1

I know how the following code work:

\setlength{\jot}{0pt}
\setlength{\abovedisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{0pt}
\setlength{\belowdisplayskip}{0pt}
\setlength{\belowdisplayshortskip}{0pt}

But when there are high/tall/Bigg/integral items in the row, I cannot find a solution for the vertical spacing problem, as describled in the following MWE:

\documentclass[12pt]{article}
\usepackage{amsmath}
\AtBeginDocument{
    \setlength{\jot}{0pt}
    \setlength{\abovedisplayskip}{0pt}
    \setlength{\abovedisplayshortskip}{0pt}
    \setlength{\belowdisplayskip}{0pt}
    \setlength{\belowdisplayshortskip}{0pt}
}
\begin{document}
NULLA ET LECTUS VESTIBULUM URNA FRINGILLA ULTRICES. PHASELLUS EU TELLUS SIT AMET TORTOR GRAVIDA PLACERAT. INTEGER SAPIEN EST, IACULIS IN, PRETIUM QUIS, VIVERRA AC, NUNC. PRAESENT EGET SEM VEL LEO ULTRICES BIBENDUM.
\begin{align}
\int_{0}^t\Bigg(f_i\Bigg)TYU GHJ\\
\frac{ABC}{XYZ} TYU GHJ
\end{align}   
FAUCIBUS. MORBI DOLOR NULLA, MALESUADA EU, PULVINAR AT, MOLLIS AC, NULLA. CURABITUR AUCTOR SEMPER NULLA. 
\begin{align}
TYU GHJ\\
TYU GHJ
\end{align}   DONEC VARIUS ORCI EGET RISUS. DUIS NIBH MI, CONGUE EU, ACCUMSAN ELEIFEND, SAGITTIS QUIS, DIAM. DUIS EGET ORCI SIT AMET ORCI DIGNISSIM RUTRUM.
\end{document}

equation-spacing.jpg

What can we do to get the same spacing as marked by blue rectangles, at the places marked by red lines, where there are tall items in the row?

It is not good to add local spacing like \\[5pt] or \vskip 5pt etc. for each of these scenarios.

Is there a solution which can automatically set the correct/same spacing over and below tall items?

Appreciate any hints.

4
  • Why are you setting to zero those parameters? It's exactly what doesn't work.
    – egreg
    Commented Jan 13, 2023 at 15:22
  • 1
    You can set any length,e.g. 5pt,10pt,but the spacing “difference” problem between the places in red and blue remains.
    – miya
    Commented Jan 13, 2023 at 15:29
  • 1
    Put in another way: the gap above/below tall items are smaller than the gap above/below rows without tall items. To have the same gap is the objective.
    – miya
    Commented Jan 13, 2023 at 15:38
  • 1
    0pt is used just for clearer description in comparison.
    – miya
    Commented Jan 13, 2023 at 15:40

1 Answer 1

1

Sorry, but that's not how LaTeX works.

How is determined the vertical space before and after a (one line) display? You need to consider the baselines of the line before the display, that of the equation and that of the following line.

Between the line above and the equation, TeX inserts the standard interline space, computed as usual:

  • let d be the depth of the line above and h the height of the line below; if d + h + \lineskiplimit is less than \baselineskip, the insert blank space in the amount of \baselineskiphd; otherwise insert \lineskip

  • if the line above is short, insert also \abovedisplayshortskip; otherwise insert \abovedisplayskip

  • the same calculation as above is done below the equation

  • if \abovedisplayshortkip has been used above, insert \belowdisplayshortskip, otherwise \belowdisplayskip.

What happens in your first case? The line before is not short; d + h + \lineskiplimit exceeds \baselineskip, so \lineskip glue is inserted (default 1pt in LaTeX), plus \abovedisplayskip (which you set to 0pt).

Why do you see space in the second case? It's the standard interline space: the line above has no depth. Actually, the three blue boxes should be equal (but the first one in you picture is taller because it covers part of the line above).

You're measuring the wrong things, sorry.

You can increase \lineskip.

\documentclass[12pt]{article}
\usepackage{amsmath}
\AtBeginDocument{
    \setlength{\jot}{0pt}
    \setlength{\abovedisplayskip}{0pt}
    \setlength{\abovedisplayshortskip}{0pt}
    \setlength{\belowdisplayskip}{0pt}
    \setlength{\belowdisplayshortskip}{0pt}
}
\begin{document}

\lineskip=6pt

NULLA ET LECTUS VESTIBULUM URNA FRINGILLA ULTRICES. PHASELLUS EU TELLUS SIT AMET 
TORTOR GRAVIDA PLACERAT. INTEGER SAPIEN EST, IACULIS IN, PRETIUM QUIS, VIVERRA AC, 
NUNC. PRAESENT EGET SEM VEL LEO ULTRICES BIBENDUM.
\begin{equation}
\int_{0}^t\Bigg(f_i\Bigg)TYU GHJ
\end{equation}
FAUCIBUS. MORBI DOLOR NULLA, MALESUADA EU, PULVINAR AT, MOLLIS AC, NULLA. CURABITUR 
AUCTOR SEMPER NULLA.
\begin{equation*}
TYU GHJ
\end{equation*}
DONEC VARIUS ORCI EGET RISUS. DUIS NIBH MI, CONGUE EU, ACCUMSAN ELEIFEND, 
SAGITTIS QUIS, DIAM. DUIS EGET ORCI SIT AMET ORCI DIGNISSIM RUTRUM.

\end{document}

enter image description here

1
  • Thanks for the suggestion. But the \lineskip only affect the equation rows with tall items, still need manual setting to match the normal height rows. For example, if using \setlength{\lineskip}{4ex} , the gap between lines and equation rows with tall items, and normal height rows, are still quite different.
    – miya
    Commented Jan 14, 2023 at 9:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .